Usage

Drag and release

This type is used by decay

tsx
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

ts
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

NameTypeRequiredDescription
velocitynumberNoUnits per second; a gesture's release gives its own.
decelerationnumberNo—
velocityFactornumberNo—
clampreadonly [number, number]No—
rubberBandbooleanNoOvershoot the clamp and spring back, instead of stopping at it.
rubberBandFactornumberNo—
delaynumberNo—
onEndAnimationCallbackNo—
onEnd — method signatures

Signatures

ts
(finished: boolean): void

Parameters

NameTypeRequiredDescription
finishedbooleanYes—

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.