xxxxxxxxxx
23
function turtle() {
background(0);
resetMatrix();
translate(width / 2, height);
noFill();
stroke(random(45), random(150, 255), random(35));
for (let i = 0; i < sentence.length; i++) {
let current = sentence.charAt(i);
if (current == "F") {
line(0, 0, 0, -len);
translate(0, -len);
} else if (current == "+") {
rotate(angle);
} else if (current == "-") {
rotate(-angle);
} else if (current == "[") {
push();
} else if (current == "]") {
pop();
}
}
}