04.30 · Micro-Interactions

Animated Gradient Border

A band of colors runs around the edge of a card or button. Best for featured offers.

Watch it

It moves by itself. Pause it to look closely, or turn on slow motion to see each part of the movement.

Most popular

Pro

$12 / month

  • Unlimited projects
  • Priority support

Try it

Change a setting and see the difference as it moves.

Colors

The colors that travel around the edge.

Speed

How long one trip around the edge takes.

A blurred halo of the same colors around it.

More optionsFewer options

Band length

How much of the edge the colors cover at once.

Border width

How thick the colored edge is.

Copy the prompt

Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.

Add an animated gradient border to [the card or button you want to stand out]. Give it an edge where a band of colors keeps running around it; wherever the band does not reach, the edge stays a faint line. Build it from a square layer, twice as wide as the element, filled with a gradient that sweeps around its center, clipped to the element's rounded shape and covered by an inner box everywhere but the edge. Turn that layer and never animate the gradient itself, so the browser only rotates a finished picture. For a glow, put a blurred copy of the same layer behind it. If the visitor has reduced motion turned on, keep the border still. Match the settings listed below.

Replace the words in brackets with your own element. Your settings are added at the end.

Free and open source. If this helped, a star on GitHub helps other people find it.

Star on GitHub

What it is

The full explanation is in README.md.

Good for

  • Featured plans
  • Main buttons
  • New features
  • Promo cards

Avoid on

  • Every card on a page
  • Calm reading pages