Skip to content

How do i tween a Color? #53

Answered by KyryloKuzyk
ZedDevStuff asked this question in FAQ
Discussion options

You must be logged in to vote

There is currently no built-in support for animating UIToolkit color, but it's possible to animate anything with the Custom animation:

Color startValue = visualElement.style.color.value;
Color endValue = Color.red;
Tween.Custom(visualElement, startValue, endValue, duration, (target, val) => target.style.color = val);

Currently, only these properties are supported. I'll add support for UIToolkit's color and backgroundColor in the next PrimeTween version. Please tell me what other UIToolkit properties you would like to see.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by KyryloKuzyk
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
FAQ
Labels
None yet
2 participants