20 December 2008

Falling Snow animation in flash


Step 1

Create a new flash document. Press Ctrl+J key on the keyboard (Document Properties) and set the dimensions of your document as whatever you like. Choose some kind of a dark color as background color. Set your Flash movie's frame rate to 27 and click ok.



Step 2

Take now the Oval Tool (O). In the Colors portion of the Tool panel, block the Stroke color by clicking on the little pencil icon and then on the small square with the red diagonal line. For Fill color choose white color and draw a "circle" about 4x4 px.



Step 3

While the circle is still selected, press F8 key (Convert to Symbol) to convert this circle into a Movie Clip Symbol.



Step 4

While the new made Movie Clip (circle) is still selected, go to the Properties Panel below the stage. On the left side, You will find the Instance name input field there. Call this Movie Clip "snow". See the picture below!



Step 5

Select the Selection Tool (V) and click once on the Movie Clip (circle) to select it. Then, go to the Action Script Panel (F9) and enter this code inside the actions panel:

onClipEvent (load) {
movieWidth = 350;
movieHeight = 263;

i = 1+Math.random()*2;
k = -Math.PI+Math.random()*Math.PI;

this._xscale = this._yscale=50+Math.random()*100;
this._alpha = 75+Math.random()*100;
this._x = -10+Math.random()*movieWidth;
this._y = -10+Math.random()*movieHeight;
}
onClipEvent (enterFrame) {
rad += (k/180)*Math.PI;
this._x -= Math.cos(rad);
this._y += i;
if (this._y>=movieHeight) {
this._y = -5;
}
if ((this._x>=movieWidth) || (this._x<=0)) { this._x = -10+Math.random()*movieWidth; this._y = -5; } } Step 6

Select now the first frame, go again to the Action Script Panel (F9) and enter this code inside the actions panel:

for (k=0; k<50;>Download example

No comments:

Post a Comment

Apply to be a Chitika Publisher!
Follow on Buzz