Verwendung

Recognize a directional swipe.

Dieser Typ wird verwendet von fling

tsx
// Recognize a directional swipe.
import { Box, fling, signal } from 'kuito';

const page = signal(0);

const swipe = fling({
  direction: ['left', 'right'],
  onEnd: (event, success) => {
    if (success) page.value += 1;
  },
});

<Box gestures={[swipe]} />;

Typdeklaration

ts
export interface Gesture {
  readonly __kuitoGesture: 'gesture';
  readonly type: GestureType;
  readonly kind: GestureKind;
  readonly config: Readonly<Record<string, unknown>>;
  readonly callbacks: Readonly<Callbacks<never, never>>;
  /** How the motion values following it let go when it ends. */
  readonly releasing?: Animation<unknown>;
  /**
   * The same gesture, letting go with `animation`: each follower runs it with
   * the gesture's velocity, toward its own home (its first value) unless the
   * animation names a target.
   */
  release(animation: Animation<unknown>): this;
  /** 1 while it is active, 0 otherwise. */
  readonly active: GestureSource;
}

Mitglieder 7

NameTypErforderlichBeschreibung
typeschreibgeschütztGestureTypeJa—
kindschreibgeschütztGestureKindJa—
configschreibgeschütztReadonly<Record<string, unknown>>Ja—
callbacksschreibgeschütztReadonly<Callbacks<never, never>>Ja—
releasingschreibgeschütztAnimation<unknown>NeinHow the motion values following it let go when it ends.
release(animation: Animation<unknown>) => GestureJaThe same gesture, letting go with animation: each follower runs it with the gesture's velocity, toward its own home (its first value) unless the animation names a target.
activeschreibgeschütztGestureSourceJa1 while it is active, 0 otherwise.
release — Methodensignaturen

Signaturen

ts
(animation: Animation<unknown>): Gesture

Parameter

NameTypErforderlichBeschreibung
animationAnimation<unknown>Ja—

Rückgabe

Gesture

Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.