Skip to main content
Animation utilities for creating smooth transitions and physics-based motion.

interpolate()

Maps an input value within a range to an output value.
number
required
The value to interpolate
number[]
required
Array of input values (must be strictly monotonically increasing, at least 2 elements)
number[]
required
Array of output values (must match length of inputRange)
InterpolateOptions
Configuration options
number
The interpolated output value

Example

spring()

Calculates the value of a spring physics simulation at a specific frame.
SpringOptions
required
Spring configuration
number
The calculated spring value at the given frame

Example

calculateSpringDuration()

Calculates the number of frames required for a spring to settle.
Omit<SpringOptions, 'frame'>
required
Spring configuration (same as spring() but without frame)
number
default:"0.001"
Distance from target to consider settled
number
Estimated duration in frames

Example

DEFAULT_SPRING_CONFIG

Default spring configuration values.