Turtle animation of the "8": Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 3: | Line 3: | ||
var t = brd.create('turtle',[0, 0], {}); | var t = brd.create('turtle',[0, 0], {}); | ||
t.setPenSize(3); | t.setPenSize(3); | ||
t.right(90); | |||
var alpha = 0; | |||
var run = function() { | var run = function() { | ||
t.fd(2); | t.fd(2); | ||
t. | if (Math.floor(alpha / 360) % 2) === 0) { | ||
t.left(1); | |||
} else { | |||
t.right(1); | |||
} | |||
alpha += 1; | |||
setTimeout(run,25); | setTimeout(run,25); | ||
} | } |