Expand description
ReactUiAnimationsPlugin — a Reanimated-style animation engine for
bevy-react.
The model mirrors React Native’s Reanimated: a React app declares shared
values (one animatable f32 with a stable id) and assigns drivers
(withTiming, withSpring, withRepeat, withSequence) to them; an
Animated.node binds style properties to those values. All per-frame work —
advancing drivers, interpolation, writing components — happens here, on the
Bevy side, never crossing back to JS. The one exception is completion:
a driver started with a correlation token reports its settlement (one
AnimationSettled message, forwarded by the integrator) so a JS callback
can fire — once per animation, not per frame.
This crate is deliberately decoupled from the main bevy-react crate (which
depends on it): it owns the animation wire types (protocol) and the
orchestration systems, and receives commands through an AnimationInbox
channel the integrator hands it.
Re-exports§
pub use protocol::AnimatableProperty;pub use protocol::AnimatedBindings;pub use protocol::AnimationCommand;pub use protocol::Binding;pub use protocol::Driver;pub use protocol::Easing;pub use protocol::ValueKind;
Modules§
- protocol
- Wire types for the animation bridge — the Reanimated-style surface a React app declares once and the Bevy side drives every frame.
Structs§
- Animated
Node - Component placed (by the main reconciler) on any
Animated.node. Carries the property→Bindingmap. RequiresUiTransformso the apply system can always drive it. - Animation
Inbox - The receiving end of the
op_animatechannel, drained each frame. - Animation
Settled - A token-tagged driver settled:
finishedistruewhen it ran to its natural end,falsewhen aset/cancel/newanimateinterrupted it. Written by the drain/tick systems for everyAnimationCommand::Animatethat carried atoken; the integrator (bevy-react) forwards these to the JS completion callbacks. The one thing this crate sends back toward JS. - React
UiAnimations Plugin - Adds the animation orchestration: the
SharedValuestable, the per-frame driver/apply systems, and theAnimationInboxthat feeds commands in. - Shared
Values - The live table of shared values, keyed by
SharedId. Each entry holds the current reading plus an optional active driver. Settlements of token-tagged drivers accumulate insettleduntil the owning system flushes them to theAnimationSettledmessage stream.
Enums§
- Animation
Set - Ordering handles for the three animation systems. The integrator orders
AnimationSet::Applyrelative to its own reconciler systems. - Runner
- The stateful evaluation of a
Driverover time. Built from a driver + the value’s live reading; advanced byRunner::step.
Traits§
- Lerp
- Linear interpolation between two values of the same kind,
tin0.0..=1.0. The one primitive every interpolated quantity shares — implemented here for the scalar and color bindings, and bybevy-react’s transition engine for its own channel types (hence public).
Functions§
- build_
runner - Build a
Runnerfordriverstarting from the valuefrom. Public for thebevy-reacttransition engine (seeRunner). - build_
ui_ transform - Build a
UiTransformfrom the six scalar transform channels (eachNonestays at identity: no translation, unit scale, no rotation).scaleis uniform;scale_x/scale_yoverride a single axis. Shared by the animated node apply andbevy-react’s static/transition transform path so the channel semantics stay identical across both.