For daily doses of
geek stuff @joemaddalone

labs.insert-title.com

Scripted Motion w/ easing

The Flash

The Script

	
function DrawBox(sName,fc,bc,w,h,x,y,dpth,opc,speed){
    ref = _root.createEmptyMovieClip(sName,dpth);    
    ref.lineStyle(0,0xFFFFFF,100);
    ref.moveTo(x,y);    
    ref.lineStyle(0,bc,opc);
    ref.beginFill(fc,opc);
    ref.lineTo(x+w,y);
    ref.lineTo(x+w,y+h);
    ref.lineTo(x,y+h);
    ref.lineTo(x,y); 
    ref.endfill();
    ref.xxx=24;
    ref.randomX = random(600);
    ref.randomY = random(300);                   
    ref.onEnterFrame = function(){
        this.xxx+=(random(2));
        this._X -= this.randomX;
        this._X *= 0.9;
        this._X += this.randomX;
        this._Y -= this.randomY;
        this._Y *= 0.9;               
        this._Y += this.randomY;
        if(this.xxx>50){
        this.xxx=1;
        this.randomX = random(600);
        this.randomY = random(300);}
            };
     ref.OnFrame(2) = function(){gotoandplay(1)}
}
onLoad(){
  i=30;
  for (t=0; t<=i; t++) {    
    DrawBox("box" + t,0x666666,0x000000,5,5,0,0,t,100,0.9) ;
  }
}

The Download

Download swish file