[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
Uh oh!
There was an error while loading. Please reload this page.
-
Currently the
ColorAnimationExtensionsclass has 1 methodBackgroundColorTowhich 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
ColoronVisualElementsas well.For example:
label.ColorTo(l => l.TextColor, color, rate, duration, easing);Where the first parameter identifies which property of type
Colorto 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
TextColorof aLabelfor example is something devs might want.This
ColorTomethod doesn't need to replace the existingBackgroundColorTomethod, as the genericColorTois a bit more complex to use because of the extra parameter. Plus, the existingBackgroundColorTowill be more efficient compared toColorTowhere you would need to pass-in theBackgroundColorproperty. So both can live side by side.Alternatively, we could overload the
ColorTomethod, 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