xxxxxxxxxx
32
// function setup() {
// createCanvas(400, 400);
// for(let i=0;i<8;i++){
// for(let j=0;j<40;j++){
// noStroke();
// fill(random(["blue","aqua","deepskyblue","royalblue"]));
// rect(i*50,j*10,50,10);
// }
// // function draw() {
// // background(0);
// // }
// }
// }
function setup() {
createCanvas(400, 400);
}
function draw() {
background(0);
let color1 = color(255, 0, 0);
let color2 = color(0, 0, 255);
for (let i = 0; i < width+20; i+=40) {
let gradientColor = lerpColor(color1, color2, i / width);
stroke(gradientColor);
strokeWeight(40);
line(i, 0, i*2, height);
}
}