StealThis .dev
Muster Medium

Gesture Animations

Collection of gesture-based animations including hover scale, tap shrink, drag with constraints, and focus glow. Each gesture type demonstrates a different interaction pattern.

In Lab öffnen
css javascript vue svelte
Targets: TS JS HTML React Vue Svelte

Code

Gesture Animations

A showcase of four distinct gesture-driven animations, each responding to a different user interaction.

Gestures included

  1. Hover Scale — element smoothly scales up on mouseenter and back on mouseleave
  2. Tap Shrink — element shrinks on pointerdown and bounces back on pointerup
  3. Drag with Constraints — element follows the pointer within a bounding box, snaps back on release
  4. Focus Glow — input gains an animated glow ring on focus, fades on blur

How it works

  • All animations use requestAnimationFrame with lerp for smooth interpolation
  • No CSS transitions needed — JS drives every frame for precise, interruptible control
  • Drag constraints are enforced by clamping coordinates to a parent container’s bounds

Use cases

  • Interactive buttons and cards
  • Micro-interactions for form elements
  • Playful UI elements in portfolios / landing pages