RotateGesture
The gesture rotate() makes, with a rotation source in degrees added to where the follower was.
Usage
Set a value from a rotation gesture.
This type is used by 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} />
);
}Type declaration
export interface RotateGesture extends Gesture {
/** Its rotation in degrees, added to where the follower was. */
readonly rotation: GestureSource;
}Members 8
| Name | Type | Required | Description |
|---|---|---|---|
rotationreadonly | GestureSource | Yes | Its rotation in degrees, added to where the follower was. |
typereadonly | GestureType | Yes | — |
kindreadonly | GestureKind | Yes | — |
configreadonly | Readonly<Record<string, unknown>> | Yes | — |
callbacksreadonly | Readonly<Callbacks<never, never>> | Yes | — |
releasingreadonly | Animation<unknown> | No | How the motion values following it let go when it ends. |
release | (animation: Animation<unknown>) => RotateGesture | Yes | 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. |
activereadonly | GestureSource | Yes | 1 while it is active, 0 otherwise. |
release — method signatures
Signatures
(animation: Animation<unknown>): RotateGestureParameters
| Name | Type | Required | Description |
|---|---|---|---|
animation | Animation<unknown> | Yes | — |
Returns
RotateGesture
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.