DecayConfig
Tunes how a decay() animation coasts to a stop from a velocity, and the range it stays within or rubber-bands past.
Usage
Drag and release
This type is used by decay
import { Box, decay, motion, pan } from 'kuito';
export function Drawer() {
const drag = pan({ axis: 'y' }).release(decay({ clamp: [0, 400] }));
const y = motion(0).follows(drag.y);
return <Box gestures={[drag]} translateY={y} height={120} backgroundColor="#0f172a" />;
}Type declaration
export interface DecayConfig {
/** Units per second; a gesture's release gives its own. */
velocity?: number;
deceleration?: number;
velocityFactor?: number;
clamp?: readonly [number, number];
/** Overshoot the clamp and spring back, instead of stopping at it. */
rubberBand?: boolean;
rubberBandFactor?: number;
delay?: number;
onEnd?: AnimationCallback;
}Members 8
| Name | Type | Required | Description |
|---|---|---|---|
velocity | number | No | Units per second; a gesture's release gives its own. |
deceleration | number | No | — |
velocityFactor | number | No | — |
clamp | readonly [number, number] | No | — |
rubberBand | boolean | No | Overshoot the clamp and spring back, instead of stopping at it. |
rubberBandFactor | number | No | — |
delay | number | No | — |
onEnd | AnimationCallback | No | — |
onEnd — method signatures
Signatures
(finished: boolean): voidParameters
| Name | Type | Required | Description |
|---|---|---|---|
finished | boolean | Yes | — |
Returns
void
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.