Spring
import { Spring } from 'pixi-silk';
Damped harmonic spring with unit mass, integrated in fixed 1/240 s sub-steps. stiffness and
damping follow the usual UI spring convention. The defaults are 170 and 26.
Constructors#
Constructor#
new Spring(
value?: number,
stiffness?: number,
damping?: number
): Spring;
Starts at rest at value, with its target there too.
Parameters#
| Parameter | Type | Default value |
|---|---|---|
value | number | 0 |
stiffness | number | 170 |
damping | number | 26 |
Returns#
Spring
Properties#
Accessors#
settled#
Get Signature#
get settled(): boolean;
True once the spring is within 1e-4 of its target and its speed is below 1e-4.
Returns
boolean
Methods#
step()#
step(dtSeconds: number): number;
Advances the spring by dtSeconds, capped at 0.1 s so a stalled tab does not jump, and returns the new value.
Parameters#
| Parameter | Type |
|---|---|
dtSeconds | number |
Returns#
number