Blog

Animated hero section examples, with the code behind them

Six animated hero sections from the BuildMotions library, what each one does well, and short React and CSS code for the technique behind it: kinetic type, self-drawing lines, film heroes, orbits, counters and magnetic buttons.

Three glass hero section frames in a row: one with drifting particles, one with a morphing liquid blob, one with sweeping coral ribbons
Three common hero motion styles: particles, liquid shapes and kinetic ribbons.

What a good animated hero does

A hero has about three seconds to say what the product is and why it matters. Motion helps when it points at that message: a word that changes to show range, a line that draws to show care, a film that shows the product doing its job. It hurts when it competes with the headline or delays it.

The six heroes below are from the BuildMotions hero section templates. For each one there is a short description of why the motion works and a small, original code example of the technique. These are simplified for reading; the full templates include the responsive layout, the reduced-motion states and the content.

1. Kinetic type with a rolling word (Kinetik)

The Kinetik studio hero is almost all type: a giant condensed headline where one word rolls through alternatives, a marquee of services underneath and a round call-to-action button. It works because the motion is the brand. There is nothing else on screen to compete with it.

A rolling word needs no library. Stack the words in a clipped box and move the column with a stepped keyframe animation. Keep the cycle slow (around two seconds per word) so each word can be read.

rolling-word.module.css
.roll { display: inline-block; height: 1em; overflow: hidden; vertical-align: bottom; }
.words { display: flex; flex-direction: column; animation: roll 8s steps(1) infinite; }
.words span { height: 1em; line-height: 1; }
@keyframes roll {
  0%, 22% { transform: translateY(0); }
  25%, 47% { transform: translateY(-1em); }
  50%, 72% { transform: translateY(-2em); }
  75%, 97% { transform: translateY(-3em); }
}
@media (prefers-reduced-motion: reduce) { .words { animation: none; } }
Kinetik hero: giant condensed headline WE MAKE PRODUCTS MOVE with a blue rolling word, stats, a pink round button and a services marquee
Kinetik: the headline is the animation. One word rolls, the services marquee runs underneath.

2. A line that draws itself (Verdant)

The Verdant climate-tech hero draws a fern in a single line next to a calm serif headline and a live counter of carbon removed. The drawing takes about two seconds and then stops, so it signals care without becoming a distraction.

Self-drawing lines are an SVG trick: set the stroke dash length to the path length, offset it by the same amount, then animate the offset to zero. pathLength="1" means you do not need to measure the path.

fern.tsx
export function Fern() {
  return (
    <svg viewBox="0 0 200 400" className="fern" aria-hidden="true">
      <path pathLength={1} d="M100 390 C100 300 98 200 100 20 M100 80 C80 70 60 72 40 85 M100 80 C120 70 140 72 160 85" />
    </svg>
  );
}
/* fern.css
.fern path { fill: none; stroke: currentColor; stroke-width: 2; stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: draw 2.2s ease-out 0.3s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .fern path { animation: none; stroke-dashoffset: 0; } } */
Verdant hero: serif headline Put carbon back where it came from, two buttons, a live counter and a fern drawn in one line
Verdant: a fern drawn in one line, a highlighted word and a counter that keeps rising.

3. A film hero that paints fast (Ampere)

The Ampere EV hero is built around a glowing studio film, with paint swatches that recolour the page and specs that count up. Film heroes are the most striking kind and the easiest to get wrong: a large video that loads before anything else ruins the first impression it was meant to create.

The rule is poster first. Render a compressed poster image at the correct size so the page paints immediately, then start the muted, inline video only when it is in view, and never on Save-Data connections.

hero-film.tsx
'use client';
import { useEffect, useRef, useState } from 'react';

export function HeroFilm({ src, poster }: { src: string; poster: string }) {
  const ref = useRef<HTMLVideoElement>(null);
  const [play, setPlay] = useState(false);
  useEffect(() => {
    const saveData = (navigator as Navigator & { connection?: { saveData?: boolean } }).connection?.saveData;
    const reduced = matchMedia('(prefers-reduced-motion: reduce)').matches;
    if (saveData || reduced || !ref.current) return;
    const observer = new IntersectionObserver(([entry]) => setPlay(entry.isIntersecting), { threshold: 0.5 });
    observer.observe(ref.current);
    return () => observer.disconnect();
  }, []);
  useEffect(() => { if (play) ref.current?.play().catch(() => {}); else ref.current?.pause(); }, [play]);
  return <video ref={ref} src={play ? src : undefined} poster={poster} muted playsInline loop width={1600} height={900} />;
}
Ampere EV hero with a studio car film, colour swatches and specs
Ampere: the poster paints first, the film starts when it is in view.

4. Orbiting elements that stay upright (Orbit)

The Orbit AI-agents hero has a ring of selectable agent chips slowly orbiting a glass planet film. The detail that makes it feel finished is that the chips stay upright as they travel: the ring rotates one way and each chip counter-rotates by the same amount.

Slow is important here. One revolution every 40 to 60 seconds reads as ambient; anything faster turns the chips into a carousel the reader has to chase. Pause the rotation while a chip is hovered or focused so it can be clicked.

orbit.module.css
.ring { position: absolute; inset: 0; animation: spin 48s linear infinite; }
.chip { position: absolute; left: 50%; top: 0; transform: translate(-50%, -50%);
  animation: spin 48s linear infinite reverse; }
