Usage

Apply a pinch's change in scale.

This type is used by 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>;

Type declaration

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

Members 8

NameTypeRequiredDescription
scalereadonlyGestureSourceYesIts scale, multiplying what the follower was when it activated.
typereadonlyGestureTypeYes—
kindreadonlyGestureKindYes—
configreadonlyReadonly<Record<string, unknown>>Yes—
callbacksreadonlyReadonly<Callbacks<never, never>>Yes—
releasingreadonlyAnimation<unknown>NoHow the motion values following it let go when it ends.
release(animation: Animation<unknown>) => PinchGestureYesThe 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.
activereadonlyGestureSourceYes1 while it is active, 0 otherwise.
release — method signatures

Signatures

ts
(animation: Animation<unknown>): PinchGesture

Parameters

NameTypeRequiredDescription
animationAnimation<unknown>Yes—

Returns

PinchGesture

Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.