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: 貼ロー forked from: 貼ロワ forked from: Hello World!!!

メルヘンぽくなりました。
forked from: nitoyon's ""Hello World!!!"
/**
 * Copyright hacker_hhfthuyo ( http://wonderfl.net/user/hacker_hhfthuyo )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/tHWq
 */

// forked from otias's 貼ロー forked from: 貼ロワ forked from: Hello World!!!
//メルヘンぽくなりました。
// forked from otias's 貼ロワ forked from: Hello World!!!
// forked from otias's 貼り絵 forked from: Hello World!!!
//forked from: nitoyon's ""Hello World!!!"

package{
    import flash.display.Sprite;
	import flash.display.DisplayObject;
	import flash.display.BitmapData;
	import flash.text.TextField;
    import flash.geom.*;
	import caurina.transitions.Tweener;

    public class DotTypo extends Sprite{
		private var canvas:Sprite;
        private var bd:BitmapData;
		private var totalWidth:Number;
		private var totalHeight:Number;
		private var scale:Number = 10;
		
        public function DotTypo():void{
			init();
		}
		
		private function init():void {
			var tf:TextField = new TextField();
            tf.textColor = 0x000000;
            tf.text = "Lorem ipsum dolor sit amet.";
            tf.autoSize = "left";
			
			bd = new BitmapData(tf.width, tf.height, false, 0xFFFFFF);
            bd.draw(tf);
			totalWidth = (bd.width * scale);
			totalHeight = (bd.height * scale);
			
			canvas = new Sprite();
			canvas.x = stage.stageWidth / 2 - totalWidth / 2;
			canvas.y = stage.stageHeight / 2 - totalHeight / 2;
			addChild(canvas);
			
            for(var i:int = 0; i < bd.width; i++){
                for(var j:int = 0; j < bd.height; j++){
					Tweener.addTween(randomize(canvas.addChild(new Rect(bd.getPixel(i, j)))), 
                        {
                            x: i * scale,
                            y: j * scale,
							alpha: 1,
                            delay: 1.2 + Math.random() * 4,
                            time: 2
                        }
                    );
                }
            }
        }
		
		private function randomize(d:DisplayObject):DisplayObject{
            d.x = Math.random() * 465;
            d.y = Math.random() * -465;
            d.alpha = 0;
            return d;
        }
    }
}


import flash.display.*;
import flash.geom.ColorTransform;
import flash.events.Event;
import flash.filters.*;

class Rect extends Sprite{
	private var vx:Number;
	private var vy:Number;
	private var vr:Number;
    public function Rect(color:uint):void{
		if(color >= 0xC5C5C5) {
			vx = Math.random() * 12 - 6;
			vy = 3 + Math.random() * 3;
			vr = Math.random() * 6 - 3;
			addEventListener(Event.ENTER_FRAME, onLoop);
		}
		
		var wh:Number = 10 + Math.random() * 5;
		var inner:Shape = new Shape();
		with(inner.graphics) {
			beginFill(color);
        	drawRect(0, 0, wh, wh);
        	endFill();
		}
		
		inner.blendMode = BlendMode.LAYER;
		var ct:ColorTransform = inner.transform.colorTransform;
		if(color <= 0xC5C5C5) {
			ct.redOffset = -1 * Math.random() * 100;
			ct.greenOffset = Math.random() * 80;
			ct.blueOffset = -1 * Math.random() * 100;
			this.filters = [new DropShadowFilter()];
		} else {
			ct.redOffset = -Math.random() * 200 ;
			ct.greenOffset = Math.random() * 200;
			ct.blueOffset = (Math.random() * 80 + 120) * -1;
		}
		inner.transform.colorTransform = ct;
		this.rotation = Math.random() * 50 - 25;
		addChild(inner);
    }
	
	private function onLoop(e:Event):void {
		vy += 0.02;
		this.x += vx;
		this.y += vy;
		this.rotation += vr;
		if(this.y > stage.stageHeight || this.x > stage.stageWidth || this.x < 0) {
			parent.removeChild(this);
			removeEventListener(Event.ENTER_FRAME, onLoop);
		}
	}
}