Skip to content

176 web animation techniques, each a live demo with plain settings and a ready-made prompt for your AI assistant. No dependencies, no build step.

feat: Animated Gradient Border (04.30)

matinf65bbe11ea14
diff --git a/README.md b/README.md
index 60328023..f8e42b3e 100644
--- a/README.md
+++ b/README.md
@@ -155,6 +155,7 @@ All 129 techniques, each linked to its live demo.
- **[Toast Notification](animations/04-micro-interactions/toast-notification/)** — Short messages slide into a corner, then leave on their own. Best for updates.
- **[Segmented Control](animations/04-micro-interactions/segmented-control/)** — A highlight slides to the option you pick. Best for switching views.
- **[Pull to Refresh](animations/04-micro-interactions/pull-to-refresh/)** — Pulling a list down shows a spinner, then new items. Best for feeds.
+- **[Animated Gradient Border](animations/04-micro-interactions/gradient-border/)** — A band of colors runs around the edge of a card or button. Best for featured offers.
</details>
diff --git a/animations/04-micro-interactions/README.md b/animations/04-micro-interactions/README.md
index d2320f7e..6e33bf65 100644
--- a/animations/04-micro-interactions/README.md
+++ b/animations/04-micro-interactions/README.md
@@ -35,6 +35,7 @@ Short, user-triggered animations that provide feedback, confirm actions, and com
| [Toast Notification](toast-notification/) | Short messages slide into a corner, then leave on their own. Best for updates. |
| [Segmented Control](segmented-control/) | A highlight slides to the option you pick. Best for switching views. |
| [Pull to Refresh](pull-to-refresh/) | Pulling a list down shows a spinner, then new items. Best for feeds. |
+| [Animated Gradient Border](gradient-border/) | A band of colors runs around the edge of a card or button. Best for featured offers. |
## Key concepts
diff --git a/animations/04-micro-interactions/gradient-border/README.md b/animations/04-micro-interactions/gradient-border/README.md
new file mode 100644
index 00000000..5296a1a7
--- /dev/null
+++ b/animations/04-micro-interactions/gradient-border/README.md
@@ -0,0 +1,62 @@
+# Animated Gradient Border
+
+## What it is
+An animated gradient border is a colored edge around a card or button, with a band of colors that keeps running around it. Behind the element sits a large layer painted with colors that sweep around its center; an inner box covers everything but the edge, and the layer turns, so the colors seem to travel along the border.
+
+## When to use it
+- The featured plan on a pricing page, or the one card people should notice first
+- A main call-to-action button, such as Upgrade or Get started
+- Launches, new features and limited offers
+- Marking the selected card in a small set, sparingly
+
+## How it works
+Each bordered element holds a ring, a glow and an inner box. The ring is a box the size of the element that clips what is inside it to the element's rounded shape; in it sits a centered square, twice as wide as the element, painted with a `conic-gradient`. The inner box is inset by the border width and painted with the card's own background, so only the edge of the square shows. The square turns with a CSS animation on `transform`:
+
+```css
+.gb { position: relative; isolation: isolate; border-radius: 18px; }
+.gb-ring { position: absolute; inset: 0; border-radius: inherit; overflow: hidden;
+ background: rgba(255,255,255,.12); } /* the faint line where the band is not */
+.gb i { position: absolute; left: 50%; top: 50%; width: 200%; aspect-ratio: 1;
+ background: conic-gradient(var(--band));
+ transform: translate(-50%, -50%);
+ animation: gb-turn var(--dur) linear infinite; }
+.gb-in { position: relative; margin: var(--bw); border-radius: calc(18px - var(--bw));
+ background: #121216; } /* covers all but the edge */
+@keyframes gb-turn { to { transform: translate(-50%, -50%) rotate(1turn); } }
+
+/* A long band fades in behind its bright front; All around loops back to the first color */
+.stage { --band: transparent 0 40%, var(--c1) 58%, var(--c2) 72%, var(--c3) 85%, var(--c4) 96%, transparent; }
+.stage.b-full { --band: var(--c1), var(--c2), var(--c3), var(--c4), var(--c1); }
+```
+
+The square is twice as wide as the element so that it still covers the element's corners at every angle (true while the element is less than about 1.7 times taller than it is wide). The glow is a second copy of the ring placed behind the element (`z-index: -1` inside the element's own stacking context) with `filter: blur(16px)`. Switching the glow off sets `visibility: hidden` rather than `display: none`, so its turn keeps step with the ring's. The button's turn starts at another point of the circle (`animation-delay: calc(var(--dur) * -.4)`), so the two bands do not move in lockstep.
+
+A new speed rescales the time each turn has already played before the new duration is set, so the bands keep their place instead of jumping:
+
+```js
+stage.getAnimations({ subtree: true }).forEach(a => { a.currentTime = a.currentTime * next / secs; });
+document.documentElement.style.setProperty('--dur', next + 's');
+```
+
+## Key parameters
+| Parameter | Default | Effect |
+|-----------|---------|--------|
+| Colors | Rainbow | The four colors of the band: Rainbow, Sunset (yellow to purple) or Ocean (teal to indigo) |
+| Speed | Normal | How long one trip around the edge takes: slow is 7s, normal 4s and fast 2s; much faster and it looks busy |
+| Soft glow | On | A blurred copy of the band behind the element, so its colors spill softly onto the page |
+| Band length | Long | How much of the edge the colors cover at once: a short band, a long one, or colors all around |
+| Border width | Medium | How thick the colored edge is: thin is 1px, medium 2px and thick 4px |
+
+## Production notes
+- **Turn a layer, never the gradient**: animating the gradient's own angle (an `@property --angle` used in `conic-gradient(from var(--angle), …)`) repaints the element on every frame. Turning a finished layer with `transform` leaves the work to the compositor.
+- **Size the layer for the shape**: a square twice the element's width covers it at every angle only while the element is less than about 1.7 times taller than wide; for taller elements, size the square from the element's diagonal.
+- **One or two per view**: a moving border pulls the eye. Keep it for the single featured card or main button, not every card in a grid.
+- **Blur on phones**: the glow's blur is the costly part, so the demo blurs less on small screens, where it looks just as soft.
+- **Reduced motion**: under `prefers-reduced-motion: reduce` the demo starts paused, so the border shows its colors standing still. In production, leave the animation out and keep the still gradient.
+- **Libraries**: GSAP turns the layer with `gsap.to(layer, { rotation: 360, repeat: -1, ease: 'none', duration: 4 })`; Framer Motion does the same with `animate={{ rotate: 360 }}` and `transition={{ repeat: Infinity, ease: 'linear', duration: 4 }}`. Tailwind snippets often animate an `@property` angle instead, which works but repaints every frame.
+
+## See also
+- [Shimmer Effect](../shimmer-effect/) — a band of light that sweeps across instead of around
+- [Notification Badge Pulse](../badge-pulse/) — another small loop that draws the eye
+- [Text Gradient Animation](../../05-text-typography/text-gradient-animation/) — colors that flow through letters
+- [Animated Gradient Background](../../07-ambient-background/animated-gradient-background/) — a whole background that slowly shifts color
diff --git a/animations/04-micro-interactions/gradient-border/index.html b/animations/04-micro-interactions/gradient-border/index.html
new file mode 100644
index 00000000..c72d565c
--- /dev/null
+++ b/animations/04-micro-interactions/gradient-border/index.html
@@ -0,0 +1,234 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Animated Gradient Border — Animation Handbook</title>
+ <meta name="description" content="A band of colors runs around the edge of a card or button. Best for featured offers.">
+ <link rel="canonical" href="https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/gradient-border/">
+ <link rel="icon" type="image/png" sizes="96x96" href="../../../favicon.png">
+ <link rel="icon" type="image/svg+xml" href="../../../favicon.svg">
+ <link rel="apple-touch-icon" href="../../../apple-touch-icon.png">
+ <meta property="og:type" content="article">
+ <meta property="og:site_name" content="Animation Handbook">
+ <meta property="og:title" content="Animated Gradient Border — Animation Handbook">
+ <meta property="og:description" content="A band of colors runs around the edge of a card or button. Best for featured offers.">
+ <meta property="og:url" content="https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/gradient-border/">
+ <meta property="og:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
+ <meta name="twitter:card" content="summary_large_image">
+ <meta name="twitter:title" content="Animated Gradient Border — Animation Handbook">
+ <meta name="twitter:description" content="A band of colors runs around the edge of a card or button. Best for featured offers.">
+ <meta name="twitter:image" content="https://matinmonshizadeh.github.io/animation-handbook/og-image.png">
+ <script type="application/ld+json">{"@context": "https://schema.org", "@type": "TechArticle", "headline": "Animated Gradient Border", "name": "Animated Gradient Border", "description": "A band of colors runs around the edge of a card or button. Best for featured offers.", "url": "https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/gradient-border/", "inLanguage": "en", "articleSection": "Micro-Interactions", "isPartOf": {"@type": "WebSite", "name": "Animation Handbook", "url": "https://matinmonshizadeh.github.io/animation-handbook/"}, "author": {"@type": "Person", "name": "matinmonshizadeh"}, "keywords": "web animation, CSS animation, Micro-Interactions, Animated Gradient Border"}</script>
+ <style>
+ :root{--ui-accent:#ff9d5c;--dur:4s;--bw:2px;--c1:#ff6f8b;--c2:#ffce5a;--c3:#5fd88a;--c4:#6ea8ff}
+ *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
+ /* --band is the color stops of the turning layer: a band that fades in behind its bright front, or colors all around */
+ .stage{display:flex;align-items:center;justify-content:center;overflow:hidden;background:#0b0b0d;
+ --band:transparent 0 40%,var(--c1) 58%,var(--c2) 72%,var(--c3) 85%,var(--c4) 96%,transparent}
+ .stage.b-short{--band:transparent 0 68%,var(--c1) 78%,var(--c2) 85%,var(--c3) 91%,var(--c4) 97%,transparent}
+ .stage.b-full{--band:var(--c1),var(--c2),var(--c3),var(--c4),var(--c1)}
+ .scene{display:flex;align-items:center;justify-content:center;gap:clamp(28px,6vw,72px);width:100%;padding:clamp(16px,3vw,32px)}
+ /* Each bordered element: a turning layer clipped to its rounded box (the ring), a blurred copy behind it (the glow),
+ and an inner box that covers all but the edge */
+ .gb{position:relative;isolation:isolate;display:block;border-radius:18px;color:#f4f4f2}
+ .gb-ring,.gb-glow{position:absolute;inset:0;border-radius:inherit;overflow:hidden;pointer-events:none}
+ .gb-ring{background:rgba(255,255,255,.12)}
+ .gb-glow{z-index:-1;filter:blur(16px);opacity:.75}
+ /* Hidden, not removed, so its turn keeps step with the ring's */
+ .stage.no-glow .gb-glow{visibility:hidden}
+ /* The turning layer: a square twice as wide as the element, so it covers every corner at every angle */
+ .gb i{position:absolute;left:50%;top:50%;width:200%;aspect-ratio:1;background:conic-gradient(var(--band));
+ transform:translate(-50%,-50%);animation:gb-turn var(--dur) linear infinite;will-change:transform}
+ .gb-btn i{animation-delay:calc(var(--dur)*-.4)}
+ @keyframes gb-turn{to{transform:translate(-50%,-50%) rotate(1turn)}}
+ .gb-in{position:relative;display:block;margin:var(--bw);border-radius:calc(18px - var(--bw));background:#121216}
+ .gb-card{flex:0 1 280px;min-width:0}
+ .card-in{padding:clamp(16px,2.4vw,24px) clamp(18px,2.6vw,28px)}
+ .eyebrow{font-size:12px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:#ffce5a}
+ .plan{margin-top:6px;font-size:clamp(24px,3vw,30px);font-weight:800;letter-spacing:-.02em}
+ .price{margin-top:2px;font-size:14px;color:#adadb2}
+ .price b{font-size:18px;color:#f4f4f2}
+ .feats{margin-top:12px;list-style:none;display:flex;flex-direction:column;gap:6px;font-size:13px;color:#d6d6da}
+ .feats li::before{content:"✓";margin-right:8px;color:#5fd88a}
+ .gb-btn{flex:none;border:0;padding:0;background:none;font:inherit;cursor:pointer;border-radius:999px}
+ .btn-in{display:flex;align-items:center;min-height:52px;padding:0 clamp(22px,2.8vw,32px);border-radius:999px;font-size:clamp(15px,1.6vw,17px);font-weight:700}
+ .gb-btn:active .btn-in{background:#1a1a20}
+ @media(max-width:600px){
+ .scene{flex-direction:column;gap:22px}
+ .gb-card{flex:none;width:min(260px,100%)}
+ .feats li+li{display:none}
+ }
+ /* Blur costs the most on phones, and their stage is smaller, so less blur looks as soft */
+ @media(max-width:600px),(max-height:500px){.gb-glow{filter:blur(10px)}}
+ </style>
+ <link rel="stylesheet" href="../../../assets/css/demo-page.css?v=6">
+ <script src="../../../assets/js/demo-page.js?v=6" defer></script>
+</head>
+<body class="hb" data-hb-kind="loop">
+<nav class="hb-bar" aria-label="Animation Handbook">
+ <a class="hb-home" href="../../../"><svg class="hb-mark" viewBox="0 0 32 32" aria-hidden="true"><g class="g"><circle cx="11.16" cy="20.84" r="6.1"/><circle cx="15.12" cy="16.88" r="6.1"/><circle cx="18.51" cy="13.49" r="6.1"/></g><circle class="b" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>
+ <span class="hb-pager"><a href="../pull-to-refresh/" rel="prev" aria-label="Previous: Pull to Refresh"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg><span><span class="hb-dir">Previous: </span>Pull to Refresh</span></a></span>
+</nav>
+<main class="hb-page">
+ <header class="hb-head">
+ <p class="hb-cat">04.30 · Micro-Interactions</p>
+ <h1>Animated Gradient Border</h1>
+ <p class="hb-lede">A band of colors runs around the edge of a card or button. Best for featured offers.</p>
+ </header>
+
+ <section class="hb-step hb-watch" aria-labelledby="hb-watch-title">
+ <div class="hb-step-head">
+ <span class="hb-num" aria-hidden="true">1</span>
+ <div><h2 id="hb-watch-title">Watch it</h2><p>It moves by itself. Pause it to look closely, or turn on slow motion to see each part of the movement.</p></div>
+ </div>
+ <div class="stage hb-dots">
+ <div class="scene">
+ <div class="gb gb-card">
+ <span class="gb-glow" aria-hidden="true"><i></i></span>
+ <span class="gb-ring" aria-hidden="true"><i></i></span>
+ <div class="gb-in card-in">
+ <p class="eyebrow">Most popular</p>
+ <p class="plan">Pro</p>
+ <p class="price"><b>$12</b> / month</p>
+ <ul class="feats"><li>Unlimited projects</li><li>Priority support</li></ul>
+ </div>
+ </div>
+ <button class="gb gb-btn" type="button">
+ <span class="gb-glow" aria-hidden="true"><i></i></span>
+ <span class="gb-ring" aria-hidden="true"><i></i></span>
+ <span class="gb-in btn-in">Upgrade now</span>
+ </button>
+ </div>
+ </div>
+ <div class="hb-player">
+ <button class="hb-play" type="button" id="btn-pause" data-hb-pause="css" data-state="playing"><svg class="hb-ic hb-i-pause" viewBox="0 0 24 24" aria-hidden="true"><rect x="6" y="4" width="4" height="16" rx="1"/><rect x="14" y="4" width="4" height="16" rx="1"/></svg><svg class="hb-ic hb-i-play" viewBox="0 0 24 24" aria-hidden="true"><path d="M6 3l14 9-14 9z"/></svg><span class="hb-pause-label">Pause</span></button>
+ <label class="hb-toggle"><input class="hb-switch" type="checkbox" role="switch" id="slow-tog" data-hb-slowmo="css" autocomplete="off"><span>Slow motion</span></label>
+ </div>
+ </section>
+
+ <section class="hb-step hb-try" aria-labelledby="hb-try-title">
+ <div class="hb-step-head">
+ <span class="hb-num" aria-hidden="true">2</span>
+ <div><h2 id="hb-try-title">Try it</h2><p>Change a setting and see the difference as it moves.</p></div>
+ </div>
+ <div class="hb-settings">
+ <div class="hb-setting">
+ <p class="hb-setting-name" id="pal-lbl">Colors</p>
+ <div class="seg" id="pal-seg" role="group" aria-labelledby="pal-lbl">
+ <button type="button" data-pal="rainbow" class="on" aria-pressed="true">Rainbow</button>
+ <button type="button" data-pal="sunset" aria-pressed="false">Sunset</button>
+ <button type="button" data-pal="ocean" aria-pressed="false">Ocean</button>
+ </div>
+ <p class="hb-hint">The colors that travel around the edge.</p>
+ </div>
+ <div class="hb-setting">
+ <p class="hb-setting-name" id="speed-lbl">Speed</p>
+ <div class="seg" id="speed-seg" role="group" aria-labelledby="speed-lbl">
+ <button type="button" data-secs="7" aria-pressed="false">Slow</button>
+ <button type="button" data-secs="4" class="on" aria-pressed="true">Normal</button>
+ <button type="button" data-secs="2" aria-pressed="false">Fast</button>
+ </div>
+ <p class="hb-hint">How long one trip around the edge takes.</p>
+ </div>
+ <div class="hb-setting">
+ <label class="hb-switch-row"><span>Soft glow</span><input class="hb-switch" type="checkbox" role="switch" id="glow-tog" checked autocomplete="off"></label>
+ <p class="hb-hint">A blurred halo of the same colors around it.</p>
+ </div>
+ </div>
+ <details class="hb-options">
+ <summary><span class="hb-more-label">More options</span><span class="hb-less">Fewer options</span><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg></summary>
+ <div class="hb-settings">
+ <div class="hb-setting">
+ <p class="hb-setting-name" id="band-lbl">Band length</p>
+ <div class="seg" id="band-seg" role="group" aria-labelledby="band-lbl">
+ <button type="button" data-band="short" aria-pressed="false">Short</button>
+ <button type="button" data-band="long" class="on" aria-pressed="true">Long</button>
+ <button type="button" data-band="full" aria-pressed="false">All around</button>
+ </div>
+ <p class="hb-hint">How much of the edge the colors cover at once.</p>
+ </div>
+ <div class="hb-setting">
+ <p class="hb-setting-name" id="width-lbl">Border width</p>
+ <div class="seg" id="width-seg" role="group" aria-labelledby="width-lbl">
+ <button type="button" data-px="1" aria-pressed="false">Thin</button>
+ <button type="button" data-px="2" class="on" aria-pressed="true">Medium</button>
+ <button type="button" data-px="4" aria-pressed="false">Thick</button>
+ </div>
+ <p class="hb-hint">How thick the colored edge is.</p>
+ </div>
+ </div>
+ </details>
+ </section>
+
+ <section class="hb-step hb-prompt-step" aria-labelledby="hb-prompt-title">
+ <div class="hb-step-head">
+ <span class="hb-num" aria-hidden="true">3</span>
+ <div><h2 id="hb-prompt-title">Copy the prompt</h2><p>Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.</p></div>
+ </div>
+ <div class="hb-card">
+ <p class="hb-prompt">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 over a faint base 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.</p>
+ <div class="hb-chips-box" hidden>
+ <p class="hb-chips-title">Your settings</p>
+ <ul class="hb-chips"></ul>
+ </div>
+ <div class="hb-copy-row">
+ <button class="hb-copy" type="button"><svg class="hb-ic hb-i-copy" viewBox="0 0 24 24" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg><svg class="hb-ic hb-i-done" viewBox="0 0 24 24" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg><span class="hb-copy-label" aria-live="polite">Copy prompt</span></button>
+ <p class="hb-hint">Replace the words in brackets with your own element. Your settings are added at the end.</p>
+ </div>
+ </div>
+ </section>
+
+ <section class="hb-about" aria-labelledby="hb-what-title">
+ <div class="hb-what">
+ <h2 id="hb-what-title">What it is</h2>
+ <div class="hb-what-text"><p>The full explanation is in <a href="README.md">README.md</a>.</p></div>
+ </div>
+ <div class="hb-fit">
+ <h2>Good for</h2>
+ <ul class="hb-tags hb-good"><li>Featured plans</li><li>Main buttons</li><li>New features</li><li>Promo cards</li></ul>
+ <h3>Avoid on</h3>
+ <ul class="hb-tags hb-avoid"><li>Every card on a page</li><li>Calm reading pages</li></ul>
+ </div>
+ </section>
+
+ <section class="hb-related" aria-labelledby="hb-related-title" hidden>
+ <h2 id="hb-related-title">Similar animations</h2>
+ <div class="hb-rel-list"></div>
+ </section>
+</main>
+<footer class="hb-foot"><span>Animation Handbook</span><a href="#top">Back to top ↑</a></footer>
+<script>
+ const stage=document.querySelector('.stage');
+ const vars=document.documentElement.style;
+ // Each set of colors is the four stops of the band, from its faint tail to its bright front
+ const PALETTES={
+ rainbow:['#ff6f8b','#ffce5a','#5fd88a','#6ea8ff'],
+ sunset:['#ffce5a','#ff9d5c','#ff6f8b','#b98cff'],
+ ocean:['#3fd6c4','#4cc3ff','#6ea8ff','#8f7bff']
+ };
+ let secs=4;
+
+ function choices(id,pick){
+ const buttons=document.querySelectorAll('#'+id+' button');
+ buttons.forEach(b=>b.addEventListener('click',()=>{
+ buttons.forEach(x=>{x.classList.toggle('on',x===b);x.setAttribute('aria-pressed',String(x===b))});
+ pick(b.dataset);
+ }));
+ }
+ choices('pal-seg',d=>{PALETTES[d.pal].forEach((c,i)=>vars.setProperty('--c'+(i+1),c))});
+ // A new --dur keeps the time already played, so every band would jump to another point of its turn.
+ // Scaling each turn's time by the same factor as its length keeps the bands where they are, moving or paused,
+ // and keeps each glow in step with its ring.
+ choices('speed-seg',d=>{
+ const next=+d.secs;
+ stage.getAnimations({subtree:true}).forEach(a=>{if(a.currentTime!=null)a.currentTime=a.currentTime*next/secs});
+ secs=next;
+ vars.setProperty('--dur',next+'s');
+ });
+ document.getElementById('glow-tog').addEventListener('change',e=>{stage.classList.toggle('no-glow',!e.target.checked)});
+ choices('band-seg',d=>{stage.classList.toggle('b-short',d.band==='short');stage.classList.toggle('b-full',d.band==='full')});
+ choices('width-seg',d=>{vars.setProperty('--bw',d.px+'px')});
+</script>
+</body>
+</html>
diff --git a/animations/04-micro-interactions/pull-to-refresh/index.html b/animations/04-micro-interactions/pull-to-refresh/index.html
index 3dc38526..108187b2 100644
--- a/animations/04-micro-interactions/pull-to-refresh/index.html
+++ b/animations/04-micro-interactions/pull-to-refresh/index.html
@@ -77,7 +77,7 @@
<body class="hb" data-hb-kind="do" data-hb-autoplay>
<nav class="hb-bar" aria-label="Animation Handbook">
<a class="hb-home" href="../../../"><svg class="hb-mark" viewBox="0 0 32 32" aria-hidden="true"><g class="g"><circle cx="11.16" cy="20.84" r="6.1"/><circle cx="15.12" cy="16.88" r="6.1"/><circle cx="18.51" cy="13.49" r="6.1"/></g><circle class="b" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>
- <span class="hb-pager"><a href="../segmented-control/" rel="prev" aria-label="Previous: Segmented Control"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg><span><span class="hb-dir">Previous: </span>Segmented Control</span></a></span>
+ <span class="hb-pager"><a href="../segmented-control/" rel="prev" aria-label="Previous: Segmented Control"><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg><span><span class="hb-dir">Previous: </span>Segmented Control</span></a><a href="../gradient-border/" rel="next" aria-label="Next: Animated Gradient Border"><span><span class="hb-dir">Next: </span>Animated Gradient Border</span><svg class="hb-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg></a></span>
</nav>
<main class="hb-page">
<header class="hb-head">
diff --git a/index.html b/index.html
index e2d7eb15..a276ef54 100644
--- a/index.html
+++ b/index.html
@@ -674,6 +674,19 @@ button,input{font:inherit;color:inherit}
.pv-cursor .foll{position:absolute;width:12%;aspect-ratio:1;border-radius:50%;background:color-mix(in srgb,var(--accent) 40%,transparent);border:1px solid var(--accent);animation:m-foll 4s ease-in-out infinite}
@keyframes m-tgt{0%{left:20%;top:30%}25%{left:70%;top:24%}50%{left:74%;top:64%}75%{left:24%;top:68%}100%{left:20%;top:30%}}
@keyframes m-foll{0%{left:20%;top:30%}29%{left:70%;top:24%}54%{left:74%;top:64%}79%{left:24%;top:68%}100%{left:20%;top:30%}}
+/* gradient border: a square layer of colors turns behind a card; the inner box covers all but the edge, and a blurred copy glows */
+.pv-gradborder{background:#08090c;display:grid;place-items:center}
+.pv-gradborder .gbx{position:relative;top:8%;width:46%;height:58%;border-radius:10px} /* a little low, clear of the place label */
+.pv-gradborder .rg,.pv-gradborder .gl{position:absolute;inset:0;border-radius:inherit;overflow:hidden}
+.pv-gradborder .rg{background:rgba(255,255,255,.1)}
+.pv-gradborder .gl{filter:blur(9px);opacity:.8}
+.pv-gradborder i{position:absolute;left:50%;top:50%;width:200%;aspect-ratio:1;background:conic-gradient(transparent 0 40%,var(--c5) 58%,var(--c7) 72%,var(--c2) 85%,var(--c1) 96%,transparent);transform:translate(-50%,-50%);animation:m-gbturn 3.2s linear infinite}
+@keyframes m-gbturn{to{transform:translate(-50%,-50%) rotate(1turn)}}
+.pv-gradborder .in{position:absolute;inset:2px;display:flex;flex-direction:column;justify-content:center;gap:9%;padding:0 13%;border-radius:8px;background:#111217}
+.pv-gradborder .in b{height:7px;border-radius:2px;background:#262a33}
+.pv-gradborder .in b:first-child{width:38%;background:var(--c7)}
+.pv-gradborder .in b:nth-child(2){width:62%;height:11px;background:#e9e9ec}
+.pv-gradborder .in b:last-child{width:84%}
/* ── bespoke: 05 Text & Typography ── */
.pv-kinetic{background:#0c0608;display:grid;place-items:center;overflow:hidden}
@@ -1007,7 +1020,7 @@ button,input{font:inherit;color:inherit}
<section class="wrap home-hero" aria-labelledby="hero-title">
<span class="float fl1" aria-hidden="true"></span><span class="float fl2" aria-hidden="true"></span><span class="float fl3" aria-hidden="true"></span>
<span class="float fl4" aria-hidden="true"></span><span class="float fl5" aria-hidden="true"></span><span class="float fl6" aria-hidden="true"></span>
- <p class="pill"><span class="pill-dot" aria-hidden="true"></span>129 free animations · no coding needed</p>
+ <p class="pill"><span class="pill-dot" aria-hidden="true"></span>130 free animations · no coding needed</p>
<h1 class="h1" id="hero-title">What do you want to animate?</h1>
<p class="sub">Pick a place, or describe it in your own words. Every animation plays live, and each one comes with a ready-made prompt for your AI assistant.</p>
<form class="search" id="search-form" role="search" action="./" method="get">
@@ -1064,8 +1077,8 @@ button,input{font:inherit;color:inherit}
<p class="empty-s">Try a simpler word, or pick one of these:</p>
<p class="pop"><button type="button" data-q="fade in">fade in</button><button type="button" data-q="typing text">typing text</button><button type="button" data-q="loading spinner">loading spinner</button><button type="button" data-q="parallax">parallax</button><button type="button" data-q="confetti">confetti</button></p>
</div>
- <div class="more" id="more"><button type="button" class="bigbtn" id="more-btn"><span id="more-label">Browse all 129 animations</span><svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M6 13l6 6 6-6"/></svg></button></div>
- <noscript><p class="noscript">This page shows its animations with JavaScript. All 129 are still easy to reach: see the <a href="https://github.com/matinmonshizadeh/animation-handbook#categories">category list on GitHub</a> or the <a href="sitemap.xml">full sitemap</a>. Each demo is a page of its own under <code>/animations/&lt;category&gt;/&lt;name&gt;/</code>.</p></noscript>
+ <div class="more" id="more"><button type="button" class="bigbtn" id="more-btn"><span id="more-label">Browse all 130 animations</span><svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M6 13l6 6 6-6"/></svg></button></div>
+ <noscript><p class="noscript">This page shows its animations with JavaScript. All 130 are still easy to reach: see the <a href="https://github.com/matinmonshizadeh/animation-handbook#categories">category list on GitHub</a> or the <a href="sitemap.xml">full sitemap</a>. Each demo is a page of its own under <code>/animations/&lt;category&gt;/&lt;name&gt;/</code>.</p></noscript>
</section>
<section class="how" id="how" aria-labelledby="how-title">
@@ -1083,7 +1096,7 @@ button,input{font:inherit;color:inherit}
<footer class="wrap foot">
<a class="brand" href="./"><svg class="mark" viewBox="0 0 32 32" aria-hidden="true"><circle class="ring" cx="11.16" cy="20.84" r="6.1"/><circle class="ring" cx="15.12" cy="16.88" r="6.1"/><circle class="ring" cx="18.51" cy="13.49" r="6.1"/><circle class="ball" cx="21.2" cy="10.8" r="6.6"/></svg><span>Animation Handbook</span></a>
- <p class="foot-t">129 web animations with live demos and copyable prompts.</p>
+ <p class="foot-t">130 web animations with live demos and copyable prompts.</p>
<nav class="nav" aria-label="Footer"><a class="lnk" href="https://github.com/matinmonshizadeh/animation-handbook" target="_blank" rel="noopener noreferrer">GitHub</a><a class="lnk" href="#top">Back to top</a></nav>
</footer>
<div class="toast" id="toast" role="status" aria-live="polite"><span class="ok" aria-hidden="true"><svg class="i" viewBox="0 0 24 24"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span><span class="toast-t"></span></div>
@@ -1205,6 +1218,7 @@ const CATS=[
['toast-notification','Toast Notification','Short messages slide into a corner, then leave on their own. Best for updates.'],
['segmented-control','Segmented Control','A highlight slides to the option you pick. Best for switching views.'],
['pull-to-refresh','Pull to Refresh','Pulling a list down shows a spinner, then new items. Best for feeds.'],
+ ['gradient-border','Animated Gradient Border','A band of colors runs around the edge of a card or button. Best for featured offers.'],
]
},
{
@@ -1284,6 +1298,7 @@ const PV={
'svg-line-draw':'linedraw','scrollspy-nav':'spy','scroll-background-color':'bgblend',
'hamburger-menu-toggle':'hamb','theme-toggle-morph':'thememorph','copy-to-clipboard':'copyfx',
'star-rating':'stars','toast-notification':'toast','segmented-control':'segct','pull-to-refresh':'pullref',
+ 'gradient-border':'gradborder',
'flip-card-3d':'flip3d','matrix-rain':'matrix','plasma':'plasmapv',
'parallax-depth-of-field':'dof','parallax-scrolling':'plx','reverse-scrolling-columns':'revcol',
'cover-card-to-fixed-header':'cover','fly-in-fly-out-contact-list':'flylist','stacking-cards':'stack',
@@ -1405,6 +1420,7 @@ const PLACES={
'toast-notification':['load'],
'segmented-control':['menu','btn'],
'pull-to-refresh':['load'],
+ 'gradient-border':['btn','imgcard'],
// 05
'kinetic-typography':['text','intro'],
'typewriter-effect':['text','intro'],
@@ -1467,6 +1483,7 @@ function pvMarkup(k){
case 'sig2': return '<span class="s2 anim"></span>';
case 'sig3': return '<span class="s3 pa anim"></span><span class="s3 pb anim"></span>';
case 'sig4': return '<span class="s4r anim"></span><span class="s4r r2 anim"></span><span class="s4r r3 anim"></span><span class="s4d"></span>';
+ case 'gradborder': return '<span class="gbx"><span class="gl"><i class="anim"></i></span><span class="rg"><i class="anim"></i></span><span class="in"><b></b><b></b><b></b></span></span>';
case 'sig5': return '<span class="s5 anim"></span><span class="s5 anim"></span><span class="s5 anim"></span>';
case 'sig6': return '<div class="cube anim"><span class="face f1"></span><span class="face f2"></span><span class="face f3"></span><span class="face f4"></span><span class="face f5"></span><span class="face f6"></span></div>';
case 'sig7': return '<span class="s7 anim"></span>';
diff --git a/sitemap.xml b/sitemap.xml
index 23cc35d9..ca9f1824 100644
--- a/sitemap.xml
+++ b/sitemap.xml
@@ -81,6 +81,7 @@
<url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/toast-notification/</loc><lastmod>2026-07-14</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
<url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/segmented-control/</loc><lastmod>2026-07-14</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
<url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/pull-to-refresh/</loc><lastmod>2026-07-14</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
+ <url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/04-micro-interactions/gradient-border/</loc><lastmod>2026-10-01</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
<url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/05-text-typography/kinetic-typography/</loc><lastmod>2026-07-14</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
<url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/05-text-typography/typewriter-effect/</loc><lastmod>2026-07-14</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>
<url><loc>https://matinmonshizadeh.github.io/animation-handbook/animations/05-text-typography/scramble-text/</loc><lastmod>2026-07-14</lastmod><changefreq>monthly</changefreq><priority>0.7</priority></url>