.
Growing cloud engine with actionscript 3
Hi I have been playing a lot with different ways to produce smoke and clouds these days, both on frame by frame animations and like actionscript engines.
So here I just made a simple growing cloud particle system with flash actionscript 3.0, and Im going to explain to you how you can make your own animated clouds with flash.
First we need to make one movie clip containing a cloud graphic, to work with, its quite simple just use the brush tool and draw a shape like I did below.

Right click and convert it into a movie clip, then go to the filters panel and add a blur filter with these settings

Now we need to give this cloud an instance name, I named mine cloud_mc.
That we all the particle stuff, now we need only need the technical stuff, by that I mean the actionscript coding, so open up your actionscript panel and past this code into it.
The growing speed variable
var yspeed:Number = (Math.random() * 0.8);
Here we set the clouds start properties such as position, rotation start and alpha.
setCloudProperties();
function setCloudProperties():void {
cloud_mc.alpha = 100;
cloud_mc.x = 141;
cloud_mc.y = 180;
cloud_mc.rotation = Math.random() *360;
}
// An eventlistener to make the cloud grow. (remember to set this outside the function).
cloud_mc.addEventListener(Event.ENTER_FRAME, doCloud);
This is all it take to make the cloud engine work and generate some random shape and growth and rotations.
function doCloud(event:Event):void {
cloud_mc.alpha -= 0.3;
if (cloud_mc.alpha<50) {
cloud_mc.alpha -= 0.4;
}
if (cloud_mc.alpha<1) {
setCloudProperties();
}
cloud_mc.y = cloud_mc.y - yspeed;
}
Just think of the endless possibilities with such simple code to generate a random cloud growth.
soules says: 2008-10-13
etype76 says: 2008-09-05
Admin Bob says: 2008-09-15

