Documentation / Momentum / MomentumLayer
MomentumLayer<Animating>
type MomentumLayer<Animating> = Layer<Animating> & object;
Defined in: ../../extensions/src/momentum.ts:100
Momentum Layer
Type declaration
changePixelsPerUnit()
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()
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()
getSpeed: () => number;
Returns
number
speed in units/second
mount
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()
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