Skip to main content

spring

Function spring 

Source
pub fn spring(frame: u32, fps: f64, config: SpringConfig) -> f64
Expand description

Compute the spring value at frame (0-indexed).

§Arguments

  • frame — current frame number
  • fps — frames per second of the composition
  • config — spring physics configuration

Returns a value interpolated between 0.0 (start) and 1.0 (settled). Use crate::interpolate::interpolate to map this to any output range.

§Notes

Uses the same spring model as Remotion’s springCalculation() from spring-utils.ts. Valid inputs retain the original integer-frame behavior.

§Panics

Panics for invalid parameters or a requested frame beyond 100,000. Use spring_with_options to handle errors explicitly.