Utilização

Set a value from a rotation gesture.

Este tipo é usado por rotate

tsx
// Set a value from a rotation gesture.
import { Box, motion, rotate, spring, type RotationEvent } from 'kuito';

function Dial(props: { onSet: (degrees: number) => void }) {
  const turn = rotate().release(spring());
  const angle = motion(0).follows(turn.rotation);

  const settle = (event: RotationEvent) => props.onSet(Math.round(event.rotation / 15) * 15);

  return (
    <Box rotate={angle} gestures={[rotate({ onEnd: settle }), turn]} width={120} height={120} />
  );
}

Declaração do tipo

ts
export interface RotateGesture extends Gesture {
  /** Its rotation in degrees, added to where the follower was. */
  readonly rotation: GestureSource;
}

Membros 8

NomeTipoObrigatórioDescrição
rotationsó de leituraGestureSourceSimIts rotation in degrees, added to where the follower was.
typesó de leituraGestureTypeSim—
kindsó de leituraGestureKindSim—
configsó de leituraReadonly<Record<string, unknown>>Sim—
callbackssó de leituraReadonly<Callbacks<never, never>>Sim—
releasingsó de leituraAnimation<unknown>NãoHow the motion values following it let go when it ends.
release(animation: Animation<unknown>) => RotateGestureSimThe 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.
activesó de leituraGestureSourceSim1 while it is active, 0 otherwise.
release — assinaturas de método

Assinaturas

ts
(animation: Animation<unknown>): RotateGesture

Parâmetros

NomeTipoObrigatórioDescrição
animationAnimation<unknown>Sim—

Devolve

RotateGesture

Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.