PDA

View Full Version : towardsUs Revisted for MX


dv8
05-15-2002, 03:53 PM
Simple create a MC of a circle. Name it "ball", then apply a linkage to the "ball" and give it the identified instance name "ball".
Then on the first from of the Main Timeline use this code:

Stage.scaleMode = "noScale";
stageWidth=Stage.width;
stageHeight=Stage.height;

color.prototype.setBrightness=function(brightness) {
var anum=100-brightness;
var bnum=255/100*brightness;
this.setTransform({ra:anum,ga:anum,ba:anum,rb:bnum ,gb:bnum,bb:bnum,aa:100,ab:0});
}

scaleMax=800; // maximum scale before fading out
fadeOut=0.93; // speed of fade out
frequency=10; // how often a movieclip is created
colMin=0; // minimum brightness
colMax=40; // maximum brightness
colVariance=colMax-colMin; // variation in brightness

// magnitude of horizontal motion
function hRad(){
return 4+Math.random();
}

// magnitude of vertical motion
function vRad(){
return 4+Math.random();
}

// speed at which vertical magnitude increases
function vRadInc(){
return 0.1;
}

// speed at which horizontal magnitude increases
function hRadInc(){
return 0.1
}

// speed of oscillation
function lrSpeed(){
return 5+Math.random()*40;
}

// speed at which the object expands
function scaleUpSpeed(){
return 1.02;
}

// brightness for each movieclip
function nooCol(){
return colMin+random(colvariance);
}

function control(){
if(random(frequency)==0){
depth++;
_root.attachMovie("ball","ball"+depth,depth);
noo = _root["ball"+depth];
col=new Color(noo);
col.setBrightness(nooCol());
noo._x = -50;
noo._y = -50;
noo._xscale = noo._yscale = 10;
noo.scaleSpeed = scaleUpSpeed();
noo.lrSpeed=lrSpeed();
noo.hRad=hRad();
noo.vRad=vRad();

noo.hradInc=hRadInc();
noo.vRadInc=vRadInc();
noo.myfunc = function () {
this.lr+=this.lrSpeed;
this.hrad+=this.hradInc;
this.vrad+=this.vradInc;
this._x=_root.stageWidth/2+this.hrad*Math.sin(this.lr*Math.PI/180);
this._y=_root.stageHeight/2+this.vrad*Math.cos(this.lr*Math.PI/180);
this._yscale=this._xscale*=this.scaleSpeed;
this.swapDepths(Math.floor(this._xscale));
if(this._xscale>_root.scaleMax){
this._alpha*=_root.fadeOut;
if(this._alpha<3){
this.removeMovieClip();
}
}
}
noo.onEnterFrame = function () {
this.myfunc();
}
}
}
_root.onEnterFrame = function () {
control();
}
stop();

Keep Flashin'