Skip to main content

Function: spring()

spring(options): RateFunction

Defined in: src/rate-functions/spring.ts:127

Create a damped spring rate function.

The returned function maps t in [0, 1] to a value that starts at 0 and settles at 1. With an underdamped spring the value overshoots 1 first.

Parameters​

options​

SpringOptions = {}

Returns​

RateFunction

Example​

const bouncy = spring({ bounce: 0.6 });
bouncy(0); // 0
bouncy(1); // 1