A debug line from a spring's anchor to its bob: one straight segment that stretches,
overshoots and settles with the simulation. A game draws hair or hems by placing its
own sprites with Spring.place, and keeps this around while tuning stiffness and
damping. Call sync after stepping the spring; the line never steps anything itself.
Example
import { Spring } from'@datamoc/mwg/physics'; import { SpringSprite } from'@datamoc/mwg/two-d/render';
constspring = newSpring({ stiffness:120, damping:8 }); constline = newSpringSprite({ spring }); spring.setAnchor(10, 0); spring.update(1 / 60); line.sync(); // the segment now leans toward the anchor
A debug line from a spring's anchor to its bob: one straight segment that stretches, overshoots and settles with the simulation. A game draws hair or hems by placing its own sprites with
Spring.place, and keeps this around while tuning stiffness and damping. Callsyncafter stepping the spring; the line never steps anything itself.Example