Documentation
¶
Index ¶
- type Turtle
- func (t *Turtle) Backward(d float64)
- func (t *Turtle) BeginFill()
- func (t *Turtle) Circle(r float64)
- func (t *Turtle) Clear()
- func (t *Turtle) EndFill()
- func (t *Turtle) FillColor(c color.Color)
- func (t *Turtle) Forward(d float64)
- func (t *Turtle) GoTo(x, y float64)
- func (t *Turtle) Home()
- func (t *Turtle) Image() *image.RGBA
- func (t *Turtle) Left(deg float64)
- func (t *Turtle) PenDown()
- func (t *Turtle) PenUp()
- func (t *Turtle) Polygon(n int, side float64)
- func (t *Turtle) Rect(w, h float64)
- func (t *Turtle) Reset()
- func (t *Turtle) Right(deg float64)
- func (t *Turtle) SavePNG(filename string) error
- func (t *Turtle) SetColor(c color.Color)
- func (t *Turtle) SetHeading(deg float64)
- func (t *Turtle) SetWidth(w float64)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Turtle ¶
type Turtle struct {
W, H int
// contains filtered or unexported fields
}
func New ¶
New creates a new turtle with a W×H canvas and a background color. The turtle starts at (0,0) facing 0° (east), pen down, black ink, width 2px.
func (*Turtle) BeginFill ¶
func (t *Turtle) BeginFill()
BeginFill starts recording a polygon fill path
func (*Turtle) Clear ¶
func (t *Turtle) Clear()
Clear repaints the canvas with the background color but keeps turtle state.
func (*Turtle) Home ¶
func (t *Turtle) Home()
Go To (0, 0) and Reset Direction to 0 Degrees, Keeps the Canvas state.
func (*Turtle) Reset ¶
func (t *Turtle) Reset()
Reset clears the canvas and resets position/orientation/pen to defaults.
func (*Turtle) SetHeading ¶
Set Turtle's Rotation towards (deg) Degrees
Click to show internal directories.
Click to hide internal directories.