A common PixelUI animation changes an int32_t from A to B over a duration. Easing uses fixed-point calculations, and animation objects live directly in the fixed-capacity AnimationManager.
![]()
In this demo, motion parameters are ordinary int32_t members read by the App during each draw.
The older AnimationManager diagram still captures the basic idea: animate() creates entries updated by one manager. The current implementation uses fixed-capacity inline CallbackAnimation objects, so do not interpret the long slots in that diagram as a heap-allocated pointer container.
One value
1 | int32_t panelX = -64; |
animate() returns bool. When all PIXELUI_MAX_ANIMATION_COUNT slots are occupied, it returns false, and the original variable does not automatically reach its final value.
Two values
1 | if (!ui.animate(x, y, 32, 20, 500, EasingType::EASE_IN_OUT_QUAD)) { |
This overload requires two free slots at once. Otherwise it fails without starting only X or only Y.
Custom callback
1 | ui.animateCallback( |
The callback is stored in etl::inplace_function<..., CALLBACK_STORAGE_SIZE>. An oversized capture fails at compile time. When capturing this or a reference, the target must live until the Animation ends or is cleared. See Resource limits for capacity configuration.
Easing
LINEAR, EASE_IN_QUAD, EASE_OUT_QUAD, EASE_IN_OUT_QUAD, EASE_IN_CUBIC, EASE_OUT_CUBIC, EASE_IN_OUT_CUBIC, and EASE_OUT_BOUNCE can be passed directly to animate().
Refresh and markDirty()
AnimationManager updates values and marks the UI dirty when deadlines are reached, so continuous drawing is not required. Call ui.markDirty() after ordinary application state changes. See Event-driven rendering for scheduling rules.
Protection and cleanup
PROTECTION::PROTECTEDonly preventsclearUnprotectedAnimations()from removing an Animation.clearAllAnimations()removes every Animation, including protected ones.- ViewManager clears Animations during App transitions and exit. Protection does not allow an Animation to outlive a destroyed App.
clearAnimationProtection()only removes protection flags; it does not delete Animations immediately.
Animations hold references to their target variables. Be especially careful when a target is not an App member.