.ring:hover, .ring:focus-within, .ring:hover .chip, .ring:focus-within .chip { animation-play-state: paused; }
@keyframes spin { to { rotate: 360deg; } }
@media (prefers-reduced-motion: reduce) { .ring, .chip { animation: none; } }
Orbit AI agents hero with a glass planet and a ring of agent chips
Orbit: chips circle the planet slowly and pause when you point at one.

5. A live counter that feels real

Both Verdant and Ampere use numbers that move: a running total, or specs that count up on load. A counter is convincing when it moves at a believable rate and keeps the final value in the HTML, so it is correct for search engines and screen readers before any script runs.

Use requestAnimationFrame rather than setInterval so the count stops when the tab is hidden, and format with toLocaleString so thousands separators match the reader’s locale.

count-up.tsx
'use client';
import { useEffect, useRef } from 'react';

export function CountUp({ to, ms = 1400 }: { to: number; ms?: number }) {
  const ref = useRef<HTMLSpanElement>(null);
  useEffect(() => {
    if (matchMedia('(prefers-reduced-motion: reduce)').matches) return;
    let start = 0, frame = 0;
    const tick = (time: number) => {
      start ||= time;
      const t = Math.min(1, (time - start) / ms), eased = 1 - (1 - t) ** 3;
      if (ref.current) ref.current.textContent = Math.round(to * eased).toLocaleString();
      if (t < 1) frame = requestAnimationFrame(tick);
    };
    frame = requestAnimationFrame(tick);
    return () => cancelAnimationFrame(frame);
  }, [to, ms]);
  return <span ref={ref}>{to.toLocaleString()}</span>;
}

6. A magnetic button

Kinetik’s round "Start a project" button leans towards the cursor when it comes close. It is a small effect that makes the primary action feel alive, and it is easy to overdo: limit the pull to a few pixels and skip it entirely on touch screens, where there is no hover.

magnetic.tsx
'use client';
import { useRef, type ReactNode } from 'react';

export function Magnetic({ children, strength = 0.25 }: { children: ReactNode; strength?: number }) {
  const ref = useRef<HTMLDivElement>(null);
  const move = (event: React.PointerEvent) => {
    if (event.pointerType !== 'mouse' || !ref.current) return;
    const box = ref.current.getBoundingClientRect();
    const x = (event.clientX - box.left - box.width / 2) * strength;
    const y = (event.clientY - box.top - box.height / 2) * strength;
    ref.current.style.transform = `translate(${x}px, ${y}px)`;
  };
  const reset = () => { if (ref.current) ref.current.style.transform = ''; };
  return <div ref={ref} onPointerMove={move} onPointerLeave={reset} style={{ transition: 'transform 200ms ease-out' }}>{children}</div>;
}

Choosing the right motion for your hero

Match the motion to what the product needs to prove. A studio or agency proves craft, so kinetic type works. A climate or health product needs trust, so a slow drawing line and a real number work better than anything flashy. A physical product needs to be seen, so a film earns its weight. A platform with many parts can show them orbiting, as long as they stay readable.

Whatever you choose, keep the headline readable from the first frame, keep the primary button still enough to click, and make sure the reduced-motion version still tells the whole story.

  • Headline visible within the first second, before any animation finishes.
  • One primary motion idea, not three.
  • Poster or still for every film and shader.
  • Every loop pauses on hover or focus if it contains something clickable.
  • Checked at 390 px wide: big type and orbits need their own mobile layout.

Mistakes we see in animated heroes

Reviewing hero sections built from prompts, the same problems come up again and again. None of them need a redesign to fix; they need a decision someone skipped.

The first is the delayed headline. A staggered entrance that takes two seconds to finish means the visitor spends two seconds reading nothing. Start the headline at full opacity, or keep the entrance under 600 milliseconds in total.

The second is a moving call to action. A button that drifts, pulses or orbits is harder to click, and on touch screens it can move between the moment a thumb aims and the moment it lands. Animate around the button, not the button itself; the magnetic effect above is the exception because it follows the pointer instead of moving on its own.

The third is ignoring the second visit. Motion that delights the first time can annoy the fifth. Effects that play once per session, or only on the first scroll, age better than ones that replay on every page load.

The last is the mobile afterthought. Giant type, side-by-side films and orbits all need their own small-screen layout. Decide in the prompt what the hero looks like at 390 pixels wide instead of letting the desktop layout shrink until it breaks.

Build these heroes with an AI tool

Each of these heroes has a structured prompt that describes the layout, the motion with exact timings and the fallbacks, ready for Claude Code, Codex, Antigravity, Cursor, Lovable or v0. Browse the hero animation prompts, compare the hero section templates live on desktop and mobile, or open the scroll storytelling templates for heroes that continue into longer pages. Every plan includes the prompts and source code, from $9 a month.

Questions

What makes a good animated hero section?
One motion idea that supports the headline, a headline readable within the first second, a primary button that stays easy to click, and a reduced-motion version that still tells the full story.
Do animated heroes hurt page speed?
They do not have to. Use CSS for simple motion, show a sized poster before any video, start films only when visible, and keep the hero image as the only eagerly loaded image.
Should I use a library for hero animation?
Most hero effects (rolling words, drawing lines, orbits, counters) need only CSS and a few lines of React. Reach for a library like GSAP or Motion for long, choreographed timelines.
Can I use these hero sections in my own project?
Yes. Every hero section template includes its prompt and, on paid plans, the source code for use in personal and client projects.

Ready to build? Browse the template library, copy a prompt, or compare the plans.