Motion Blocks

Interaction

Velocity Card

A wrapper that reacts to cursor velocity with rotation and stretch, making interactions feel physical.

  • gsap Preview of https://gsap.comGSAPAnimate anything. Silky-smooth performance.

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 motion-blocks add velocity-card

Usage

---import "@/components/motion-blocks/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