home/ atoms/ palette-cycle

A cosine/gradient palette defines a whole color ramp from a few coefficients and animates it by shifting phase over time

A cosine palette (the iq formula) encodes an entire color ramp as a few coefficient vectors rather than a list of stops: each RGB channel is a cosine of position with its own amplitude, frequency, and phase. This is compact and continuous, so any position along the ramp resolves to a color. Because a phase term is built in, advancing the phase over time cycles the whole palette (palette-cycle), producing smooth animated color drift without re-authoring stops. This is why gradient/cosine palettes are the default way to both define and animate color in shader visuals.

Examples

A single cosine-palette function maps luminance or a coordinate to color; adding u_time to the phase term scrolls the entire ramp, cycling hues over time.

Assessment

Explain how a cosine palette represents a full ramp from a few coefficients and describe the single change that turns a static ramp into an animated palette cycle.

“**Cosine/gradient palettes** (`palette-cycle`, the iq cosine-palette formula): a compact way to define a whole ramp from a few coefficients, and to animate it by shifting phase over time.”
context/ · L2-composer/visual/color.md · chunk 1