flash on 2012-3-1
/**
* Copyright MMMMMonchi ( http://wonderfl.net/user/MMMMMonchi )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/4dYy
*/
package {
import flash.display.Sprite;
public class BallFollowingMouse extends Sprite {
private var ballCount:uint=50;
public function BallFollowingMouse() {
for(var i:uint=0;i<ballCount;i++){
addChild(new Ball(this,200));
}
}
}
}
import flash.display.Sprite;
import flash.display.Graphics;
class Ball extends Sprite{
private var angle:Number;
private var radius:Number;
private var sizeRate:Number=0.1;
public function Ball(timeline:Sprite,maxRadius:Number){
var randomRate:Number=Math.random();
angle=2*Math.PI*Math.random();
radius=maxRadius*randomRate;
createBall(randomRate);
}
private function createBall(randomRate:Number):void{
var myGraphics:Graphics=graphics;
myGraphics.beginFill(Math.floor(0xFFFFFF*randomRate)+1);
myGraphics.drawCircle(200,200,radius*sizeRate*10);
alpha=1-randomRate;
}
}