2 ms·
If you like this kind of stuff you might also like this: http://obadger.com/turtle/ http://obadger.com/turtle/ Then paste/run this program: var triangle
by _greim_ 13y ago
If you like this kind of stuff you might also like this:
http://obadger.com/turtle/ http://obadger.com/turtle/
Then paste/run this program:
var triangle = (function(){
function frag(len, depth, left){
if (left === undefined) left = !(depth % 2);
if (depth > 1) {
frag(len/2, depth-1, !left);
t[left?'lt':'rt'](60);
frag(len/2, depth-1, left);
t[left?'lt':'rt'](60);
frag(len/2, depth-1, !left);
} else {
t.fd(len);
}
}
return frag;
})();
/* position the turtle */
t.pu().bk(250).rt(90).bk(350).pd().color('#0f0');
/* build the triangle */
triangle(700, 8);