axi0motion

Grain gradient

Flowing grainy gradients that the pointer stirs like paint.

  • element
  • webgl
  • pointer
  • background
  • gradient
  • grain
  • since 0.2

Background Studio: tune it below, then copy the code

Your system asks for reduced motion: the demo shows its final state and nothing moves.

Live demo

Grain gradient example

Controls

0.09
1
1

Code

It follows the controls above: change an option and the code changes with it.

<link rel="stylesheet" href="/axi0/motion/motion.css?v=6">
<script src="/axi0/motion/motion.js?v=10" defer></script>

<axi0-grain-gradient cover></axi0-grain-gradient>

The wrappers: GrainGradient.tsx (React, TypeScript) and GrainGradient.vue (Vue). Both render the same attributes as the HTML; the loader does the rest.

Options

AttributeDefaultWhat it does
colors#ff9a5a,#ff5f8f,#7c6cff,#1c1640four colors that flow into each other
grain0.09how strong the grain is (0 = smooth)
speed1how fast the colors flow
stir1how much the pointer swirls the colors
coverfalsefill the nearest positioned parent, behind its content

Accessibility

Decorative and opaque: put text on it only with enough contrast against all four colors. The canvas is hidden from screen readers and takes no pointer events. Frames run only on screen in a visible tab. Reduced motion: one still frame. Without WebGL a plain gradient of the same colors stands in.

Size

grain-gradient.js is 1.3 KB gzip, with gl.js 2.1 KB it needs. A page loads the loader (2.7 KB) and core.js (1.4 KB) once, whatever it uses.