Q+A

<aside> 🧟 Put your two questions here. Please include your [name.](<http://name.Is>)

</aside>

  1. When drawing using turtle graphics does the entire sketch have to be drawn on one path or could I tell the pen to start a new path to draw? From the examples it looks like once you set the pen down it has to draw until the sketch is done. (John Kim)

you can call penUp and penDown whenever you like. and the turtle library i wrote is just a few functions that use p5.js so you can still do anything from p5.js you want

  1. It looks like with turtle graphics you can draw simple shapes and patterns quite easily. Can using turtle help with drawing complex shapes as well? (John Kim)

yes. for example turtles are very often used to make very complicated "spirographs" and trees

  1. Would you ever create a sketch that draws shapes using both regular p5 syntax and turtle graphics syntax? Or is it a bad idea/would that even work? (Keren Mevorach)

it is a good idea, it would even work.

  1. I saw that some of the examples in the chapter use random. Can you use noise with turtle graphics? (Keren Mevorach)

totes

  1. Looking at the examples, it seems like turtle graphics are well suited to creating organic and symmetrical shapes. Are these the most common reasons one would use turtle graphics? What do you like to consider before deciding to use turtle graphics? (Brian Lau)

the chapter shows drawing a square and star both with and without turtles. some things are more easily expressed with turtles, other's are not.

  1. Are there other popular graphics APIs like turtle graphics that require a shift in how you think about drawing (i.e. a departure from the Cartesian coordinate system)? I'm curious about other tools that would encourage this shift of priorities for more varied/unexpected drawing results. (Brian Lau)

the first common and somewhat related idea that comes to mind is "polar coordinates".

How exactly do the pushState() and popState() work? Are they exactly like push() and pop() in p5? (Isha)

they work by making a copy of the current turtle properties (position, angle, pen state) and "pushing" them onto a "stack", when you later call popState() the "top" of the stack is copied back to the turtle properties, and then discarded

it works very much like push and pop in p5.js, put the state that is being recorded is different

Turtles are good for drawing repeating lines or motifs, or shapes that follow an equation. Under what conditions would they be good for less parametric graphics or art, which is more hard coded? (Isha)