xxxxxxxxxx
function setup() {
createCanvas(600, 600);
//Set stroke weight
strokeWeight(2);
}
//Angle
let angle = 0;
//Space between lines
let lineSpacing = 15;
function draw() {
background(255);
//Vertical lines
for (let x = 0; x < width; x += lineSpacing) {
//Green
stroke(0, map(x, 0, width, 100, 255), 0);
//Draw line
line(x, 0, x, height);
}
push();
//2nd vertical lines
//Move to center
translate(width / 2, height / 2);
//Rotate
rotate(angle);
for (let x = 0; x < width; x += lineSpacing) {
//Purple
stroke(map(angle * 20, 0, TWO_PI, 100, 255), 0, map(angle * 20, 0, TWO_PI, 100, 255));
//Draw line
line(x - width / 2, -height / 2, x - width / 2, height / 2);
}
pop();
//Rotation angle
angle += 0.02;
}