useDeviceMotion ​
that work with device motion
typescript
import { useDeviceMotion } from '@siberiacancode/reactuse';
Usage ​
typescript
const { interval, rotationRate, acceleration, accelerationIncludingGravity } = useDeviceMotion();
Demo ​
Api ​
Parameters
Name | Type | Default | Note |
---|---|---|---|
delay? | number | 1000 | The delay in milliseconds |
callback? | (event: DeviceMotionEvent) => void | - | The callback function to be invoked |
enabled? | boolean | true | Whether to enable the hook |