We present a versatile custom AS3 RainDisplay class which allows for the creation of a variety of 2D raindrops animations. The raindrops splash upon impact with the ground. Below, we show two examples to illustrate the basic use of the RainDisplay class. Click on the images below to open the demos.
- Download the source files: rain.zip
All the source files in the package are well-commented. There are some interesting aspects to the code in this tutorial: the use of linked lists and a "recycle bin" for increased efficiency, and an animation technique which involves drawing to a bitmap and using filters to create the appearance of smooth motion. With an easy change of parameters, a different effect can be obtained as in the next example.
On the next page, we discuss the custom AS3 classes behind the examples.