KineticScroll
Defined in: ui/collection/kinetic-scroll.ts:20
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new KineticScroll(
opts?):KineticScroll
Defined in: ui/collection/kinetic-scroll.ts:27
Parameters
Section titled “Parameters”KineticScrollOptions = {}
Returns
Section titled “Returns”KineticScroll
Methods
Section titled “Methods”beginDrag()
Section titled “beginDrag()”beginDrag():
void
Defined in: ui/collection/kinetic-scroll.ts:34
A finger/pointer grabbed the content: cancel any coast, start sampling.
Returns
Section titled “Returns”void
endDrag()
Section titled “endDrag()”endDrag():
void
Defined in: ui/collection/kinetic-scroll.ts:49
Release: the sampled velocity carries over into coasting.
Returns
Section titled “Returns”void
getVelocity()
Section titled “getVelocity()”getVelocity():
Vec2
Defined in: ui/collection/kinetic-scroll.ts:75
Returns
Section titled “Returns”isCoasting()
Section titled “isCoasting()”isCoasting():
boolean
Defined in: ui/collection/kinetic-scroll.ts:69
Coasting = released with speed above the rest floor.
Returns
Section titled “Returns”boolean
isDragging()
Section titled “isDragging()”isDragging():
boolean
Defined in: ui/collection/kinetic-scroll.ts:64
Returns
Section titled “Returns”boolean
killAxis()
Section titled “killAxis()”killAxis(
axis):void
Defined in: ui/collection/kinetic-scroll.ts:60
Kill one axis of the coast (that axis hit its clamp edge).
Parameters
Section titled “Parameters”"x" | "y"
Returns
Section titled “Returns”void
sample()
Section titled “sample()”sample(
delta,dt):void
Defined in: ui/collection/kinetic-scroll.ts:40
Feed one frame’s offset delta (px) while the drag is held.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
stop()
Section titled “stop()”stop():
void
Defined in: ui/collection/kinetic-scroll.ts:54
Hard stop (new grab, wheel input, or hitting a clamp edge).
Returns
Section titled “Returns”void
tick()
Section titled “tick()”tick(
dt):Vec2
Defined in: ui/collection/kinetic-scroll.ts:83
Advance one coast frame: returns the offset delta to apply and decays the velocity. Zero vector when not coasting.
Parameters
Section titled “Parameters”number