Lab/06
Bézier Easing Editor
Reshape the curve by dragging the two handles. The ball previews the exact motion, and the cubic-bezier is ready to copy.
- Tool
- Motion
Drag the red handles
lab/bezier-easingInstallation
Add Bezier Editor to your project with the shadcn CLI. The files land in components/lab, ready to edit.
$ pnpm dlx shadcn@latest add @soultel/lab-bezier-easingOr by URL: https://asafefe.dev/r/lab-bezier-easing.json
Brings along
- lucide-react
- utils
Usage
import { BezierEditor } from "@/components/lab/bezier-easing"
export function Example() {
return <BezierEditor onChange={(value) => console.log(value)} />
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
| defaultValue | [number, number, number, number] | [0.34, 1.56, 0.64, 1] | Starting curve. |
| onChange | (value: string, points) => void | - | Called with the cubic-bezier() string on every change. |
| presets | BezierPreset[] | BEZIER_PRESETS | Quick picks. [] hides them. |
| duration | number | 1400 | Preview run length in ms. |
