Interaction
Velocity Card
A wrapper that reacts to cursor velocity with rotation and stretch, making interactions feel physical.
- gsap
Preview
✦
Velocity aware
Reacts to how fast you move, not just where you are.
Move your cursor across the card to feel the velocity.
Attributes
Installation
pnpm dlx shadcn@latest add https://motion-kit-astro.vercel.app/r/velocity-card.json Usage
---
import "@/components/motion-kit/velocity-card-element.ts";
---
<motion-velocity-card rotation-factor="3" stretch-factor="0.04" decay="250">
<div class="card">Move your cursor fast</div>
</motion-velocity-card> API Reference
| Attribute | Type | Default |
|---|---|---|
duration quickTo tween duration in seconds for velocity tracking. | number | 0.25 |
rotation-factor Degrees of rotation per px/ms of horizontal cursor velocity. | number | 3 |
stretch-factor scaleX multiplier per px/ms of cursor speed. | number | 0.04 |
decay Snap-back transition duration in milliseconds. | number | 250 |