[Closed] Extend ColorAnimationExtensions with generic 'ColorTo' extension #201
Closed
PieEatingNinjas
started this conversation in
New Feature Discussions
Replies: 2 comments 4 replies
-
I like where this idea is going! The implementation is a little tough to infer for new users, though. I.e. If I saw this method in intellisense, would I know how to use it without looking at the documentation? Task ColorTo(this VisualElement, Func<T, Color> colorProperty, Color color, uint rate, uint duration, Easing easing) Probably not; I'd certainly be confused by the point of the Func. Proposal: Extend
|
Beta Was this translation helpful? Give feedback.
4 replies
-
Closed as answered. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently the
ColorAnimationExtensions
class has 1 methodBackgroundColorTo
which helps animating the color transition of aVisualElement
'sBackgroundColor
.We could (relatively) easily make this method more generic so we can use it for other properties of type
Color
onVisualElements
as well.For example:
label.ColorTo(l => l.TextColor, color, rate, duration, easing);
Where the first parameter identifies which property of type
Color
to update/animate. This parameter is of typeExpression<Func<T, Color>>
Is this something that would be desired for the Toolkit? I'd think that animating the
TextColor
of aLabel
for example is something devs might want.This
ColorTo
method doesn't need to replace the existingBackgroundColorTo
method, as the genericColorTo
is a bit more complex to use because of the extra parameter. Plus, the existingBackgroundColorTo
will be more efficient compared toColorTo
where you would need to pass-in theBackgroundColor
property. So both can live side by side.Alternatively, we could overload the
ColorTo
method, one with the new parameter and one without, where the last one updates the BackgroundColor (== current implementation ofBackgroundColorTo
)Let's discuss! 🙂
Beta Was this translation helpful? Give feedback.
All reactions