forked from: Hello World!!!
Hello 新日暮里
// forked from nitoyon's Hello World!!!
// Hello 新日暮里
package{
import flash.display.*;
import flash.text.*;
import flash.filters.*;
import flash.geom.*;
import caurina.transitions.Tweener;
[SWF(backgroundColor="#FFFFFF", frameRate=60, width=400, height=300)]
public class Foo extends Sprite{
private var bd:BitmapData;
public function Foo():void{
var tf:TextField = new TextField();
tf.textColor = Math.random() * 0xFFFFFF;
tf.text = "新\n日暮里";
tf.autoSize = "left";
bd = new BitmapData(tf.width, tf.height, false, 0x000000);
bd.draw(tf);
bd.applyFilter(bd, bd.rect, new Point(), new BlurFilter());
bd.draw(tf);
for(var i:int = 0; i < bd.width; i++){
for(var j:int = 0; j < bd.height; j++){
Tweener.addTween(
randomize(addChild(new Rect(bd.getPixel(i, j)))),
{
x: i * 8,
y: j * 8,
alpha: 1,
delay: (i + j) * 0.1,
time: 1
}
);
}
}
}
private function randomize(d:DisplayObject):DisplayObject{
d.x = stage.stageWidth;
d.y = 0;
d.alpha = 0;
return d;
}
}
}
import flash.display.Sprite;
class Rect extends Sprite{
public function Rect(color:uint):void{
graphics.beginFill(color);
graphics.drawRect(0, 0, 20, 20);
graphics.endFill();
}
}