pouët.net

rotoboobler by Mr.doob [web]

//
// Rotoboobler (1,013bytes effect)
// by Mr.doob
//

import flash.display.Sprite;
import flash.text.TextField;
import flash.filters.DisplacementMapFilter;

stage.align = "TL";
stage.scaleMode = "noScale";

var g:Sprite = new Sprite();
var gBD:BitmapData = new BitmapData( stage.stageWidth, stage.stageHeight, false, 0x000000);

var w:TextField = new TextField();
w.autoSize = "left";

var mc:Sprite = new Sprite();
mc.alpha = .9;

addChild(g); addChild(mc);

addEventListener( "enterFrame", u );

function u(e)
{
	var ts:Number = Math.sin( getTimer() * .0003 );
	var tc:Number = Math.cos( getTimer() * .0003 );	

	w.htmlText = "<font face='_sans' size='80'> " + getTimer() + "</font>";
	
	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, "ignore", 0, 0 ) ];
}