LiquidPremium

Wave Surface

Three layers of CSS SVG waves — blue, indigo, cyan — scrolling along the bottom of the frame at three speeds (6, 8 and 10 s per loop), one of them backwards: a sea with depth, no image and no JavaScript, 2.6 KB, still when the user reduces motion.

CSSSVGLayers

Updated

This effect is part of Effect.Labs — 846 vanilla effects, some free, some premium. Liquid has 31 effects, including 6 free. Explore the category →

3 usage examples

Today's specials at a beach shack — the screen above the counter — Wave Surface example 1

① Today's specials at a beach shack — the screen above the counter

WhenDuring lunch service, the screen above the counter shows the day's dishes — mussels and fries, grilled sardines, homemade ice cream — and their prices; the sea scrolls along the bottom.
WhyThe layers gliding at the bottom leave the whole top free for the menu; the parallax gives the swell without ever passing under the text.
SettingsRoot placed at the bottom of the frame, 150 px container with a transparent background (the dark chalkboard stays visible); original layers, colors and speeds; handwritten-style menu above.
River level at the bridge gauge — a river authority's alert bulletin — Wave Surface example 2

② River level at the bridge gauge — a river authority's alert bulletin

WhenThe 7 am bulletin reads "2.84 m — yellow alert"; behind the number, the water rises to the gauge mark, a yellow dashed line.
WhyThe waves' height is set by their container's height: the animated surface becomes a gauge you read at a glance.
Settings250 px container with a transparent background; the blue wave's average surface (55% of the height) falls on the 2.84 m mark of a 50 px-per-meter scale; 46 px number, yellow pill, "+6 cm in 3 h" trend.
Today's beach info — the footer of a seaside resort's website — Wave Surface example 3

③ Today's beach info — the footer of a seaside resort's website

WhenAt the bottom of every page: green flag, water at 19 °C, high tide at 4:42 pm, then the useful links; the waves scroll under the links.
WhyA light effect (pure CSS, no image) that closes the page on the sea without getting in the way of the links above.
SettingsA 96 px sand band for the day's info, a midnight-blue footer (#0a2a3d); 165 px container with a transparent background; update note set on the waves with a drop shadow.

How it works

The .wave-container (full width, 300 px tall through its inline style, overflow: hidden, a night background #0a1628 → #1a1a2e) holds three stacked .waves, pinned to the bottom, as tall as the container and twice as wide (width: 200%). Each one is painted with an SVG data URI: a wave path closed down to the bottom, repeated across on a 50% 100% tile, i.e. exactly the container's width. The fx0398WaveMove animation shifts the layer from 0 to −50% of its width: one whole tile per loop, so the loop restarts with no jump.

The three layers differ by color, opacity and pace. In front, the blue wave (#0099ff at 30%) loops in 8 s; the second, indigo (#6366f1 at 40%, layer at 50%), in 6 s and backwards (animation-direction: reverse); the third, cyan (#06b6d4 at 50%, layer at 30%), in 10 s. In a 640 px frame that makes 80, 107 and 64 px per second: the surfaces cross and overlap without ever lining up. Layers 2 and 3 are raised by 10 and 20 px (bottom): three edges stack at the bottom, like seabeds of different colors.

Each SVG declares preserveAspectRatio='none': the drawing (1440 × 320) stretches over the whole tile, whatever the frame's shape, and the sea reaches the bottom. The consequence is the rule to remember: the container's height sets the waves' height. The blue wave's surface ripples between 40 and 70% of that height, the indigo one rises to 22%; a 150 px container gives a low swell, a 400 px container a high sea. Each path ends at the height where it starts, with a similar slope: the seam between two tiles does not show. Every rule is scoped by the .fx-0398-root root and the animation has a name of its own, so .waves elsewhere on the page are left alone.

Accessibility

  • Reduced motion: under prefers-reduced-motion: reduce, the three layers stop (animation: none) and stay stacked: the sea is there, still. Measured in Chromium 151, Firefox 153 and WebKit 26: 0% of pixels changing in 500 ms, against 19% in normal mode.
  • Decoration: the waves are CSS backgrounds, with no text and no role; screen readers ignore them. If the water level carries information (a reading, a gauge), write it as text next to it, as the examples do.
  • Readability: the waves are translucent and dark (15 to 30% effective opacity). White text placed on them keeps good contrast on the original night background; on a light background, darken the path colors or put the text above the sea.

Browser compatibility

Pure CSS (a transform animation, an SVG data URI background), 2.6 KB, no dependency. Measured in Chromium 151, Firefox 153 and WebKit 26: same scrolling of the three layers, same stop under reduced motion. Only transform is animated: the browser moves already-painted layers without redrawing the waves, so the cost stays low even at full width.

Chrome 43+✓ Full
Firefox 16+✓ Full
Safari 9+✓ Full
Edge 12+✓ Full
Mobile iOS 9+✓ Full
Android Chrome 43+✓ Full

Without CSS animations, the three waves stay still and stacked: the sea backdrop is intact. The container gets its height from its inline style (min-height: 300px): if you remove it, give it a height in your CSS, otherwise the absolutely positioned waves have no room.

The code

HTML structure to paste into your page (the CSS + JS come with your purchase):

index.html — structure
<div class="fx-0398-root">
  <div class="wave-container" style="width:100%;min-height:300px;">
    <div class="wave"></div>
    <div class="wave"></div>
    <div class="wave"></div>
  </div>
</div>

One-time payment, no subscription — the code is yours forever

Customize

Options passed to the API or data-* attributes:

Option / propertyDefaultEffect
Wave height (HTML/CSS — height of .wave-container) 300 px (inline min-height: 300px) This is the main setting: the paths stretch over the container's height. 120 to 160 px for a strip of sea at the bottom of a block; set it to a measured value to turn it into a gauge.
Speeds (CSS — animation-duration of the three .waves) 8 s, 6 s (backwards), 10 s Double all three (16 / 12 / 20 s) for a flat calm, halve them for a choppy sea. Keep the durations different: if they match, the layers move as one block and the depth disappears.
Colors (CSS — fill and fill-opacity in each SVG) %230099ff at 0.3, %236366f1 at 0.4, %2306b6d4 at 0.5 Turquoise and aqua for a lagoon, blue-gray for a northern sea. In a data URI, # is written %23.
Depth (CSS — opacity and bottom of layers 2 and 3) 0.5 and 0.3; raised by 10 and 20 px Higher opacities (0.8 / 0.6) make the back layers clearly visible; bottom: 0 everywhere removes the stacked edges at the bottom.
Background (CSS — background of .wave-container) linear-gradient(#0a1628, #1a1a2e) background: none lets the page's backdrop show behind the sea, as in the three examples.

FAQ

Change the container's height: the waves stretch over all of it thanks to preserveAspectRatio='none'. For a level that varies, write the height from your script (container.style.height = level + 'px') and add transition: height 1s to the container: the sea rises smoothly. Since the surface ripples between 40 and 70% of the height, put your mark around 55% so it falls in the middle of the front wave.
The paths are stretched to fill each tile, as wide and as tall as the container. In a wide, low frame the waves get longer; in a narrow, tall one they get deeper. That is what keeps the sea stuck to the bottom of the frame in every format. For waves of a fixed shape, give the container a constant ratio (aspect-ratio: 4 / 1).
Water Ripple is a water surface computed in a canvas (the wave equation on a height grid), where a click spawns circular ripples: interactive, heavier, in JavaScript. Wave Surface is a CSS backdrop with no interaction: three layers of waves scrolling along the bottom of a block. Choose Wave Surface for a footer background, a gauge or a banner; Water Ripple when visitors should touch the water.