Académique Documents
Professionnel Documents
Culture Documents
<body>
</body>
</html>
javascript
function turtle(){
background(51);
resetMatrix();
translate(width / 2,height);
stroke(255);
for(var i = 0;i < sentence.length ;i++)
{
var current = sentence.charAt(i);
if(current == "F"){
line(0,0,0, -len);
translate(0, -len);
}else if(current == "+") {
rotate(PI/6);
}else if(current == "-") {
rotate(-PI/6);
}else if(current == "[") {
push();
}else if(current == "]") {
pop();
}
}
}
function refresh() {
window.open("file:///C:/Users/Andrei%20cotofrei/Downloads/planta/index.html");
close();
}
function setup() {
createCanvas(800, 600);
background(51);
turtle();
createP("I recomand pressing only 6 times");
var button = createButton("generate");
button.mousePressed(generate);
var button = createButton("refresh");
button.mousePressed(refresh);