Naturally, after seeing so many sites with mediocre falling snow
effects, you might be wondering, "Where can I learn to create some
real falling snow?". Aside from living through a snow storm, this
tutorial is the closest thing you will get to real snow on your
computer.
The following animation shows what you will create by the end of this
tutorial:
|
|
|
[ would you believe that the
above animation is only 1k in size ] |
Unlike many other cool effects, you
don't have to use a blank animation to apply the snow flakes. Open any
animation that wish you apply the effect to. I will be creating a
blank movie for tutorial purposes.
Here is how to add random
snowflakes:
- Create a
new movie or open an existing movie. Insert another layer in your
main timeline and label the layer, "snow".
[ your timeline should look similar to this image ]
-
You now need to create one snowflake in your snow layer. If
you cannot create a snowflake at this moment, simply draw a circle
or another object. Alternatively, can choose to download snowflake
graphics and incorporating them into your flash animation from the
following URL:
http://dgl.microsoft.com/
-
I went ahead and used a snowflake. Make sure whatever you choose
to create is small enough to look somewhat like a small object
falling and hitting the ground. I will refer to snowflakes instead
of "strange falling objects" throughout this tutorial.
Ensure that the snowflake you created is above the actual movie.
You don't want the snowflake to be visible in your main movie when
viewed in Flash:
[ the snowflake is located above the
actual movie ]
-
Select the snowflake and press F8. From the Symbol Properties
dialog box that appears, select Movie Clip. (Mac users go to
Insert | Convert To Symbol). Once the snowflake has been converted
into a movie clip, copy the movie clip and paste it a few units to
your right:
[ copy and paste the snowflake movie
clip]
-
Right click on the snowflake on your far left and select Actions.
The Object Actions dialog box will display. Copy and paste the
following code into the Actions box:
[ copy and paste the above code in
the Object Actions dialog box ]
-
Now that you have the above code added, close the Object Actions
dialog box. Select the snowflake movie clip on the right. Once the
snowflake movie clip on the right has been selected, select the
Instance panel and give it the name "snowFlake":
[ name the snowflake movie clip on
the right to snowFlake ]
-
Once you named that movie clip 'snowFlake', it is time to add some
actions to that movie clip. Right click on that movie clip and
select Actions. The Object Actions dialog box will appear again.
Copy and paste the following code:
[ copy and paste the above code in
the Object Actions dialog box ]
-
That is all there is to this effect. Save the FLA and preview the
animation in your browser. You should see snowflakes appear.
Customizing the Code
While the movement is random, just like life,
there are certain boundaries. The only boundary you will encounter
in this movie is the width of your movie. You would want to have
snowflakes to appear at sometime during the full width of your
movie.
// this
random number sets a random x location for the new snowFlake and sets
y location at -10
this._x
= random(300);
Change the value in the parentheses to
reflect the width of your movie. For example, my movie's width was 300
pixels, so I entered 300 as the value under random. You can change the
value to reflect whatever your movie's width is.
Downloads
These few sentences
conclude the tutorial on creating the snow effect. Right click on File
and select Save Target As and save to your hard drive before
opening. The Actions window does not work properly when viewed without
downloading the file to the hard drive first.
Conclusion
I'd like to thank upuaut8,
who gave me permission to use his original FLA and source code. If you
ever post on the forums, there is a good chance that upuaut8 replied.
The original post can still be found by clicking
here. You can also visit his really cool site by going
to the following URL:
http://www.centerspin.com
[../../pages/me.htm]
|