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: fladdict challenge for amateurs

Every frame you get screen caputre of the stage.
* Generate new frame image with using last frames screen capture.
* This is a starting point of recursive generative art.
/**
 * Copyright kazmaro ( http://wonderfl.net/user/kazmaro )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/a5nH
 */

// forked from kazmaro's forked from: fladdict challenge for amateurs
// forked from checkmate's fladdict challenge for amateurs
/**
 * Every frame you get screen caputre of the stage.
 * Generate new frame image with using last frames screen capture.
 * This is a starting point of recursive generative art.
 */
package {
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.BlendMode;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.geom.ColorTransform;
    import flash.geom.Matrix;
    import flash.geom.Point;
    
    public class Beginner extends Sprite {
        /**
         * Overwrite this update function.
         * Every frame the function is invoked with two bitmaps.
         * First one contains reference to the stage bitmap.
         * Second one contains static copy of stage.
         */
         
        public var canvas:BitmapData;
        public var drawHere:BitmapData;
        public var mat:Matrix;
         
        public function update():void{
            drawStep();
            transformStep();
            
            renderStep();
            fadeStep();
        }
        
        private var size_stage:uint = 480;

        public function drawStep():void {
            //drawHere.setPixel(stage.mouseX, stage.mouseY, 0x11111111);
            for (var i:int = 0; i < 10;++i){
                drawHere.setPixel( stage.mouseX + (Math.random()-0.5)*150, stage.mouseY + (Math.random()-0.5)*150, Math.random()*0xffffffff);
            }
        }

        public function transformStep():void {
              var scale_change:Number = 1.2;
              var noise_rotate:Number = 0.2;

              mat = new Matrix();
              mat.translate(-stage.mouseX,-stage.mouseY);
              mat.scale(scale_change, scale_change);
              mat.rotate((Math.random()-0.5)*noise_rotate);
              mat.translate(stage.mouseX, stage.mouseY);
          }


        public function renderStep():void{
            canvas.draw(drawHere, mat, null, BlendMode.DIFFERENCE);
        }


        public function fadeStep():void{
              var mul:Number = 1.1;
			  var alpha:Number = 0.9;
              var ct:ColorTransform = new ColorTransform(mul,mul,mul,alpha,0,0,0,0)
                canvas.colorTransform(drawHere.rect, ct);
          }

        
        
        /**
         * ---------------------------------------
         * DO NOT CHANGE FOLLOWING CODES
         * DO NOT ACCESS FOLLOWING PROPERTIES DIRECTLY
         * ---------------------------------------
        */
        
       
        private var bitmap:Bitmap;
        
        
        public function Beginner() {
            canvas = new BitmapData(480,480,false,0x000000);
            bitmap = new Bitmap(canvas);
            addChild(bitmap);
            addEventListener(Event.ENTER_FRAME, _update);
        }
        
        public function _update(e:Event):void{
            if(drawHere)
                drawHere.dispose();
            drawHere = canvas.clone();
            update();
        }
    }
}