UI Toolbox logoUI Toolbox

AnimatedLabel

An AnimatedLabel is a Label that colors, highlights and moves parts of its text. An effect tag in the text marks a part, as a rich text tag does.

A label with the text You found Sunforged Greatsword. The name of the item is orange and its letters move in a wave

<UIToolbox.AnimatedLabel text="Text &lt;gradient&gt;Animation&lt;/gradient&gt;" />
<UIToolbox.AnimatedLabel text="Level up" effect="Wave, Rainbow" />
title.text = "Text <gradient>Animation</gradient>";
loot.text = "You found a <gradient=#ffd60a,#ff9f0a><wave>LEGENDARY</wave></gradient> sword";
hint.text = "Press <highlight>Space</highlight> to jump";
health.text = "<pulse>Low health</pulse>";
health.Playing = false; // stops the effects at the current moment

Effect tags

Tag Effect
<gradient> A color blend from the start of the part to its end. The blend moves along the text. <gradient=#from,#to> gives the two colors.
<rainbow> All hues along the text. The hues move.
<wave> The glyphs move up and down, one after the other.
<shake> Each glyph shakes on its own.
<pulse> The text fades out and in.
<shimmer> A light band moves across the label.
<highlight> A colored rectangle behind the text, as from a marker pen. <highlight=#color> gives the color. It does not move.

Members

Member Description
text The text with the effect tags.
DisplayText The text that the label draws: text without the effect tags.
Effect (effect) The effects of the whole text, a set of TextEffects values: Gradient, Rainbow, Wave, Shake, Pulse, Shimmer, Highlight. The effect tags add to them.
Speed (speed) The speed of all effects (1). Zero stops the movement and keeps the colors.
Playing (playing) False stops the effects at the current moment (true).
Amplitude (amplitude) The distance in pixels that a glyph moves in a wave or a shake (4).
GradientFrom, GradientTo The colors of a gradient that has no colors in its tag. A value set in code replaces the USS variable.
HighlightColor The color of a highlight that has no color in its tag. A value set in code replaces the USS variable.
IsAnimating True while the label changes its glyphs each frame: it has an effect that moves, Playing is true and Speed is not zero.

Styling

Class or variable Element
tb-animated-label The label: --tb-color-text, and the text wraps.
--tb-animated-label-gradient-from The first color of a gradient (#FF2D55).
--tb-animated-label-gradient-to The last color of a gradient (#7B2FF7).
--tb-animated-label-highlight The color of a highlight (rgba(255, 214, 10, 0.35)).
.quest-title {
    --tb-animated-label-gradient-from: #ffd60a;
    --tb-animated-label-gradient-to: #ff9f0a;
}