Habe aus purer Langeweile und mit dem Ergeiz mich kurz zu halten ein Script für verschmelzende, schwingende Bubbles geschrieben.
Ist für Flash 6 (AS1) einfach ins erste Frame von _root kopieren und die Framerate auf 15 bis 20 setzen. Mit der auskommentierten for-schleife ganz unten kann man noch sub-bubbles hinzufügen.
Ist inspiriert von einem Bubble-Script das ich mal irgendwo gesehen habe aber leider nicht wiederfinde. Da gings eher um Gravitation, vielleicht weiß ja einer welches ich mein.
just for fun ...
PHP-Code:
MovieClip.prototype.blackLevel=1;
MovieClip.prototype.greyLevel=101;
MovieClip.prototype.whiteLevel=201;
MovieClip.prototype.dot=function(diameter,color){
this.lineStyle(diameter,color,100);
this.lineTo(.2,0);
}
MovieClip.prototype.swing=function(){
this._x=this.startx+Math.sin(Math.PI/180*this.xcounter)*this.area;
this._y=this.starty+Math.sin(Math.PI/180*this.ycounter)*this.area;
this.xcounter+=this.xrate;
this.ycounter+=this.yrate;
if(xcounter>360){xcounter-=360;}
if(ycounter>360){ycounter-=360;}
for(i=0;i<this.childs.length;i++){
this.childs[i]._x=this._x;
this.childs[i]._y=this._y;
}
}
MovieClip.prototype.addBall = function(x,y,scale,counter){
bb=this.createEmptyMovieClip("bb"+counter,this.blackLevel+counter);
bb.dot(1*scale,0x000000);
bb._x = x;
bb._y = y;
gb=this.createEmptyMovieClip("gb"+counter,this.greyLevel+counter);
gb.dot(.9*scale,0x999999);
gb._x = x;
gb._y = y;
wb=this.createEmptyMovieClip("wb"+counter,this.whiteLevel+counter);
wb.dot(.8*scale,0xFFFFFF);
wb._x = x;
wb._y = y;
wb.childs=[gb,bb];
wb.startx=x;
wb.starty=y;
wb.area=20+Math.ceil(Math.random()*50);
wb.xrate=6+Math.ceil(Math.random()*12);
wb.yrate=5+Math.ceil(Math.random()*10)
wb.onEnterFrame=swing;
return wb;
}
//setup
for(i=0;i<20;i++,counter++){
this.superBall = this.addBall(110+Math.ceil(Math.random()*200),110+Math.ceil(Math.random()*200),30+Math.ceil(Math.random()*70),counter);
}
//for(i=0;i<5;i++,counter++){
// this.superBall.addBall(-30+Math.ceil(Math.random()*60),-30+Math.ceil(Math.random()*60),10+Math.ceil(Math.random()*30),counter);
//}
stop();