Expand description
Animations the Renderer plays on its own frame clock, and the platform’s reduced motion setting.
An animation is described once and played to its end by the Renderer. Nothing crosses the boundary while it plays unless it asked for events, and the value it shows at any moment is never sent back: animation state is the Renderer’s.
start_animation and control_animation queue the record for the next batch, the
way a message or a notification is queued, so they can be called from an event handler,
a component or a worker thread alike. A runtime that writes the tree itself can write
Mutation::StartAnimation into its batch directly; the result is the same record.
Structs§
- Animated
- A value the Renderer animates to whenever it changes: what
animate_float_as_stateand its siblings return.valueis the target, because the value in between is the Renderer’s and is never sent back. - Animation
Event Subscription - A registration for animation events, ended by dropping it.
- Animation
Moment - One moment the Renderer reported about an animation it is playing.
- Animation
Spec - How long a change takes and along which curve.
- Graphics
Layer - What Compose’s
graphicsLayertakes, drawn without moving the layout: a rotation in degrees, a scale, a translation in dp, the origin they turn about as a fraction of the node’s size, and an opacity for the whole group. - Reduced
Motion Subscription - A registration for changes of the reduced motion setting, ended by dropping it.
Functions§
- animate_
color_ as_ state - A background the Renderer animates to whenever
targetchanges. - animate_
float_ as_ state - An opacity the Renderer animates to whenever
targetchanges. Compose’sanimateFloatAsState, for the one float a node draws without laying out again. - animate_
offset_ as_ state - A translation in dp the Renderer animates to whenever
targetchanges. Drawn as a transform, so the layout does not move. - control_
animation - Pauses, resumes or cancels the animation playing under
(node_id, property, slot), if it is still the one calledanimation_id. It goes out with the next batch. - on_
animation_ event - Calls
handlerwith every animation event the Renderer reports. Only the kinds an animation asked for are ever reported. - reduced_
motion - Whether the platform asks for reduced motion, as the Renderer last reported it.
- start_
animation - Asks the Renderer to play
animationto its end. It goes out with the next batch. - subscribe_
reduced_ motion - Registers
notifyto be called each time the setting changes. A runtime’suse_reduced_motionholds one for as long as the reader it wakes is alive. - transition
- A transition to
to: from whatever the node shows the frame it starts, toto, once, alongspec, in slot 0, with no events. What a CSS transition and ananimate_*_as_stateboth are.