RotationEvent
How far a two-finger rotation has turned and around which point, as it starts and ends.
Utilização
Set a value from a rotation gesture.
// 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 RotationEvent extends GestureEvent {
/** Degrees, as the rotate prop takes them. */
rotation: number;
anchorX: number;
anchorY: number;
velocity: number;
}Membros 7
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
rotation | number | Sim | Degrees, as the rotate prop takes them. |
anchorX | number | Sim | — |
anchorY | number | Sim | — |
velocity | number | Sim | — |
state | number | Sim | — |
numberOfPointers | number | Sim | — |
pointerType | number | Sim | — |
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.