xxxxxxxxxx
17
/* My current sketch draws a blue line on the canvas. Help me draw a star sign as shown in the example image using a for loop and rotate() */
function setup() {
createCanvas(400, 400);
angleMode(DEGREES);
strokeWeight(4);
stroke(0, 0, 255);
}
function draw() {
background(220);
translate(width / 2, height / 2);
for (let i = 0; i < 5; i++) {
rotate(45 * i);
line(-40, -40, 40, 40);
}
}