xxxxxxxxxx
25
function setup() {
createCanvas(400, 400);
// Use the HSB color mode.
colorMode(HSB, 360, 100, 100);
}
function draw() {
for (let x = 0; x < width; x += 1) {
// Set the hue value to 0 (red).
let h = 0;
// Map the x-coordinate to the saturation value.
let s = map(x, 0, width, 0, 100);
// Set brightness value to 100.
let b = 100;
// Set the stroke color.
stroke(h, s, b);
// Draw a vertical line.
line(x, 0, x, height);
}
}