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

forked from: flash on 2010-12-17

Get Adobe Flash player
by hacker_o5nv66b6 18 Dec 2010
/**
 * Copyright hacker_o5nv66b6 ( http://wonderfl.net/user/hacker_o5nv66b6 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/zccR
 */

// forked from yama3's flash on 2010-12-17
package {
    import flash.display.*;
    import flash.text.*;
    import flash.filters.*;
    import flash.geom.*;
    import flash.events.*;
    import caurina.transitions.Tweener;
    
    public class FlashTest extends Sprite {
        private var bd:BitmapData;
        private var circles:Array;
        private var completed:uint = 0;
        
        public function FlashTest() {
            var tf:TextField = new TextField();
            tf.textColor = 0xFF0000;
            tf.text = "o l i v i a\nオリビア";
            tf.font = "小塚ゴシック Pro B";
            tf.autoSize = "left";
            bd = new BitmapData(tf.width, tf.height, false, 000000);
            bd.draw(tf);
            bd.applyFilter(bd, bd.rect, new Point(), new BlurFilter());
            bd.draw(tf);
            
            circles = new Array();
            for(var i:int = 0; i < bd.width; i++) {
                for(var j:int = 0; j < bd.height; j++) {
                    var circle:Circle = new Circle(bd.getPixel(i, j));
                    circle.dx = circle.x = i * 10;
                    circle.dy = circle.y = j * 10;
                    circles.push(circle);
                    Tweener.addTween(randomize(addChild(circle)),
                    {
                        x: i * 10,
                        y: j * 10,
                        alpha: 1,
                        delay:(i+j)*.2*Math.random(),
                        time:1,
                        onComplete:complete
                    }
                    );
                }

            }            
        }
        private function randomize(d:DisplayObject):DisplayObject {
            d.x = 400 * Math.random();
            d.y = 300 * Math.random();
            d.alpha = 0;
            return d;
        }
        private function complete():void {
            completed++;
            if(completed > bd.width * bd.height - 1) {
                addEventListener(Event.ENTER_FRAME, update, false, 0, true);
            }
        }
        private function update(evt:Event):void {
            for(var n:uint = 0; n < circles.length; n++) {
                var circle:Circle = circles[n];
                circle.run();
            }
        }
    }
}

import flash.display.Sprite;
import flash.geom.Point;

class Circle extends Sprite {
    public var dx:uint;
    public var dy:uint;
    public var r:uint = 4;
    public var s:uint = 20;
    private var c:uint = Math.round(Math.random() * 255 * 255 * 255);
    
    public function Circle(color:uint):void {
        graphics.beginFill(color);
        graphics.drawCircle(0, 0, 6);
        graphics.endFill();
    }
    
    public function run():void {
        var dist:Number = Point.distance(new Point(dx, dy), new Point(stage.mouseX, stage.mouseY));
        var p:Point = Point.polar((dist < s) ? dist : s, -Math.atan2(dx - stage.mouseX, dy - stage.mouseY) - 90 * Math.PI / 180);
        x = dx + p.x;
        y = dy + p.y;
    }


}