Elastic Repel Headline

£5

A cursor-repulsion display headline whose letters flee the pointer, scaled by cursor speed, then spring back home with an elastic overshoot, motion blur, and a scale dip.

advanced
2 more details
hover-effecttext-animation
Elastic Repel Headline - GSAP animation effect preview

This demo reads better at your own screen size than in the frame below:

About this effect

An interactive display headline that shoves each letter out of the cursor's path. Displacement is scaled by pointer speed, so a slow drag nudges the letters while a fast flick throws them far, each fleeing radially away from the pointer through a soft radius field.

Read the full effect overview

The same input drives three secondary channels at once: letters tilt as they are shoved, smear with a velocity-driven blur, and dip in scale and opacity at peak displacement, so the extreme state reads as force rather than mere position. As the cursor leaves, every letter overshoots its home and settles with an elastic spring. On touch devices, tapping the headline fires a one-shot scatter-and-settle so phone visitors still see the signature moment.

What's included

8 items
  • Speed-scaled repulsion: a fast cursor whip throws letters far, a slow pass only nudges them
  • Radial soft-field falloff so letters flee directly away from the pointer, strongest at the centre
  • Elastic overshoot settle (elastic.out) so letters spring past home and back, never a flat snap
  • Three secondary channels from one input: per-letter rotation, velocity-driven blur smear, and a scale/opacity dip
  • Built on GSAP core only, no plugins to load
  • Touch answer: tapping the headline triggers a one-shot scatter-and-settle from the tap point
  • Keyboard accessible: the headline is focusable and Enter or Space scatters the letters
  • Fully configurable radius, strength, speed influence, and blur via data attributes

Perfect for

5 use cases
  • Hero headlines on agency and portfolio sites that reward the visitor for moving the cursor
  • Landing page mastheads where a playful, physical interaction sets the tone
  • Product launch and campaign pages needing one memorable, clip-worthy moment
  • Event or conference titles that invite the visitor to whip the cursor through them
  • Editorial and brand display type where the copy itself becomes the interaction

How it works

2 sections

SplitText is not needed: the script wraps each letter of any [data-repel] headline in its own inline-block span, keeping words in a nowrap wrapper so a shoved letter never reflows. Each frame the script reads the pointer position and its speed, and for every letter within the radius computes a push whose strength combines distance with a speed boost, driving position and rotation per letter.

When a letter leaves the radius it springs home with overshoot. A second pass derives the secondary channels from each letter's actual motion, mapping real speed to a CSS blur variable and displacement to scale and opacity. Touch visitors get a tap-driven scatter, and reduced motion plain static text.

Difficulty Advanced
Includes HTML + JS + CSS source, documentation, AI setup prompt, lifetime updates

Paid effect

Purchase to unlock the code.

Buying Elastic Repel Headline opens the HTML, CSS and JavaScript source, the full documentation, an AI setup prompt for your editor, and every update we ship to it. Standard license: unlimited personal and commercial projects.

£5 Standard license, unlimited projects

Browse free effects

Documentation

Quick Start

1. Add to your HTML <head>:

Code snippet omitted: it ships with the download.

2. Add before the closing </body> tag:

Code snippet omitted: it ships with the download.

No GSAP plugins are required. GSAP core is the only dependency.

3. Add the headline anywhere in your <body>:

Code snippet omitted: it ships with the download.

Wrap each visual line in a .erh-line span. The script splits every line into per-letter spans automatically. If you omit .erh-line, the whole element is treated as a single line.

How It Behaves

  • Desktop (fine pointer): letters flee the cursor. Move slowly and they nudge; whip the cursor through them and they are thrown far, then spring back with an elastic overshoot. Fast motion also blurs and shrinks the letters slightly.
  • Touch (coarse pointer): there is no cursor, so tapping the headline fires a one-shot scatter-and-settle from the point you tapped.
  • Keyboard: the headline is focusable. Press Enter or Space to scatter the letters.
  • Reduced motion: the headline is shown as plain, fully legible static text with no interaction.

Options

Set these as data attributes on the [data-repel] element.

Attribute Values Default Description
data-repel-radius Any number (px) 130 Radius of the repulsion field around the pointer
data-repel-strength Any number 62 Base push distance for a stationary cursor
data-repel-speed Any number 1 How much cursor speed multiplies the throw (0 = speed ignored)
data-repel-blur Any number (px) 6 Peak motion blur; set 0 to disable the smear

Accessibility

  • Reduced motion: with prefers-reduced-motion: reduce, no interaction is wired and the headline renders as ordinary static text. Nothing is hidden by CSS, so the headline is fully legible even before (or without) JavaScript.
  • Keyboard: the headline is focusable (tabindex="0", role="button") and Enter or Space triggers the scatter, mirroring the pointer interaction.
  • Touch: coarse-pointer devices get a tap-to-scatter equivalent of the cursor moment.

Performance Notes

  • Letters are driven with gsap.quickTo and gsap.quickSetter, and a single gsap.ticker loop handles all letters; no per-frame tween is created while the cursor moves.
  • The secondary channels (blur, scale, opacity) are derived from each letter's real motion each frame, and the per-frame write is skipped entirely once a letter is at rest.
  • Best suited to a single large headline (a display face with a few short words). Very long paragraphs of text are not the target use case.

Dependencies

Required:

  • GSAP 3.12+ (core only)

Optional:

  • None. No GSAP plugins and no Lenis are used.

Worked examples, the events and programmatic API, and the class reference ship with the download, alongside the full source.

Your cart

Your cart is empty

The Vault £99

Everything in the catalogue, plus everything we release next.