Programming turtle graphics: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 2: | Line 2: | ||
There is a predefined turtle object ''t''. Therefore, all commands | There is a predefined turtle object ''t''. Therefore, all commands | ||
start with ''t'', like ''t.fd(100)''; | start with ''t'', like ''t.fd(100)''; | ||
<source lang="javascript"> | |||
* t.forward(len); or t.fd(len); | * t.forward(len); or t.fd(len); | ||
* t.back(len); or t.bk(len); | * t.back(len); or t.bk(len); | ||
Line 16: | Line 17: | ||
* t.setPenSize(size); (size: number) | * t.setPenSize(size); (size: number) | ||
* t.setPenColor(col); (col: colorString, e.g. 'red' or '#ff0000') | * t.setPenColor(col); (col: colorString, e.g. 'red' or '#ff0000') | ||
</source> | |||
===Input=== | ===Input=== |
Revision as of 10:40, 21 December 2008
List of available commands
There is a predefined turtle object t. Therefore, all commands start with t, like t.fd(100);
* t.forward(len); or t.fd(len);
* t.back(len); or t.bk(len);
* t.right(angle); or t.rt(angle); (<math>0\leq angle \leq 360</math>)
* t.left(angle); or t.lt(angle);
* t.penUp(); or t.pu();
* t.penDown(); or t.pd();
* t.clearScreen(); or t.cs();
* t.clean();
* t.setPos(x,y);
* t.home();
* t.hideTurtle(); or t.ht();
* t.showTurtle(); or t.st();
* t.setPenSize(size); (size: number)
* t.setPenColor(col); (col: colorString, e.g. 'red' or '#ff0000')
Input
Output
Log window