I have a karaoke game and would like to have a rolling color wipe for the current lyrics.
At the moment, I create a label element for every syllable.
This works ok, but it could be improved with a smooth wipe of colored text on pixel level instead of syllable level.
One solution could be to use masking, but this is not yet available in UIToolkit.
Are there other ways how this could be achieved?
You could put each row of text inside a plain Visual Element. Then you set that Visual Element’s overflow property to hidden. Finally, you animate the Visual Element’s width to reveal the text it contains.
How about having one label with the entire text and use rich text tags to set the alpha?
Of course, you could then only fade character by character, but it would spare you the hassle of having so many labels.
I would have just suggested using a overflow hidden visual element as well as the parent with the label set to position.absolute and then adjusting the overflow hidden parent dimensions/position/translation.