Rainbow Twist Algorithm

The Rainbow Twist is a mathematical entrainment, a harmony of colors and chaos, where the spectra intersect and overlap on an infinite tape. The core function, twirl(n), employs recursive color mapping to emulate the elusive edge between order and randomness.

function twirl(rainbow, depth) {
    if (depth === 0) return rainbow;
    let newRainbow = rainbow.map(c => shiftHue(c, 42));
    return twirl(newRainbow, depth - 1);
}

function shiftHue(color, degrees) {
    let hsl = rgbToHsl(color);
    hsl[0] = (hsl[0] + degrees / 360) % 1;
    return hslToRgb(hsl);
}
    

This algorithm does not end. Like a Möbius loop, it curls and contorts beyond the horizon of perception, spiraling inward and outward. The recursion depth, a mere parameter, holds dominion over infinity, yet it is finite in scope.

Beyond the linear and temporal, where does the twist stop? Only to be found in another room, in another path. Examine hue-fold.html if you dare, or delve deeper into shadow-grid.html.