UNPKG

ts-browser-helpers

Version:

A collection of utility classes, functions and decorators for javascript/typescript projects, for use in the browser.

23 lines 1.07 kB
/** * The Damper class is a generic second-order critically damped system that does * one linear step of the desired length of time. The only parameter is * DECAY_MILLISECONDS. This common parameter makes all states converge at the * same rate regardless of scale. xNormalization is a number to provide the * rough scale of x, such that NIL_SPEED clamping also happens at roughly the * same convergence for all states. * * Taken from Google model-viewer. * * https://github.com/google/model-viewer/blob/ec527bc1d0e1bcb4421fa192a7e62bbc5764db91/packages/model-viewer/src/three-components/Damper.ts#L1 */ export declare class Damper { static readonly SETTLING_TIME = 10000; static readonly MIN_DECAY_MILLISECONDS = 0.001; static readonly DECAY_MILLISECONDS = 50; private velocity; private naturalFrequency; constructor(decayMilliseconds?: number); setDecayTime(decayMilliseconds: number): void; update(v: number, vGoal: number, timeStepMilliseconds: number, xNormalization: number): number; } //# sourceMappingURL=damper.d.ts.map