DecayConfig
Tunes how a decay() animation coasts to a stop from a velocity, and the range it stays within or rubber-bands past.
Utilisation
Drag and release
Ce type est utilisé par 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" />;
}Déclaration du type
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;
}Membres 8
| Nom | Type | Requis | Description |
|---|---|---|---|
velocity | number | Non | Units per second; a gesture's release gives its own. |
deceleration | number | Non | — |
velocityFactor | number | Non | — |
clamp | readonly [number, number] | Non | — |
rubberBand | boolean | Non | Overshoot the clamp and spring back, instead of stopping at it. |
rubberBandFactor | number | Non | — |
delay | number | Non | — |
onEnd | AnimationCallback | Non | — |
onEnd — signatures de méthode
Signatures
(finished: boolean): voidParamètres
| Nom | Type | Requis | Description |
|---|---|---|---|
finished | boolean | Oui | — |
Retourne
void
Généré depuis les déclarations TypeScript publiques : signatures, props et valeurs par défaut viennent de la source vérifiée, les descriptions de sa JSDoc. Aucune valeur par défaut n'est inventée.