01
Mochi YOUR SPRING
A little extra wiggle.
ζ 0.28INDEPENDENT TOOLResponsive motion
A little bounce. A lot of life.
Three mechanical friends. One identical nudge. Find the feeling between wobbly and wonderfully calm.
A little extra wiggle.
ζ 0.28Gets there without a bounce.*
ζ 1.00Slow, soft, and deliberate.
ζ 1.80BORROW A LITTLE FEELING
Spring keeps value and velocity together when a target changes. Add it to a camera, a floating label, or a creature’s antenna. Your game owns the frame loop.
import { Spring } from '@cranberry-forge/spring';
const recoil = new Spring({
frequency: 3, dampingRatio: 0.65,
});
// Add velocity when the action happens.
recoil.impulse(8);
// In your own frame loop, dt is seconds.
mesh.position.y = restY + recoil.step(dt);
ZERO DEPENDENCIES · ANALYTIC MOTION · MIT
FROM SHOWCASE TO YOUR PROJECT
Tune the motion with a real spring simulation, then apply that feeling to cameras, interfaces, or props.
Download the archive, then install locally.
npm install ./cranberry-forge-spring-0.1.0.tgz