Someone asked me how to make a tornado with Flash, a tornado with letters. So here it is: The Tornado Tutorial
1. What you need on the scene
A movie clip of a dot, any colour you like, with the instance name “dot”.
A layer called code that will hold all the code (everything is contained in 1 frame).
2. The rotating motion
First we are going to focus on the rotating effect. You can find the piece of code on this site, in the open source section. Personally, I took it from there: actionscript-toolbox. After cleaning, you get this:
function rotate(){
this.angle+=anglespeed;
var a=Math.sin(this.angle)*this.radius;
var b=Math.cos(this.angle)*this.radius;
var scalar=perspective/(b+perspective);
this._x=a*scalar + centerx;
this._y=b*scalar/tilt+this.starty;
this._xscale=this._yscale=scalar*100;
}
3. Analyze that function
I won’t explain how the function works just now. But I want you to notice that it refers to a certain number of variables that we have to define somewhere:[list][]angle, inside the dot (because refered as this.angle)
[]anglespeed, on the timeline
[]radius, inside the dot
[]perspective, in the timeline
[]centerx, in the timeline
[]tilt, in the timeline
[*]starty, in the dot[/list]That’s why you’ll need to put this just before the function declaration:
dot.angle=0;
anglespeed = Math.PI/24;
dot.radius=50;
perspective = 300;
centerx=200;
tilt = 5;
dot.starty=200;
4. Let’s make the dot move
Now all we have to do is make the dot move…
dot.onEnterFrame=rotate;
End of Part 1. To be continued…
pom :asian: