motion
Create an instance-local motion value during component initialization.
In a native module's spec, motion<T>() declares one the platform writes
(docs/native-modules.md#motion-values).
Usage
Drag and release
import { Box, decay, motion, pan } from 'kuito';
export function Drawer() {
const drag = pan({ axis: 'y' }).release(decay({ clamp: [0, 400] }));
const y = motion(0).follows(drag.y);
return <Box gestures={[drag]} translateY={y} height={120} backgroundColor="#0f172a" />;
}Signatures
Overload 1
<T>(): Motion<T | null>Type parameters
| Name | Constraint | Default |
|---|---|---|
T | — | — |
Parameters
No parameters.
Returns
Motion<T>
Overload 2
<T>(initial: T, name?: string): Motion<T>Type parameters
| Name | Constraint | Default |
|---|---|---|
T | — | — |
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
initial | T | Yes | — |
name | string | No | — |
Returns
Motion<T>
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.