Methods
backward(steps)
Move the turtle backwards without painting
Parameters:
Name | Type | Description |
---|---|---|
steps |
number
|
the number of steps to move |
color(c)
Sets the color of the pen
Parameters:
Name | Type | Description |
---|---|---|
c |
Color
|
a P5js valid color |
drawLSystem(ls, step, angle)
Draws an L-System based on default values.
The turtle knows how to draw certain types of LSystems
F means forward with pen down
f means fordward with pen up
X or any other letter pass.
[ push
] pop
+ turn right
- turn left
F means forward with pen down
f means fordward with pen up
X or any other letter pass.
[ push
] pop
+ turn right
- turn left
Parameters:
Name | Type | Description |
---|---|---|
ls |
LSystem
|
the LSystem to draw |
step |
number
|
the size of the step |
angle |
number
|
the angle of turns |
drawString(string, step, angle)
Draw a string (used by drawLSystem)
Parameters:
Name | Type | Description |
---|---|---|
string |
string
|
|
step |
number
|
|
angle |
number
|
forward(steps)
Move the turtle forward
Parameters:
Name | Type | Description |
---|---|---|
steps |
number
|
the number of steps to move forward |
hd(heading)
Set heading of turtle East=0, CW
Parameters:
Name | Type | Description |
---|---|---|
heading |
number
|
the heading of the turtle |
left(rot)
Rotate the turtlo to its left by certain degrees
Parameters:
Name | Type | Description |
---|---|---|
rot |
number
|
angle to rotate in degrees |
pop()
Reverts to previous saved state of the turtle removing it from the stack
pos(x, y)
Set turtle position in coordinate system
Parameters:
Name | Type | Description |
---|---|---|
x |
number
|
the X position |
y |
number
|
the Y position |
right(rot)
Rotate the turtle to its right by certain degrees
Parameters:
Name | Type | Description |
---|---|---|
rot |
number
|
angle to rotate in degrees |
style(weight)
Set the weight of the pen
Parameters:
Name | Type | Description |
---|---|---|
weight |
number
|
the weight of the pen |