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: 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 emnobu ( http://wonderfl.net/user/emnobu )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/y6nt
 */

// 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;
    import flash.geom.Rectangle;
    
    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();
        }
        
        
        public function drawStep():void {
            var _rect00:Rectangle = new Rectangle(Math.random() * 480, Math.random() * 480, 1, 100);
            drawHere.fillRect(_rect00, 0xffffff);
		
            var _rect000:Rectangle = new Rectangle(Math.random() * 480, Math.random() * 480, 100, 1);
            drawHere.fillRect(_rect000, 0xffffff);
		
            var _rect0000:Rectangle = new Rectangle(Math.random() * 960, Math.random() * 960, 7, 7);
            drawHere.fillRect(_rect0000, 0xffffff);

            var thick:uint = 20;
            //F
            var _rect:Rectangle = new Rectangle(0, 0, thick, 70+thick);
            drawHere.fillRect(_rect, 0xFFFFFF);
            var _rect01:Rectangle = new Rectangle(0, 0, 35, thick);
            drawHere.fillRect(_rect01, 0xFFFFFF);
            var _rect03:Rectangle = new Rectangle(0, 35, 30, thick);
            drawHere.fillRect(_rect03, 0xFFFFFF);			
            //L
            var _rect04:Rectangle = new Rectangle(45, 0, thick, 70);
            drawHere.fillRect(_rect04, 0xFFFFFF);
            var _rect04_2:Rectangle = new Rectangle(45, 70, 35, thick);
            drawHere.fillRect(_rect04_2, 0xFFFFFF);
            //A
            var _rect05:Rectangle = new Rectangle(90, 0, thick, 70+thick);
            drawHere.fillRect(_rect05, 0xFFFFFF);
            var _rect06:Rectangle = new Rectangle(90, 0, 35, thick);
            drawHere.fillRect(_rect06, 0xFFFFFF);
            var _rect07:Rectangle = new Rectangle(90, 35, 35, thick);
            drawHere.fillRect(_rect07, 0xFFFFFF)
            var _rect08:Rectangle = new Rectangle(120, 0, thick, 70+thick);
            drawHere.fillRect(_rect08, 0xFFFFFF);
            //S
            var _rect09:Rectangle = new Rectangle(155, 0, 35, thick);
            drawHere.fillRect(_rect09, 0xFFFFFF);
            var _rect10:Rectangle = new Rectangle(155, 0, thick, 35);
            drawHere.fillRect(_rect10, 0xFFFFFF);
            var _rect11:Rectangle = new Rectangle(155, 35, 35, thick);
            drawHere.fillRect(_rect11, 0xFFFFFF);
            var _rect12:Rectangle = new Rectangle(170, 35, thick, 35);
            drawHere.fillRect(_rect12, 0xFFFFFF);
            var _rect13:Rectangle = new Rectangle(155, 70, 35, thick);
            drawHere.fillRect(_rect13, 0xFFFFFF);
            //H
            var _rect14:Rectangle = new Rectangle(205, 0, thick, 70+thick);
            drawHere.fillRect(_rect14, 0xFFFFFF);
            var _rect15:Rectangle = new Rectangle(205, 30, 35, thick);
            drawHere.fillRect(_rect15, 0xFFFFFF);
            var _rect16:Rectangle = new Rectangle(240, 0, thick, 70+thick);
            drawHere.fillRect(_rect16, 0xFFFFFF);

        }
        
        private var rotate_nm:Number = 0;
        
        public function transformStep():void
        {
            mat = new Matrix();
            mat.translate(-240,-240);
            mat.scale(0.7,0.7);
            rotate_nm += 3.15;
            mat.rotate(rotate_nm);
            mat.translate(240,240);
        }
        
        
        public function renderStep():void{
            canvas.draw(drawHere, mat, null,BlendMode.SCREEN);
        }
        
        
        public function fadeStep():void
        {
            canvas.colorTransform(drawHere.rect, new ColorTransform(Math.random()*0.4+0.6,Math.random()*0.4+0.6,Math.random()*0.4+0.6,1,0,0,0,0));
        }
        
        
        /**
         * ---------------------------------------
         * 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();
        }
    }
}