Skip to content

Conversation

@ickshonpe
Copy link
Contributor

@ickshonpe ickshonpe commented Jan 23, 2026

Objective

The animated_ui example interpolates the font size of the animated text entity, which rapidly generates gigabytes of font atlases.

Also, on main the text isn't even visible (and it still generates infinity font atlases).

Fixes #22626, #22647

Solution

Spawn the text with its font size set to the maximum value from the old animation curve. Then scale the text by interpolating the UiTransform::scale field, instead of the font size.

Testing

cargo run --example animated_ui

The text should be visible and the memory usage should be stable.

animate `UiTransform::scale` instead of font size so it doesn't generate lots of font atlases.
@ickshonpe ickshonpe added C-Bug An unexpected or incorrect behavior C-Examples An addition or correction to our examples A-UI Graphical user interfaces, styles, layouts, and widgets A-Animation Make things move and change over time D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jan 23, 2026
@ickshonpe ickshonpe added this to the 0.18.1 milestone Jan 23, 2026
graph: animation_graph,
node_index: animation_node_index,
} = AnimationInfo::create(&mut animation_graphs, &mut animation_clips);
} = AnimationInfo::create(animation_graphs.as_mut(), animation_clips.as_mut());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why I had to change this, coercion suddenly isn't working?

@ickshonpe ickshonpe changed the title Animate UiTransform::scale in animated_ui, not TextFont::font_size animated_ui: Animate UiTransform::scale, not TextFont::font_size Jan 23, 2026
Copy link
Contributor

@kfc35 kfc35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked out the example and it works properly for me now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Animation Make things move and change over time A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior C-Examples An addition or correction to our examples D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AnimatedUi example is broken

2 participants