In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

flash on 2009-5-2

Get Adobe Flash player
by banyan 02 May 2009
package {
    import flash.display.Sprite;
    import flash.geom.Point;
    import flash.utils.setInterval;
    import caurina.transitions.Tweener;

    public class Anime3 extends Sprite {
        private var prevPos:Point;

        public function Anime3():void {
            prevPos = new Point();
            setInterval(update, 10);
        }

        private function update():void {
            var r:Number = Math.pow(Math.random(), 2) * 50;
            var theta:Number = Math.random() * 2 * Math.PI;

            var s:Sprite = new Sprite();
            s.graphics.beginFill(Math.random() * 0x1000000);
            s.graphics.drawCircle(0, 0, 5 + Math.random() * 5);
            s.graphics.endFill();
            s.x = mouseX + r * Math.cos(theta);
            s.y = mouseY + r * Math.sin(theta);
            s.scaleX = s.scaleY = 0;
            addChild(s);

            var curPos:Point = new Point(mouseX, mouseY);
            var d:Number = Point.distance(curPos, prevPos);
            prevPos = curPos;

            Tweener.addTween(s, {
                time: 7,
                scaleX: d / 15 + 2,
                scaleY: d / 15 + 2,
                alpha: 0,
                onComplete: function():void {
                    removeChild(s);
                }
            });
        }
    }
}