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 Thatoney ( http://wonderfl.net/user/Thatoney )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/oHlv
*/
// forked from zonow'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.filters.BlurFilter;
import flash.filters.ColorMatrixFilter;
import flash.geom.ColorTransform;
import flash.geom.Matrix;
import flash.geom.Point;
import flash.utils.getTimer;
public class zonolibTest0 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 _matrix:Matrix;
private var _bitmap:Bitmap;
public function zonolibTest0() {
_canvas = new BitmapData(480,480,false,0x000000);
_bitmap = new Bitmap(_canvas);
addChild(_bitmap);
addEventListener(Event.ENTER_FRAME, _update);
}
public function update():void{
drawStep();
transformStep();
renderStep();
fadeStep();
}
private var ss:Number = 0;
private var ds:Number = Math.PI/180*6;
private var ss2:Number = 0;
private var ds2:Number = Math.PI/180*30;
public function drawStep():void {
for (var i:int = 0 ; i < Math.random() * 8; i++) {
var sp:Sprite = new Sprite();
ss += ds;
ss2 += ds2;
var rr:Number = Math.sin(ss2)*10* Math.sin(ss2)*10 + 140;
var xx:Number = Math.cos(ss) * rr + 240;
var yy:Number = Math.sin(ss) * rr + 240;
sp.graphics.beginFill(0xFF * 0x01FFFF + xx / 480 * 0xFF * 0x01FFFF + yy / 480 * 0xFF);
sp.graphics.drawCircle(xx, yy, 1.5 + Math.random() * 12);
sp.graphics.endFill();
_drawHere.draw(sp);
}
}
public function transformStep():void {
_matrix = new Matrix();
_matrix.translate(-240,-240);
_matrix.scale(0.98,0.98);
_matrix.rotate(0.05);
_matrix.translate(240,240);
}
public function renderStep():void {
_canvas.draw(_drawHere, _matrix, null);
}
public function fadeStep():void {
_canvas.applyFilter(_canvas, _canvas.rect, new Point(), new BlurFilter(2, 2, 3));
_canvas.colorTransform(_canvas.rect, new ColorTransform(1.3,1.2,1.2,1,0,0,0,0));
var blackImage:BitmapData = new BitmapData(480, 480, true, 0x18000000);
_canvas.draw(blackImage);
}
/**
* ---------------------------------------
* DO NOT CHANGE FOLLOWING CODES
* DO NOT ACCESS FOLLOWING PROPERTIES DIRECTLY
* ---------------------------------------
*/
public function _update(e:Event):void{
if(_drawHere)
_drawHere.dispose();
_drawHere = _canvas.clone();
update();
}
}
}