A TypeScript and JavaScript library to get the position and velocity of a damped spring as a continuous function of time.

Gist

import { Spring } from "humpf";
const spring = Spring();
spring(0); // { pos: 0, vel: 0 }
spring(200); // { pos: 59, vel: 27 }
spring(400); // { pos: 90, vel: 7 }
spring(600); // { pos: 98, vel: 1 }
spring(800); // { pos: 100, vel: 0 }