Skip to main content

Module animation

Module animation 

Source
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_state and its siblings return. value is the target, because the value in between is the Renderer’s and is never sent back.
AnimationEventSubscription
A registration for animation events, ended by dropping it.
AnimationMoment
One moment the Renderer reported about an animation it is playing.
AnimationSpec
How long a change takes and along which curve.
GraphicsLayer
What Compose’s graphicsLayer takes, 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.
ReducedMotionSubscription
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 target changes.
animate_float_as_state
An opacity the Renderer animates to whenever target changes. Compose’s animateFloatAsState, for the one float a node draws without laying out again.
animate_offset_as_state
A translation in dp the Renderer animates to whenever target changes. 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 called animation_id. It goes out with the next batch.
on_animation_event
Calls handler with 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 animation to its end. It goes out with the next batch.
subscribe_reduced_motion
Registers notify to be called each time the setting changes. A runtime’s use_reduced_motion holds 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, to to, once, along spec, in slot 0, with no events. What a CSS transition and an animate_*_as_state both are.