RotateGesture
The gesture rotate() makes, with a rotation source in degrees added to where the follower was.
Verwendung
Set a value from a rotation gesture.
Dieser Typ wird verwendet von rotate
// 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} />
);
}Typdeklaration
export interface RotateGesture extends Gesture {
/** Its rotation in degrees, added to where the follower was. */
readonly rotation: GestureSource;
}Mitglieder 8
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
rotationschreibgeschützt | GestureSource | Ja | Its rotation in degrees, added to where the follower was. |
typeschreibgeschützt | GestureType | Ja | — |
kindschreibgeschützt | GestureKind | Ja | — |
configschreibgeschützt | Readonly<Record<string, unknown>> | Ja | — |
callbacksschreibgeschützt | Readonly<Callbacks<never, never>> | Ja | — |
releasingschreibgeschützt | Animation<unknown> | Nein | How the motion values following it let go when it ends. |
release | (animation: Animation<unknown>) => RotateGesture | Ja | 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. |
activeschreibgeschützt | GestureSource | Ja | 1 while it is active, 0 otherwise. |
release — Methodensignaturen
Signaturen
(animation: Animation<unknown>): RotateGestureParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
animation | Animation<unknown> | Ja | — |
Rückgabe
RotateGesture
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.