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 h_sakurai ( http://wonderfl.net/user/h_sakurai )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/doYM
*/
// forked from cda244'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;
import flash.utils.getTimer;
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 rnd:Number = Math.random();
drawHere.setPixel( (getTimer()%480)*rnd, (getTimer()%480)*rnd, 0xffffffff);
rnd = Math.random();
drawHere.setPixel( (getTimer()%480)*rnd, (getTimer()%480)*rnd, 0xff000000);
for(var i:int = 0; i < 80; i++) {
rnd = Math.random();
drawHere.setPixel( 20*rnd+230, 20*rnd+230, 0xff000000);
}
}
public function transformStep():void
{
var rnd:Number = Math.random();
mat = new Matrix();
mat.translate(-240,-240);
mat.scale(rnd+1, rnd+1);
mat.rotate(-rnd);
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();
}
}
}