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

/**
 * 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.*;
	import flash.events.*;
	import flash.filters.*
	import flash.utils.*;
	import flash.geom.*;
	
	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.
         */
		private var mainCanvas:MovieClip;
		private var canvas:MovieClip;
		public var mat:Matrix;
		public var drawHere:BitmapData;
		private var canvasArray:Array = new Array();
		
		private var xPos:Number;
		private var yPos:Number;
		private var r:Number
		private var angle:Number = 0;
		private var rotateVal:Number = 0;
		private var delcount:int=0;
		
		private var centerX:Number;
		private var centerY:Number;
		
		/*
		zonow 「あ〜楽しい!、この場をもっと早く知りたかったw」
		*/
		
		private function update(){
			drawStep(0,0);
			transformStep();
			renderStep();
			faseStep();
		}
		
		//中心点座標を引数に
		private function drawStep(xp:Number,yp:Number):void{
			canvas = new MovieClip();
			canvasArray.push(canvas)
			thisDrow(canvas,Math.random()*240,xp,yp, Math.random() * 0xFF0000 * Math.random() * 0xFF0000);
		}
		
		public function transformStep():void{
            stage.addEventListener(Event.ENTER_FRAME, rotationStep);
        }
		
		public function faseStep():void{
			var colorTransform:ColorTransform = canvas.transform.colorTransform;
			colorTransform.color = Math.random() * 0xFF0000 * Math.random() * 0xFF0000;
			canvas.transform.colorTransform = colorTransform;
		}
		 public function renderStep():void{
			canvas.graphics.beginFill(Math.random() * 0xFF0000 * Math.random() * 0xFF0000,0.2);
        }
		
		
		/**
          * ---------------------------------------
          * DO NOT CHANGE FOLLOWING CODES
          * DO NOT ACCESS FOLLOWING PROPERTIES DIRECTLY
          * ---------------------------------------
        */ 
		public function Beginner():void{
			var bg:BitmapData = new BitmapData(480,480,false,0x000000);
			var bitmap:Bitmap = new Bitmap(bg);
			addChild(bitmap);
			mainCanvas = new MovieClip();
			mainCanvas.x = stage.stageWidth/2;
			mainCanvas.y = stage.stageHeight/2;
			addChild(mainCanvas);
			update();
		}
		
		private function _update():void{
			xPos = new Number();
			yPos = new Number();
			r = new Number();
			angle = 0;
			update();
			
			trace(mainCanvas.numChildren);
			/*if(mainCanvas.numChildren > 10){
				if(mainCanvas.getChildAt(delcount) != undefine)mainCanvas.removeChildAt(delcount);
				delcount++;
			}*/
			
		}
		
		//---------------------------------------------------------------------------------------------
		private function rotationStep(event:Event):void{
			mainCanvas.rotation = rotateVal--;
		}
		
		public function thisDrow(m:MovieClip,rad:Number,cx:Number,cy:Number,color:uint = 0xFF0000):void {		
			r= rad;
			centerX = cx;
			centerY = cy;
			
			//円を描き始める始点
			xPos = r * Math.sin(2 * angle) * Math.cos(angle) + centerX;
			yPos = r * Math.sin(2 * angle) * Math.sin(angle) + centerY;
		
			canvas = m
			canvas.graphics.lineStyle(1,color);
			canvas.graphics.moveTo(xPos, yPos);
			mainCanvas.addChild(canvas)
			stage.addEventListener(Event.ENTER_FRAME, circleLoop);
		}
		
		
		private function circleLoop(e:Event):void{
			//mainCanvas.rotation = rotateVal--;
			angle += 0.05
			
			xPos = r * Math.sin(2 * angle) * Math.cos(angle) + centerX - Math.random() * 20;
			yPos = r * Math.sin(2 * angle) * Math.sin(angle) + centerY - Math.random() * 20;
			
			canvas.graphics.lineTo(xPos,yPos)
			if(angle >= Math.PI*2){
				stage.removeEventListener(Event.ENTER_FRAME, circleLoop);
				stage.removeEventListener(Event.ENTER_FRAME, rotationStep);
				_update();
			}
		
		}
		
	}
}