Skip to content
Founding Lifetime: every Pro skillfirst 100 members · $169 onceUpgrade
Lookbk
Sign In
Effect guide

Wave effect CSS: an animated wave with SVG and keyframes

A CSS wave is a wavy SVG shape that slides sideways in a loop. Draw one wave shape that repeats, animate its transform with CSS keyframes, and stack two or three copies at different speeds.

Free skills to start. Pro is $79 a year for every skill, or $9.99 a month for 10. See pricing

What is a wave effect css?

A wave effect in CSS is a band of curved edge, usually at the bottom of a hero or between two sections, that appears to roll sideways forever. CSS has no wave property, so the curve comes from an SVG path, and CSS only moves it. The shape is drawn once, made wider than the visible area, and shifted along the x axis by exactly one repeat of the pattern. When the animation restarts, the picture looks the same as at the start, so the loop shows no jump.

The curve is cheap to write because of two SVG path commands. A quadratic curve, written with `q`, bends one segment toward a single control point. The `t` command then draws the next segment with its control point reflected through the current point, so the curve flips from a crest into a trough on its own. Repeating `t` with the same offset gives an even wave from one short string.

Most wave tutorials animate `background-position` or the path itself. The better habit is to animate `transform`. MDN says that when an element is promoted to a layer, animating transform can run on the GPU, and that animations avoiding reflow and repaint can be sampled off the main thread. That is why the starter below moves a whole SVG with `translateX` and never changes its path.

How the effect works

The starter draws the wave in an SVG whose `viewBox` is 1600 units wide. The path holds four repeats of a 400-unit wave: one `q` segment, then seven `t` segments, each 200 units across. The path is closed along the bottom so it can be filled. The SVG is set to twice the width of its container and `preserveAspectRatio="none"` lets it stretch to any height.

The animation moves the SVG from `translateX(0)` to `translateX(-50%)`. MDN says a percentage in `translateX()` refers to the width of the element's reference box, so -50% is half of the SVG: exactly two of the four repeats. Because the path at that offset is identical to the path at zero, the loop is seamless. Use `linear` timing. MDN notes the default is `ease`, which speeds up and slows down within every cycle, and on a looping wave that shows up as a visible pulse at each restart.

Depth comes from layers. The starter uses three copies with different heights, opacity and durations. Negative `animation-delay` values start each layer part-way through its cycle, so the waves do not line up on the first frame. For users who ask for less motion, a `prefers-reduced-motion: reduce` block turns the animation off and leaves the waves as a still shape.

  1. 01

    Draw one repeating wave

    Write a path with `M`, one `q` segment and several `t` segments of equal length. Close it with `V` and `H` so it fills down to the bottom edge.

  2. 02

    Make the SVG twice as wide as the view

    Put it in a container with `overflow: hidden`, set the SVG width to 200% and keep the path an exact whole number of repeats.

  3. 03

    Animate transform by half the width

    Use a keyframe from `translateX(0)` to `translateX(-50%)`, with `linear` timing and `infinite`.

  4. 04

    Stack layers

    Copy the SVG two more times. Change the fill opacity, height and duration of each one, and give each a negative delay.

  5. 05

    Add the reduced-motion rule

    Inside `@media (prefers-reduced-motion: reduce)`, set `animation: none` on the wave layers.

HTML

Layered wave with SVG and CSS keyframes

