Examples and Comments

We present four engaging AS3 animations based on mathematical patterns. Click each screen shot to open a Flash movie. Download source code from the link below.

Download

  • Download all source files corresponding to this effects: pflowers.zip

Download the zip package linked above for the complete, cutomizable source code.

Description of Animations

All four animations are instances of the custom FlowersDisplay AS3 class. They differ by the family of parametric curves that is used, coloring of the petals, and the ColorTransform that causes fading effects. Download the code from the link above to play and customize the code.

FlowersDisplay Class

The constructor of the class takes six parameters, all optional:

new FlowersDisplay(w:Number=600,h:Number=400,f:int=1,
                           rmin:Number=300,rmax:Number=600,d:int=76)

The parameters stand for: the width and the height of the display, the number of the family of curves that runs 1 to 4 as there are four preprogrammed families to choose from. If you are mathematically inclined, you can easily add more families. The paremeters rmin and rmax correspond to the minimum and the maximum radius of each flower. The radius is chosen randomly as each flower appears but rmin and rmax provide the range from which the radius is chosen. The last parameter is the delay (in number of frames) between two consecutive flowers to appear.

Each instance of FlowersDisplay has two public properties that determine the color of the background and the speed with which flowers fade:

backColor

Default: black.

fadeIndex

Default: 2. The higher fadeIndex, the slower fade.

How to Customize Color Effects

It becomes clear when you take a peek into the FlowersDisplay class. You can play with the property:

fadeCurves

This is the ColorTransform set in the constructor that causes fading of the flowers.

To change color schemes, look into the function

getColor

Related Tutorials

The most closely related is our recent tutorial:

Images of Math Curves - Create and Save.

You will find there another example how to use BitmapData.draw method to draw DisplayObjects to a Bitmap. This is the technique behind our animations.

Back to Flash CS4 Tutorials              Back to Flash and Math Home

We welcome your comments, suggestions, and contributions. Click the Contact Us link below and email one of us.

Adobe®, Flash®, ActionScript®, Flex® are registered trademarks of Adobe Systems Incorporated.