NetLogo banner

Home
Download
Help
Resources
Extensions
FAQ
NetLogo Publications
Contact Us
Donate

Models:
Library
Community
Modeling Commons

Beginners Interactive NetLogo Dictionary

User Manuals:
Web
Printable
Chinese
Czech
Farsi / Persian
Japanese
Spanish

  Donate

NetLogo Models Library:
Code Examples

(back to the library)

Shape Animation Example

[screen shot]

If you download the NetLogo application, this model is included. You can also Try running it in NetLogo Web

WHAT IS IT?

This code example shows how to use shapes to create animations. In this example, there is a walking person and growing flowers.

HOW IT WORKS

A counter is used to increment the shape to be used in each animation.

For the person, each progressive frame of the person walking has a different shape. There are 9 shapes total. Each progressive shape is numbered as person_#, where the # is one higher then the shape that came before. After final numbered shape (person_9), the shapes repeat from the start (person_1) and continue to cycle through the remaining shapes. The person is moved forward a small bit with each new shape, to give the illusion of walking.

For the flowers, each progressive frame of their growth shows the development of the flower from a small seedling to a fully grown flower. Each frame has a new shape. Each progressive shape is numbered as flower_#, where the # is one higher then the shape that came before. After final numbered shape (flower_16), the shapes stop incrementing and the flower is shown as fully grown.

NETLOGO FEATURES

The model has a frame rate setting of 15 frames per second, for smooth animation that isn't too fast. The speed can be further adjusted by the user using the speed slider.

(back to the NetLogo Models Library)