Motion Blocks

Text

Text Repel

Splits text into words or characters that repel from the pointer. Framework-agnostic Custom Element.

  • lit Preview of https://lit.devLitSimple. Fast. Web Components.
  • gsap Preview of https://gsap.comGSAPAnimate anything. Silky-smooth performance.

Preview

Words or characters repel from the pointer with a distance-based falloff.
Attributes

Installation

pnpm dlx motion-blocks add text-repel

Usage

---import "@/components/motion-blocks/text-repel-element.ts";--- <motion-text-repel text="Hover over me" mode="words"></motion-text-repel>

API Reference

Attribute Type Default
text The text content to display and animate. string ""
mode Whether to split by words or characters. "words" | "chars" "words"
strength Maximum distance in pixels to repel text elements. number 18
radius Radius around the cursor where repel effect is active. number 160
falloff-power Power curve for falloff (higher = sharper falloff). number 1.5
duration Animation duration in seconds. number 0.45
ease easing function for the animation. string "power3.out"
hover-target CSS selector for an external hover target. Defaults to this element. string ""