Skip to main content

Module spring

Module spring 

Source
Expand description

spring() — Rust port of Remotion’s spring animation.

Computes a physically-based spring animation value at a given frame. Matches Remotion’s spring-utils.ts using constant-time frame evaluation and bounded, thread-local settling-duration caches.

§Example

use rust_motion_animation::spring::{spring, SpringConfig};

let config = SpringConfig::default(); // damping=10, mass=1, stiffness=100
let value = spring(15, 30.0, config);
println!("frame 15 spring value: {value:.4}");

Structs§

SpringConfig
Configuration for the spring physics model.
SpringOptions
Playback controls for spring_with_options.

Enums§

SpringError
Invalid input or a spring that cannot be evaluated within the work limit.

Functions§

measure_spring
Measure natural settling time using Remotion 4.0.495’s 20-frame rest window.
spring
Compute the spring value at frame (0-indexed).
spring_with_options
Evaluate a spring with fractional/negative frames, range, delay and reversal.