Expand description
§cranpose-animation
cranpose-animation provides spring, tween, decay, and state-driven transition
APIs for Cranpose. The crate owns animation math and frame callbacks; UI widgets
use the same types as app code.
Depend directly on cranpose-animation for animation primitives or custom
widgets. UI applications also use the cranpose facade
for composition and host setup. The feature set is empty.
§Spring step
advance_spring computes one spring step from the current value, velocity,
target, damping ratio, stiffness, and elapsed seconds:
use cranpose_animation::{Spring, advance_spring};
let (position, velocity) = advance_spring(
0.0,
0.0,
100.0,
Spring::DampingRatioNoBouncy,
Spring::StiffnessMedium,
1.0 / 60.0,
);
assert!(position > 0.0);
assert!(velocity > 0.0);Inside a composable, animateFloatAsState follows each new target and returns
a reactive State<f32>. updateTransition coordinates several values from one
state. Animatable<T> supports imperative targets and release velocity. Types
with one to four float dimensions can implement SpringScalar and Lerp.
Re-exports§
pub use color::animateColorAsState;pub use decay_spec::ExponentialDecaySpec;pub use decay_spec::FloatDecayAnimationSpec;pub use decay_spec::IOS_DECELERATION_RATE_FAST;pub use decay_spec::IOS_DECELERATION_RATE_NORMAL;pub use geometry_animation::animateOffsetAsState;pub use geometry_animation::animateRectAsState;pub use geometry_animation::animateSizeAsState;pub use transition::Transition;pub use transition::updateTransition;pub use unit_animation::animateDpAsState;pub use animation::*;
Modules§
- animation
- Animation system for Cranpose
- color
- Color animation for Cranpose
- decay_
spec - Decay animation specification for fling animations.
- geometry_
animation - Animation over Cranpose’s 2D geometry types.
- prelude
- transition
- Finite, state-driven, multi-property animation.
- unit_
animation - Animation over Cranpose’s density/scale unit types.