RotateGesture
The gesture rotate() makes, with a rotation source in degrees added to where the follower was.
Utilização
Set a value from a rotation gesture.
Este tipo é usado por 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} />
);
}Declaração do tipo
export interface RotateGesture extends Gesture {
/** Its rotation in degrees, added to where the follower was. */
readonly rotation: GestureSource;
}Membros 8
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
rotationsó de leitura | GestureSource | Sim | Its rotation in degrees, added to where the follower was. |
typesó de leitura | GestureType | Sim | — |
kindsó de leitura | GestureKind | Sim | — |
configsó de leitura | Readonly<Record<string, unknown>> | Sim | — |
callbackssó de leitura | Readonly<Callbacks<never, never>> | Sim | — |
releasingsó de leitura | Animation<unknown> | Não | How the motion values following it let go when it ends. |
release | (animation: Animation<unknown>) => RotateGesture | Sim | 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. |
activesó de leitura | GestureSource | Sim | 1 while it is active, 0 otherwise. |
release — assinaturas de método
Assinaturas
(animation: Animation<unknown>): RotateGestureParâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
animation | Animation<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.