HSL / Hue Cycle

First appeared 1978 · Alvy Ray Smith — Cyclic hue rotation relies on the HSV/HSL colour model formalized by Alvy Ray Smith ("Color Gamut Transform Pairs", SIGGRAPH 1978); animated colour/palette cycling was a staple of 1980s–90s demo and games graphics. A diffuse technique with no single first. · timeline ↗

community / folk Name — Descriptive: cycling hue in the HSL colour space (Alvy Ray Smith, 1978). An index label for the technique, not a coined name.

In one line Generating rainbows and gradients by cycling hue around the colour wheel (HSL/HSV/Lab) as a function of position, index or time. The colouring behind Chromie Squiggle and many spectral palettes.

HSL / Hue Cycle · Open in new tab ↗ · Motion begins only when you press Run.

The code

The actual sketch behind the demo above — sandboxed and reproducible. This is the whole thing.

hsl-cycle/index.html
const SEED = Math.floor(Math.random()*1e9);

function setup() {
  randomSeed(SEED); noiseSeed(SEED);
  const s = Math.min(windowWidth, windowHeight);
  createCanvas(s, s);
  colorMode(HSB, 360, 100, 100);
  background(0, 0, 98);
  noStroke();

  // Chromie Squiggle inspired hue-cycle along a noise-perturbed path.
  const SEGMENTS = 60;
  const baseHue = random(360);
  const hueSpan = random([180, 240, 320]);
  const r = width * 0.05;
  let x = width * 0.1;
  let y = height * 0.5;
  for (let i = 0; i < SEGMENTS; i++) {
    const t = i / (SEGMENTS - 1);
    const h = (baseHue + t * hueSpan) % 360;
    fill(h, 80, 95);
    circle(x, y, r * 2);
    // Squiggle step: sine modulated by noise
    const phase = noise(i * 0.18) * TWO_PI;
    y += Math.sin(i * 0.5 + phase) * r * 0.55;
    x += r * 1.2;
  }
}

Open the demo source ↗

How it works

Work in a cylindrical colour space (HSL/HSV) where hue is an angle 0–360°: 1. Drive hue from a parameter — e.g. hue = (i / n)·360 across n elements, or (x + t)·k along the canvas/time — keeping saturation and lightness fixed (or on their own gentle curves). 2. Wrap hue modulo 360 so it loops seamlessly; the span and speed set how many rainbow cycles appear. 3. Convert HSL→RGB to draw. Using a perceptual space (Lab/OKLCH) or eased hue steps avoids the muddy/uneven bands that naive HSL can produce. Variations: offset hue per layer, reverse direction, or quantise hue to a few stops for banded palettes instead of smooth spectra.

Parameters

Lineage

Related
Audio-Reactive

Frequently combined with

Works using this algorithm (134)

70s Pop Series Two
daniel-catt
Ad Extremum Terrae
umatha
Aithérios
jorge-ledezma
AlphaModica
danooka
Amoeba
last-even
Ancient Courses of Fictional Rivers
robert-hodgin
Apparitions
aaron-penne
Arcadia
zachariah-watson
Augury
lovid
Automatism
yazid
Autoscope
erik-swahn
Avalon
r0zk0
Beauty in the Hurting
ryan-green
Being Yourself While Fitting In
lia
Bent
ippsketch
Breathe You
raregonzo
Bright
heeey
Brushpops
matty-mariansky
BUSIEST
james-merrill
BUSY
james-merrill
Buttons
jan-robert-leegte
Center Pivot
craig-hughes-eric-hughes
CENTURY 2052
casey-reas
Chromie Squiggle
snowfro
Color Magic Planets
bard-ionson
Color Study
jeff-davis
Construction Token
jeff-davis
CryptoCountries: The Unpublished Archives of a Mythical World Traveler
michael-g-devereux
Diggly Collects All
dca
[Dis]entanglement
onlygenerated
Dive
rafael-rozendaal
Divenire
emanuele-pasin
Dot Grid
theelephantnl
Dream Engine
remo-x-dcsan
Drawings for a Monument
jeff-davis
Ecumenopolis
joshua-bagley
Elevated Deconstructions
luxpris
Empyrean
generative-artworks
Ensō
matto
Faceless
greatjones
Fake Internet Money
steve-pikelny
Fernweh
oliveskin
Fleur
anapet
flora, fauna, false gods & floods
ryan-green
Flourish
sterling-crispin
Flowers
rvig
Fluiroso
sebastian-brocher-cryptoarte
Forecast
manuel-larino
Frammenti
stefano-contiero
Freehand
wawaa
Gazers
matt-kane
Gen 2
dca
Gen 3
dca
Getijde
bart-simons
GHOST IN THE CODE
kazuhiro-tanimoto
Gizmobotz
mark-cotton
Glass
eric-de-giuli
Good, Computer
dean-blacc
Good Vibrations
aluan-wang
Gravity Grid
eliya-stein

Last updated 2026-07-16