forked from: Hello World!!!
package
{
import flash.display.* ;
import flash.events.Event;
import flash.text.* ;
import flash.filters.* ;
import flash.geom.* ;
[SWF(backgroundColor="#000000", frameRate=30)]
public class Foo extends Sprite
{
private var bd:BitmapData ;
public function Foo( ):void
{
var tf:TextField = new TextField( ) ;
tf.text = "Hello\nWorld!!!" ;
tf.textColor = 0x222222 ;
tf.autoSize = "left" ;
bd = new BitmapData( tf.width, tf.height, false, 0xCCFF33 ) ;
// bd.draw( tf ) ;
// bd.applyFilter( bd, bd.rect, new Point( ), new BlurFilter( ) ) ;
bd.draw( tf );
xCreateBg( ) ;
var _circle:Circle ;
for ( var i:int = 0; i < bd.width; i++ )
{
for ( var j:int = 0; j < bd.height; j++ )
{
_circle = new Circle( bd.getPixel( i, j ) ) ;
_circle.alpha = 0 ;
_circle.x = i * 13 ;
_circle.y = j * 13 ;
_circle.xInit( ) ;
addChild( _circle ) ;
}
}
// addChild( tf ) ;
}
private function xCreateBg( ):void
{
var _circle:Circle ;
for ( var i:int = 0; i < bd.width; i++ )
{
for ( var j:int = 0; j < bd.height; j++ )
{
_circle = new Circle( 0x222222 ) ;
_circle.x = i * 13 ;
_circle.y = j * 13 ;
_circle.xInit( ) ;
addChild( _circle ) ;
}
}
}
}
}
import flash.display.Sprite ;
import flash.events.Event ;
import caurina.transitions.Tweener ;
class Circle extends Sprite
{
private var nAlpha:Number = 0 ;
private var nCurrent:Number = 0 ;
public function Circle( color:uint ):void
{
graphics.beginFill( color ) ;
graphics.drawCircle( 0, 0, 6 ) ;
graphics.endFill( ) ;
}
public function xInit( ):void
{
Tweener.addTween(
this,
{
alpha : .5 + .5 * Math.random( ),
delay : 2 + 2 * Math.random( ),
time : .5 + .5 * Math.random( ),
onComplete: xAction
}
) ;
}
private function xAction( ):void
{
nAlpha = alpha ;
nCurrent = 0 ;
addEventListener( Event.ENTER_FRAME, xDoAction ) ;
}
private function xDoAction( e:Event ):void
{
alpha = nAlpha + nAlpha * Math.sin( nCurrent ) ;
nCurrent += 0.3 * Math.random( ) ;
}
}