MCPcopy Create free account
hub / github.com/aosabook/500lines / drawTurtle

Function drawTurtle

blockcode/code/turtle.js:37–50  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35 function deg2rad(degrees){ return DEGREE * degrees; }
36
37 function drawTurtle(){
38 var userPen = pen; // save pen state
39 if (visible){
40 penUp(); _moveForward(5); penDown();
41 _turn(-150); _moveForward(12);
42 _turn(-120); _moveForward(12);
43 _turn(-120); _moveForward(12);
44 _turn(30);
45 penUp(); _moveForward(-5);
46 if (userPen){
47 penDown(); // restore pen state
48 }
49 }
50 }
51
52 function drawCircle(radius){
53 // Math for this is from http://www.mathopenref.com/polygonradius.html

Callers 1

turtle.jsFile · 0.85

Calls 4

penUpFunction · 0.85
_moveForwardFunction · 0.85
penDownFunction · 0.85
_turnFunction · 0.85

Tested by

no test coverage detected