xxxxxxxxxx
21
/*
this sketch draws a group of horizontal lines to the canvas.
add a conditional that makes every other line red.
*/
function setup() {
createCanvas(600, 600);
strokeWeight(10);
background(255);
}
function draw() {
for (let i = 0; i <= 10; i++) {
stroke(0);
line(0, 59 * i + 5, width, 59 * i + 5);
if (i % 2 == 0) {
stroke(255, 0, 0);
}
line(0, 59 * i + 5, width, 59 * i + 5);
}
}