Hello World -Dot- forked from: Hello World!!!
Entry Point
// forked from nitoyon's Hello World!!!
package{
//
import flash.display.*;
import flash.text.*;
import flash.filters.*;
import flash.geom.*;
//
import caurina.transitions.Tweener;
/**
* Entry Point
*/
public class Main extends Sprite {
/**
* Constructor
*/
public function Main():void {
// create text
var tf:TextField = new TextField();
tf.textColor = 0xFF0000;
tf.height = 10;
tf.text = "Hello\nWorld";
tf.autoSize = "left";
// create base bitmap data
var bd:BitmapData;
bd = new BitmapData(tf.width,
tf.height,
false,
0xFFFF00);
bd.draw(tf);
bd.applyFilter(bd,
bd.rect,
new Point(),
new BlurFilter());
bd.draw(tf);
// create sprite and add sprite and add animation
var radius:int = 5;
var vec:Vector.< uint > = bd.getVector( bd.rect );
vec.forEach( function(item:*, index:int, vector:Vector.< uint >):void {
//
var s:Sprite = new Dot(item, radius);
s.x = bd.width / 2; //400 * Math.random();
s.y = 0; //300 * Math.random();
s.alpha = 0;
//
Tweener.addTween(addChild( s ),
{
x:index % bd.width * radius * 2,
y:int(Math.floor( index / bd.width ) * radius * 2),
alpha:1,
delay:Math.random() * index % bd.width * 0.2,
time:1
} );
} );
}
}
}
//
import flash.display.Sprite;
/**
* Dot Sprite
*/
class Dot extends Sprite{
/**
* Constructor
*/
public function Dot(color:uint, radius:Number):void {
//
graphics.beginFill(color);
graphics.drawCircle(0, 0, radius);
graphics.endFill();
}
}