/*https://editor.p5js.org/p5/sketches/Color:_Radial_Gradient
* @name Radial Gradient
* @description Draws a series of concentric circles to create a gradient
* from one color to another.
*/
let dim;
function setup() {
createCanvas(710, 400);
dim = width / 2;
background(0);
colorMode(HSB, 360, 100, 100);
noStroke();
ellipseMode(RADIUS);
frameRate(1);
}
function draw() {
background(0);
for (let x = 0; x <= width; x += dim) {
drawGradient(x, height / 2);
}
}
function drawGradient(x, y) {
let radius = dim / 2;
let h = random(0, 360);
for (let r = radius; r > 0; --r) {
fill(h, 90, 90);
ellipse(x, y, r, r);
h = (h + 1) % 360;
}
}