forked from: RED

by h_sakurai forked from RED (diff: 5)
♥0 | Line 36 | Modified 2011-11-22 13:00:32 | MIT License
play

ActionScript3 source code

/**
 * Copyright h_sakurai ( http://wonderfl.net/user/h_sakurai )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/tlfY
 */

// forked from christian's RED
package
{
    import flash.display.*;
    import flash.geom.Point;
    import flash.events.Event;
    import flash.filters.ConvolutionFilter;

    [ SWF (width = '465', height = '465', backgroundColor = '0x000000', frameRate = '30')]

    public class RED extends Sprite
    {
        private var pn_v01 : Point = new Point (), pn_v02 : Point = new Point ();

        private var f : ConvolutionFilter;
        private var b : BitmapData;
        private var i : Bitmap;

        public function RED ()
        {
            Wonderfl.disable_capture ();
            stage.scaleMode = 'noScale';

            graphics.beginFill (0, 1);
            graphics.drawRect  (0, 0, 465, 465);

            f = new ConvolutionFilter (3, 3, [-30, 30, 0, -30, 30, 0, -30, 30, 0], 9, 0); // OUTLINE

            addChild (i = new Bitmap (b = new BitmapData (465, 233, true, 0x00)));
            i.y = stage.stageHeight / 4;

            addEventListener (Event.ENTER_FRAME, setRender);
        }

        private function setRender (e : Event) : void
        {
            pn_v02.y = (pn_v01.x = (pn_v01.y += 2.5)) * .5;

            b.perlinNoise (100, 200, 2, 0xFF, false, false, 8|4, false, [pn_v01, pn_v02]);  // A&R
            b.applyFilter (b, b.rect, b.rect.topLeft, f);
            b.draw (b, null, null, BlendMode.HARDLIGHT);
            b.draw (b, null, null, BlendMode.HARDLIGHT);
            b.draw (b, null, null, BlendMode.LIGHTEN);
            b.draw (b, null, null, BlendMode.LIGHTEN);
        }
    }
}