In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

forked from: forked from: Rotoboobler

Rotoboobler (1,013bytes effect)
by Mr.doob
// forked from mrdoob's forked from: Rotoboobler
// forked from mrdoob's Rotoboobler
//
// 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;
        private var i : Number = 0;
        private var string : String = "top-az high class clab from shibuya don't miss it."

        public function Rotoboobler()
        {
            addEventListener(Event.ADDED_TO_STAGE, init);
        }
        
        private function init( e : Event ) : void
        {
            stage.align = "TL";
            stage.scaleMode = "noScale";

            g = new Sprite();
            g.blendMode = "multiply";
            gBD = new BitmapData( stage.stageWidth, stage.stageHeight, false, 0x4599ff);

            w = new TextField();
            w.defaultTextFormat = new TextFormat("Arial", 30);
            w.textColor = 0xccddef;
            w.autoSize = "left";

            mc = new Sprite();

            addChild(mc);
            addChild(g);

            addEventListener( "enterFrame", u );
        }

        private function u(e : Event) : void
        {
            i += .5;

        var ts:Number = Math.sin( getTimer() * .0003 );
            var tc:Number = Math.cos( getTimer() * .0002 );    

        w.text = string.substr(i % string.length, 50);
    
        var wBD:BitmapData = new BitmapData(w.width,w.height, false, 0xffffff);
        wBD.draw(w);
    
        g.graphics.clear();
        g.graphics.beginGradientFill("radial", [0xffffff, 0x000000], [1, 1], [0x00, 0xff], new Matrix( ts * 0.2 + 0.2, 0, 0, ts * 0.2 + 0.2, stage.stageWidth >> 1, stage.stageHeight >> 1 ), "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 * 100, tc * 100, "wrap", 0, 0 ) ];
        }
   }
}