貼ロワ forked from: Hello World!!!
forked from: nitoyon's ""Hello World!!!"
/**
* Copyright otias ( http://wonderfl.net/user/otias )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/2KTC
*/
// 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 bd:BitmapData;
public function DotTypo():void{
var tf:TextField = new TextField();
tf.textColor = 0x000000;
tf.text = "ハロー\nワールド";
tf.autoSize = "left";
bd = new BitmapData(tf.width, tf.height, false, 0xFFFFFF);
bd.draw(tf);
var canvas:Sprite = new Sprite();
canvas.y = 100;
addChild(canvas);
var a:Array = new Array();
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 * 9,
y: j * 9,
scaleX: 1,
scaleY: 1,
alpha: 1,
delay: 0.7 + Math.random() * 4,
time: 1
}
);
}
}
}
private function randomize(d:DisplayObject):DisplayObject{
d.x = Math.random() * stage.stageWidth;
d.y = Math.random() * stage.stageHeight;
d.alpha = 0;
return d;
}
}
}
import flash.display.*;
import flash.geom.ColorTransform;
class Rect extends Shape{
public function Rect(color:uint):void{
if(color >= 0xC5C5C5) { return; }
graphics.lineStyle(2, 0xFFFFFF);
graphics.beginFill(color);
graphics.drawRect(0, 0, 10, 10);
graphics.endFill();
var ct:ColorTransform = transform.colorTransform;
ct.redOffset = -100;
ct.greenOffset = 100;
ct.blueOffset = -35;
transform.colorTransform = ct;
blendMode = BlendMode.LAYER;
rotation = Math.random() * 45;
scaleX = scaleY = 45;
}
}