Skip to content

Documentation / Momentum / MomentumLayer

MomentumLayer<Animating>

ts
type MomentumLayer<Animating> = Layer<Animating> & object;

Defined in: ../../extensions/src/momentum.ts:100

Momentum Layer

Type declaration

changePixelsPerUnit()

ts
changePixelsPerUnit: (newPixelsPerUnit) => void;

Changes the pixels-per-unit used to calculate the duration of future glides

Note that it does not impact any glides that have already been started

Parameters

newPixelsPerUnit

number

Returns

void

clearRecordedStates()

ts
clearRecordedStates: () => void;

useful for clearing the recorded states to prevent weird interpolation based on manually setting the state rather than setting it based on a user gesture

Should probably call right before a gesture is started; e.g. onpointerdown

Returns

void

getSpeed()

ts
getSpeed: () => number;

Returns

number

speed in units/second

mount

ts
mount: Mount<Animating>;

Mounts anim to layer, clearing previous states if they exist and unmounting any animation previously mounted to this layer.

Param

Returns

an unmount function

startGlide()

ts
startGlide: () => boolean;

Should probably call at the end of a user gesture

Returns

boolean

whether a glide was triggered

Type Parameters

Animating

Animating extends UnknownAnimatable