Ambient Website Background Clouds

Hacker News Top Tools

Summary

background-clouds is a lightweight, dependency-free JavaScript library that renders an animated low-poly cloud bank behind a website using a single canvas, with support for reduced motion and SPA lifecycle methods.

No content available
Original Article
View Cached Full Text

Cached at: 07/15/26, 04:39 AM

paradise-runner/background-clouds

Source: https://github.com/paradise-runner/background-clouds

background-clouds

background-clouds adds a lightweight, animated low-poly cloud bank behind a website. It uses a single canvas, has no runtime dependencies, pauses motion when the user prefers reduced motion, and exposes lifecycle methods for single-page apps.

Animated low-poly cloud background

Install

npm install background-clouds

Use

import { createCloudBackground } from "background-clouds";

const clouds = createCloudBackground({
  canvas: document.querySelector("#background-clouds"),
  seed: "my-site",
  speed: 0.8,
  opacity: 0.9
});

// Later, for example when unmounting a route:
clouds.destroy();
<canvas id="background-clouds" aria-hidden="true"></canvas>
#background-clouds {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
}

The canvas must be available before calling createCloudBackground. The returned controller has start(), stop(), resize(), setSeed(seed), and destroy() methods. seed may be a string or number; using the same seed produces the same cloud layout. speed and opacity default to 1 and accept non-negative numbers.

Options

OptionDefaultDescription
canvasrequiredThe <canvas> element to render into.
seedrandomA stable string or number for deterministic cloud placement.
speed1Drift multiplier. Set to 0 for still clouds.
opacity1Overall cloud opacity multiplier.
pixelRatio2Maximum device-pixel ratio used for rendering.
reducedMotionmedia querySet explicitly to override prefers-reduced-motion.

The package owns only the canvas pixels. Set the canvas’s stacking order, background color, and positioning in your site CSS.

Similar Articles

CSS-Native Parallax Effect

Hacker News Top

A CSS-native parallax effect using scroll-driven animation timelines, providing a performant and simple utility class with no JavaScript.

Show HN: A CSS 3D Engine (no WebGL)

Hacker News Top

PolyCSS is a CSS polygon mesh library that renders 3D models as real HTML elements using CSS matrix3d, supporting OBJ/MTL, GLB, and VOX formats with React, Vue, or vanilla JS.

@VincentLogic: In the past, when doing frontend work, I used to either hunt around for GIFs or write CSS until my head ached just to create a loading animation. Recently I came across this open-source library math-curve-loaders, which generates animations purely using mathematical formulas. I took a look — rose curves, Lissajous curves, and other mathematical figures produce extremely elegant animations. Pure HT…

X AI KOLs Timeline

Introduces an open-source frontend library called math-curve-loaders that utilizes mathematical formulas (such as rose curves and Lissajous curves) to generate elegant loading animations. It is implemented purely with HTML+CSS, has zero dependencies, and comes with a visual debugging panel that allows real-time parameter adjustments and one-click code copying.