Project Folders
Teacher Resources
Student Resources
How Do I?
Site Map
Our Team

spirals 1 2 3 4 5 6 7 8 9
Spirals Expert 7
12 KB

Goal:   Change conditions at intervals.


Vocabulary:   color, pensize

Project Map

to changing_spiral
make "count 1
setc whatcolor
setpensize howthick
spiral 10 110

to spiral :length :pitch
if :length > howbig [stop]
make "count :count + 1
if :count > interval
[setc color + 1
setpensize pensize + 1
make "count 1]
fd :length rt angle
carefully [note :pitch 3] [ ]
spiral :length + howtight :pitch - 1

to reset


In this project, the color and line thickness change only at intervals which we set with the interval slider.  

  1. We will use a new variable called count to keep track of the intervals.   We need to give count a starting value of 1.   So this project uses a new procedure called changing_spiral to set the starting values of count, color, and pensize.   Then it calls the spiral procedure (which has two inputs in this project).

  2. When the value of count becomes greater than the number on the interval slider, three things happen:

    setc color + 1 means: increase the turtle's color by 1;
    setpensize pensize + 1 means: increase the line thickness by 1;
    make "count 1 resets the value of the variable called count to 1.

    So while length and note change every time spiral is called, the color and line thickness change only at the interval set on the interval slider.

What If?
Try different settings on the interval slider.  

Can you modify the project so that the angle changes size at intervals? "At intervals" means: if the interval slider is set to 4, then the angle should only change once in every four repetitions (See Squares 6.)  

On Your Own - Project Ideas
Can you modify the project so that color and line thickness change at different intervals, rather than at the same time? (Hints: this might involve a second counting variable and a second interval slider.   Be sure to give them different names.)

© copyright 2001 - 2016  OpenWorld Learning.   All rights reserved.