NetLogo banner

 Home
 Download
 Help
 Resources
 Extensions
 FAQ
 References
 Contact Us
 Donate

 Models:
 Library
 Community
 Modeling Commons

 User Manuals:
 Web
 Printable
 Chinese
 Czech
 Japanese

  Donate

NetLogo User Community Models

(back to the NetLogo User Community Models)

Spiranimator

by David Slauson (Submitted: 11/21/2014)

[screen shot]

Download Spiranimator
If clicking does not initiate a download, try right clicking or control clicking and choosing "Save" or "Download".

(You can also run this model in your browser, but we don't recommend it; details here.)

## Spiranimator - WHAT IS IT?

Spiranimator creates animated and somewhat hypnotic spiral patterns by making incremental changes while repeatedly drawing line segments.

After each spiral pattern is drawn the model waits briefly and then draws the pattern again, but from a slightly different starting angle. The result is an animated spiral pattern. Results are often surprising and sometimes quite artistic.

This is a simple model using a single turtle and thus provides a good starting point for learning to program with NetLogo. Despite its simplicity it produces interesting variations, even when settings are altered very slightly.

## HOW IT WORKS

It works by repeatedly:
- drawing a line of length len,
- turning left by an angle of t degrees,
- incrementing length len
And then doing it all over again.

## HOW TO USE IT

Simply press the "Start" button to run the model. It will continue to run animated patterns until the number of iterations is reached, or until you flip the "halt?" switch on.

ADJUSTING MODEL SETTINGS:

Set the "turn-angle" by using the slider control. Different turn-angles will produce wildly varying results. For example, some interesting spiral patterns are generated using turn-angles of 91, 133, 158, 165, 166, 170, 238, or 239 degrees.

Set the number of line segments to draw using the "num-lines" slider control. Settings between 130 and 160 will generally produce interesting results. When num-lines is set very high, you may begin to see the line-segments begin to 'wrap' as they increase in size with each iteration; this can also result in some interesting effects, but can sometimes get overly cluttered. Adjust to taste for particular setting combinations.

The "increment" control sets how much the line-segment length changes with each iteration. The larger the number, the coarser the change with each iteration. In general, a setting of 0.1 or 0.2 should work well for most model runs.

The "color-num" control sets the line color. If "colors?" is switched on, then it sets the starting line color used before color shifting begins. A color-num of 8 (white) or 45 (yellow) will work well as a default value.

While switching "colors?" on can often result in very pretty kaleidoscopic displays, it is often easier to see the resulting cross-hatched patterns when using a non-shifted single color (i.e. with "colors?" switched to off).

## THINGS TO TRY

Smooth animation of the model can depend on several factors:

1) How fast your computer is, and how much memory is available. NOTE: it was developed on a MacBook Pro with a 2.8GHz Intel Core i5 dual core processor and 8GB RAM. This runs the default model quite smoothly. Slower machines with less memory may run less smoothly.
2) The number of lines [ the "num-lines" setting] used. Increasing num-lines will slow the model.
3) The "increment" setting. The default setting of 0.2 worked well on the development system. Lowering this number will result in a 'finer-grained' drawing, but may also result in more flicker.

BE SURE TO TRY THE FOLLOWING:

Try experimenting with speed slider control at the top of the application window. Using the "normal" speed setting or slightly higher generally results in smooth animation on the original development system.

If you want to understand how the spiral patterns and 'meta-patterns' evolve from drawing simple line-segments, try setting the speed slider control much lower.

## THINGS TO NOTICE

Pronounced differences result from small changes in the "turn-angle" setting. Observe the difference, for example, between a turn-angle of 165 and 166.

Results tend to become more interesting as the turn-angle approaches or exceeds 90 degrees, as the ever-growing line segments turn back on themselves.

Turn-angle settings below 90 will generally produce less interesting results. As the turn-angle lowers and the turns become more open you may want to lower the number of line segments.

Certain turn-angle settings (e.g. 90, 120, 144, etc) will produce distinctly non-spiral-ish results. This is understandable when you think carefully about the angles involved and their effect on the line-drawing algorithm used.

## EXTENDING THE MODEL

Consider:
- decrementing as well as incrementing line length
- shifting the turn-angle while running
- experimenting with different line-widths
- shifting colors in varying ways as the model runs
- further altering the line-increment amounts
- adding turtles for overlapping/intersecting patterns

## CREDITS AND REFERENCES

Created by David Slauson.

(back to the NetLogo User Community Models)