Description
What problem does this solve or what need does it fill?
Components like TextColor
and BackgroundColor
cannot currently be easily animated without creating a custom AnimatableProperty
.
What solution would you like?
Add support to the animated_field!
macro (and consequently AnimatedField
) for tuple structs. I'm not sure what the cleanest way to do this is from an implementation perspective, since the $ident
pattern doesn't match tuple struct field indices and I'm not sure if it makes sense to use $literal
, as that matches more than just field indices.
What alternative(s) have you considered?
- Add an alternative easy way to animate tuple structs (e.g. a separate macro/type)
- Maybe something could be done with
Deref
and a blanket implementation ofAnimatableProperty
? But this puts the burden on components to implementDeref
, only works for tuple structs with single fields, and also introduces potential conflicts with trait implementations because it would be a blanket implementation
Additional context
I was specifically trying to animate UI color alpha when I ran into this, and I wonder if it's worth considering if there should be easy ways to get a &mut
to a Color
's alpha and also possibly animate individual fields of a component's fields (e.g. animating Transform::translation::x
), but that's a separate issue and probably a little more complicated.