Rotoboobler
Rotoboobler (1,013bytes effect)
by Mr.doob
//
// Rotoboobler (1,013bytes effect)
// by Mr.doob
//
package
{
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Matrix;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.filters.DisplacementMapFilter;
import flash.utils.getTimer;
public class Rotoboobler extends Sprite
{
private var w : TextField, g : Sprite, gBD : BitmapData, mc : Sprite;
public function Rotoboobler()
{
addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init( e : Event ) : void
{
stage.align = "TL";
stage.scaleMode = "noScale";
g = new Sprite();
gBD = new BitmapData( stage.stageWidth, stage.stageHeight, false, 0x000000);
w = new TextField();
w.defaultTextFormat = new TextFormat("Arial", 30);
w.textColor = 0xffffff;
w.autoSize = "left";
mc = new Sprite();
mc.alpha = .9;
addChild(g);
addChild(mc);
addEventListener( "enterFrame", u );
}
private function u(e : Event) : void
{
var ts:Number = Math.sin( getTimer() * .0003 );
var tc:Number = Math.cos( getTimer() * .0003 );
w.text = String( getTimer() );
var wBD:BitmapData = new BitmapData(w.width,w.height, false, 0x000000);
wBD.draw(w);
g.graphics.clear();
g.graphics.beginGradientFill("radial", [0xFFFFFF, 0x000000], [1, 1], [0x00, 0xFF], new Matrix( ts * 0.5 + 0.5, 0, 0, ts * 0.5 + 0.5, stage.stageWidth * .5, stage.stageHeight * .5 ), "reflect", "linearRGB" );
g.graphics.drawRect( 0, 0, stage.stageWidth, stage.stageHeight );
gBD.draw(g);
mc.graphics.clear();
mc.graphics.beginBitmapFill(wBD, new Matrix( tc * ts + 1, ts, -ts, tc * ts + 1, 0, 0 ), true, false );
mc.graphics.drawRect( 0, 0, stage.stageWidth, stage.stageHeight );
mc.filters = [ new DisplacementMapFilter( gBD, null, 1, 1, tc * 500, tc * 500, "wrap", 0, 0 ) ];
}
}
}