
previous

page 5
next
Let me really blow your mind with the few tools now at our disposal.
Give spirals() a whirl!
function spirals(angle=75) {
cs(); home();
spiral(angle); angle++;
if (angle<145) setTimeout(spirals,500,angle);
}
cs(); home();
spiral(angle); angle++;
if (angle<145) setTimeout(spirals,500,angle);
}
Back to Basics
The first task that is usually given to Turtle Graphics beginners is draw a square of side 100. Have a go before clicking here to reveal my work.
function square(d=100) {
for (var i=0; i<4; i++) { fd(d); rt(90);}
}
function test() {
square();
}
for (var i=0; i<4; i++) { fd(d); rt(90);}
}
function test() {
square();
}
Not quite so easy is draw a triangle with each side 100. Have a go before clicking here to reveal my work.
function triangle(d=100) {
for (var i=0; i<3; i++) { fd(d); rt(120);}
}
function test() {
triangle();
}
for (var i=0; i<3; i++) { fd(d); rt(120);}
}
function test() {
triangle();
}
previous
next