Utilisation

Apply a pinch's change in scale.

Ce type est utilisé par pinch

tsx
// Apply a pinch's change in scale.
import { Text, pinch, signal, type PinchChangeEvent } from 'kuito';

const fontSize = signal(17);

// Text size follows the pinch, between 12 and 34 points.
const resize = (event: PinchChangeEvent) => {
  fontSize.value = Math.min(34, Math.max(12, fontSize.value * event.scaleChange));
};

<Text fontSize={fontSize.value} gestures={[pinch({ onChange: resize })]}>
  Pinch to resize
</Text>;

Déclaration du type

ts
export interface PinchGesture extends Gesture {
  /** Its scale, multiplying what the follower was when it activated. */
  readonly scale: GestureSource;
}

Membres 8

NomTypeRequisDescription
scalelecture seuleGestureSourceOuiIts scale, multiplying what the follower was when it activated.
typelecture seuleGestureTypeOui—
kindlecture seuleGestureKindOui—
configlecture seuleReadonly<Record<string, unknown>>Oui—
callbackslecture seuleReadonly<Callbacks<never, never>>Oui—
releasinglecture seuleAnimation<unknown>NonHow the motion values following it let go when it ends.
release(animation: Animation<unknown>) => PinchGestureOuiThe 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.
activelecture seuleGestureSourceOui1 while it is active, 0 otherwise.
release — signatures de méthode

Signatures

ts
(animation: Animation<unknown>): PinchGesture

Paramètres

NomTypeRequisDescription
animationAnimation<unknown>Oui—

Retourne

PinchGesture

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.