Class Spring

    Per-pixel damped oscillator field on the GPU. Position and velocity live in float textures and never leave the card; current() exposes position as a Tex so it can back a reactive Canvas value frame by frame.

    Index

    Constructors

    Methods

    • Snap position + target to srcTex, zero the velocity. srcTex may 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

    • Retarget (keeps current position + velocity).

      Parameters

      • srcTex: WebGLTexture

      Returns void

    Properties

    damping: number
    h: number
    stiffness: number
    w: number