// 色によって高さを変えてみた。ソートできてませんが。 // forked from nitoyon's Hello World!!! package{ import flash.display.*; import flash.text.*; import flash.filters.*; import flash.geom.*; import caurina.transitions.Tweener; public class Foo extends Sprite{ private var bd:BitmapData; public function Foo():void{ var tf:TextField = new TextField(); tf.textColor = 0x000000; tf.text = "Hello\nWorld!!!"; tf.autoSize = "left"; bd = new BitmapData(tf.width, tf.height, false, 0x3399ff); 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++){ var color:uint = bd.getPixel(i, j); Tweener.addTween( randomize(addChild(new Circle(color))), { x: i * 10, y: j * 10, z: this.getBrightness(color) / 4, alpha: 1, delay: (i + j) * .2 * Math.random(), time: 1 } ); } } this.rotationX = 10; this.rotationY = 30; this.x = 50; this.y = 50; } private function randomize(d:DisplayObject):DisplayObject{ d.x = 400 * Math.random(); d.y = 300 * Math.random(); d.z = - 300 * Math.random(); d.alpha = 0; return d; } private function getBrightness(color:uint):uint { var red:uint = color >> 16 & 0xFF; var green:uint = color >> 8 & 0xFF; var blue:uint = color & 0xFF; var brightness:uint = (uint)(red + green + blue) / 3; return brightness; } } } import flash.display.Sprite; class Circle extends Sprite{ public function Circle(color:uint):void{ graphics.beginFill(color); graphics.drawCircle(0, 0, 6); graphics.endFill(); } } forked from: Hello World!!!