Three wave layers slide at different speeds over a gradient. Change the path offsets to alter the wave, and the durations to change the speed.

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Wave effect CSS</title>
<style>
  html, body { margin: 0; height: 100%; }
  .hero {
    position: relative;
    height: 100vh;
    overflow: hidden;
    background: linear-gradient(#1b2a6b, #3b7dd8 70%, #7fd0f0);
    font-family: system-ui, sans-serif;
    color: #fff;
  }
  .hero h1 {
    position: relative;
    z-index: 2;
    margin: 0;
    padding: 18vh 8vw 0;
    font-size: clamp(2rem, 6vw, 4.5rem);
    font-weight: 600;
  }
  .wave {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 200%;          /* two copies of the view, so -50% is a perfect loop */
    height: 40%;
    animation: slide 12s linear infinite;
  }
  .wave path { fill: #fff; }
  .wave.back  { height: 46%; opacity: .35; animation-duration: 20s; animation-delay: -6s; }
  .wave.mid   { height: 38%; opacity: .6;  animation-duration: 14s; animation-delay: -3s; }
  .wave.front { height: 30%; opacity: 1;   animation-duration: 9s; }
  @keyframes slide {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
  }
  @media (prefers-reduced-motion: reduce) {
    .wave { animation: none; }
  }
</style>
</head>
<body>
<section class="hero">
  <h1>Wave effect in plain CSS</h1>
  <svg class="wave back" viewBox="0 0 1600 120" preserveAspectRatio="none" aria-hidden="true">
    <path d="M0 60 q100 -50 200 0 t200 0 t200 0 t200 0 t200 0 t200 0 t200 0 t200 0 V120 H0 Z"/>
  </svg>
  <svg class="wave mid" viewBox="0 0 1600 120" preserveAspectRatio="none" aria-hidden="true">
    <path d="M0 60 q100 -50 200 0 t200 0 t200 0 t200 0 t200 0 t200 0 t200 0 t200 0 V120 H0 Z"/>
  </svg>
  <svg class="wave front" viewBox="0 0 1600 120" preserveAspectRatio="none" aria-hidden="true">
    <path d="M0 60 q100 -50 200 0 t200 0 t200 0 t200 0 t200 0 t200 0 t200 0 t200 0 V120 H0 Z"/>
  </svg>
</section>
</body>
</html>

A starting point written for this page, free to use in your own projects. The skills below build the finished version with checks, fallbacks and a recorded video.

What to get right on a real page

  1. 01

    Keep the shift an exact number of repeats

    The loop only hides its seam if the end offset shows the same pixels as the start. With four repeats in the path and a -50% shift, you move two repeats. If you change the path length, change the shift to match.

  2. 02

    Use linear timing

    The default timing function is `ease`, which changes speed inside each cycle. On a loop that reads as the wave stalling and lurching once per restart. Set `linear` on the wave animation.

  3. 03

    Animate transform, not the path or background

    MDN says transform animations can be handled on the GPU when the element is a layer, and that properties which avoid reflow and repaint can be sampled off the main thread. Moving a finished SVG fits that. Redrawing the path on every frame does not.

  4. 04

    Offset the layers with negative delays

    A negative `animation-delay` starts the animation immediately, part-way through its cycle. Use different negative values per layer so the crests do not line up when the page loads.

  5. 05

    Honor reduced motion

    MDN says large panning motion can trigger vestibular discomfort. A wide wave sliding across the screen is that kind of motion, so switch it off under `prefers-reduced-motion: reduce`. You can also replace it with a slow opacity change, as MDN's own example does.

  6. 06

    Make the wave decorative

    A wave carries no information, so mark each SVG `aria-hidden="true"` and keep text above it with enough contrast against the lightest part of the background behind it.

Skills that build a wave effect css

The starter gives you a flat, stylised wave. If you want a full water scene on a landing page, this skill builds one.

  1. Ocean Swell Hero: an example of what it makes
    web
    Ocean Swell HeroClaude CodeCodexCursor+3 more agents

    Motion Heroes · Pro

    Ocean Swell Hero

    Animated three.js hero · page + embed + 1080p video

    It builds an animated website hero over an open sea, a long slow swell rolling under shorter wind waves, made from summed Gerstner waves. Your agent sets the brand's colors, fonts, logo, headline and buttons, checks contrast and layout at four widths, and records a 1080p video.

    Worth knowing: It uses three.js with shaders and needs WebGL at runtime. Without WebGL, or if three.js cannot load, visitors see an illustrated still instead.

    Needs: Node.js 18+, Chrome (or Chromium/Edge), and ffmpeg for the video

    See what Ocean Swell Hero makes

Install

Build a wave effect css with your agent

Each skill is a SKILL.md folder, so it installs the same way in Claude Code, Codex, Cursor and other agents. The example below uses Ocean Swell Hero; each skill page has its own prompt.

1. Paste the install prompt

Your agent runs the installer. The first time, it shows a sign-in link so you can approve it in the browser.

Install the "Ocean Swell Hero" skill from Lookbk (https://lookbk.dev/skills/ocean-swell-hero).
1. Run: curl -fsSL https://lookbk.dev/cli.js | node - add ocean-swell-hero
2. If it prints a sign-in link, show it to me. When I say I approved it, run the same command again.
3. When the install finishes, read the SKILL.md it installed and tell me what you need from me to make the first result.

Or run it in a terminal

curl -fsSL https://lookbk.dev/cli.js | node - add ocean-swell-hero

2. Start a new session

Agents load skills when a session starts. The installer writes the folder where your agent looks:

Claude Code
~/.claude/skills/ocean-swell-hero
Codex
~/.agents/skills/ocean-swell-hero
Cursor
~/.agents/skills/ocean-swell-hero

3. Ask for the result

Describe it in plain words, for example:

Build an Ocean Swell hero for Saltmarrow Sailing, our evening sailing school: deep dusk blue sky, apricot sun low over the sea with a glitter path, headline 'Learn to sail by last light.', the wind and sunset time in the corner, and record a 12-second loop for Instagram.

Another agent? Install a skill in any agent

FAQ

Questions

Still stuck? The guides cover installing, agents and licensing in more detail.

Read the guides
How do I make a wave with only CSS?

Pure CSS has no wave primitive, so the usual route is an inline SVG path for the curve and CSS keyframes for the motion. You can also draw waves with `border-radius` or `clip-path`, but an SVG path with `q` and `t` commands gives smoother, easier-to-edit curves.

What do the q and t commands in the wave path do?

`q` draws a quadratic curve that bends toward one control point. `t` draws a smooth quadratic curve whose control point is reflected from the previous curve, so repeated `t` commands alternate between crest and trough without you writing the control points.

Why does my wave jump when the animation restarts?

The end position does not match the start. Check that the translate distance equals a whole number of wave repeats, and that the animation uses `linear` timing instead of the default `ease`.

How do I make the wave faster or taller?

Shorten the animation duration to speed it up. For height, change the `height` of the SVG, or change the control point offset in the `q` command, for example from -50 to -80.

How do I respect users who turn animations off?

Add a `@media (prefers-reduced-motion: reduce)` block that sets `animation: none` on the wave. The media feature is true when the user has asked their device for reduced motion.