forked from: Mouse Toy
/**
* Copyright zotin95 ( http://wonderfl.net/user/zotin95 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/bNNe
*/
// forked from shapevent's Mouse Toy
package {
import flash.display.*;
import flash.events.*;
[SWF(backgroundColor=0x0, width=465, height=456, frameRate=30)]
import flash.filters.GlowFilter;
public class MouseToy extends MovieClip {
private var circles:Array;
public function MouseToy(){
// init
graphics.beginFill(0x0);
graphics.drawRect(0, 0, 465, 465);
graphics.endFill();
circles = [];
for (var i:int = 0; i<50; i++){
var c:Sprite = makeCircle(0xff0000 + 0x400*i);
c.x = stage.stageWidth / 2;
c.y = stage.stageHeight / 2;
c.scaleX = 1 + i/2;
c.scaleY = 0.5 + i/4;
addChild(c);
c.filters = [new GlowFilter(0xffff00, 0.5, 6, 6)];
circles.push(c);
}
addEventListener(Event.ENTER_FRAME, onLoop);
}
// private methods
private function onLoop(evt:Event):void {
circles[0].y += (mouseY - circles[0].y) / 4;
circles[0].x += (mouseX - circles[0].x) / 5;
for (var i:int = 1; i<circles.length; i++){
var pre:Sprite = circles[i - 1];
circles[i].y += (pre.y - circles[i].y) / 4;
circles[i].x += (pre.x - circles[i].x) / 5;
}
}
private function makeCircle(col:uint):Sprite{
var s:Sprite = new Sprite();
with(s.graphics){
lineStyle(0,col);
drawCircle(0,0,10);
}
return s;
}
}
}