xxxxxxxxxx
function setup() {
createCanvas(400, 400);
noLoop();
}
function draw() {
let color1 = color(255, 0, 0);
let color2 = color(0, 0, 255);
let numLines = width;
for (let i = 0; i < numLines; i++) {
let inter = map(i, 0, numLines - 1, 0, 1);
let c = lerpColor(color1, color2, inter);
stroke(c);
line(i, 0, i, height);
}
}