Class Spring
Constructors
constructor
Parameters
- w: number
- h: number
- opts: SpringOpts = {}
Returns Spring
Methods
current
Returns Tex
dispose
Returns void
energy
Mean kinetic energy (velocity²) — the settle metric.
Returns number
seed
Snap position + target to
srcTex, zero the velocity.srcTexmay alias one of our own position textures, so skip a copy that would read and write the same texture (illegal GL feedback).Parameters
- srcTex: WebGLTexture
Returns void
setTarget
Retarget (keeps current position + velocity).
Parameters
- srcTex: WebGLTexture
Returns void
step
Parameters
- dt: number
Returns void
Per-pixel damped oscillator field on the GPU. Position and velocity live in float textures and never leave the card;
current()exposes position as aTexso it can back a reactive Canvas value frame by frame.