Javascript Turtle Graphics

Language Reference

forward(distance)
right(angle)
left(angle)
goto(x,y)
clear()
penup()
pendown()
reset()
angle(angle)
width(width)
colour(r,g,b,a)
write(string)
n = random(low,high)
hideTurtle()
showTurtle()
redrawOnMove(bool)
draw()
repeat(n, action)
wrap(bool)
animate(action,ms)
See some other examples

Canvas

Command


Definitions

// Define helper functions here. // For example: function square(side) { repeat(4, function () { forward(side); right(90); }); } function demo() { hideTurtle(); colour(0,0,255,1); for(s = 100; s > 0; s -= 10) { square(s); right(36); } }