Goal: Control a spiral´s angle, tightness, thickness, color, and size.
Vocabulary: make, setc (setcolor), setpensize
to spiral :length
make "length :length + howtight]
- Make the sliders shown on the project map. Set the minimum and maximums to the numbers indicated on the map.
- In the spiral procedure, setc whatcolor means, "Set the turtle's pen color to the number on the whatcolor slider."
- Setpensize howthick means, "Set the width of the turtle's pen to the number on the howthick slider."
- The number of line segments in the spiral is set by the #turns slider.
- This project uses a different method for increasing the length of the line segments. (We will not increase the setting on a slider as in Spirals 2 and 3.) We define the spiral procedure so that now it requires a number as input (just like fd requires a number as input):
to spiral :length
- Now we must supply a value to the spiral instruction on the spiral button.
Spiral 10 draws a spiral beginning with a line segment of length 10. (Choose another number if you like.)
fd :length uses the value of the the length input, given to the procedure, as a variable and moves the turtle forward the value of the length. (When length is worth 10, the turtle will move forward 10 steps.)
- Make "length :length + howtight means, "Make the variable with name length have as value the sum of the current value of length and the number on the howtight slider. That is, increase the value of length by howtight ." Be careful of the punctuation! "Length (preceded by a quotation mark) is the name of the variable, a word. :Length (preceded by a colon) is the value of the variable (in this case, a number).
Try different settings on the sliders to create spirals that are tight or loose, thin or thick, small or large, and so on.
Can you make spirals of different angles and tightness that fill the page without "wrapping" over the edge? Keep track of what works.
On Your Own - Project Ideas
Make a spiral slideshow, using one of the methods from the Squares folder (Squares 6 or 7). And if you want a simpler example of savepict take a look at Squares 5.