Tom's JavaScript Machine

[ Machine with Turtle Graphics | Instructions | TG Examples | JavaScript Basics | About ]

Summary of Pseudo-3D Turtle Graphics Commands

These extensions are available in Tom's JavaScript Machine with Turtle Graphics.

There is no further documentation other than in the source file and some test code.

WhatHowRemarks
Create a new turtle
var t = new TurtleGraphics.Turtle();
It starts in the center of the canvas heading to the right.
Put turtle in initial state
t.Home();
Clean the canvas
t.Clean();
t.Clean(c);
c is a CSS color code, e.g. 'white'
Change pen state
t.PenActive(b);
t.PA(b);
b is a boolean: false or true
Pen down (active)
t.PenDown();
t.PD();
Pen up (inactive)
t.PenUp();
t.PU();
Set pen width
t.SetPenWidth(w);
Default width is 2 pixels
Set pen style
t.SetPenStyle(c);
c is a CSS color code; default is 'black'
Move turtle forward
t.Move(d);
t.M(d);
Distance d can be negative
Turn (yaw) turtle left
t.Turn(phi);
t.T(phi);
Angle phi (in degrees) can be negative
Roll turtle clockwise
t.Roll(psi);
t.R(psi);
Angle psi (in degrees) can be negative
Dive (pitch) turtle down
t.Dive(theta);
t.D(theta);
Angle theta (in degrees) can be negative
Segment
t.Segment(d, psi, phi);
t.S(d, psi, phi);
Abbeviations for t.M(d); t.R(psi); t.T(phi);
Draw turtle
t.DrawTurtle(c);
t.DT(c);
c is a CSS color code, e.g. 'blue' or '#FFD700'

Valid HTML 4.01 Transitional

©2009-2010, Tom Verhoeff (TU/e)
Feedback about this page is welcome