GRUNGE!
/**
* Copyright tjoen ( http://wonderfl.net/user/tjoen )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/npcy
*/
package {
import flash.display.Sprite;
import flash.events.*;
import flash.display.*;
public class FlashTest extends Sprite {
public function FlashTest() {
var bd:BitmapData=new BitmapData(465, 465, false, 0x808080);
var bd2:BitmapData=new BitmapData(465, 465, false, 0x808080);
var bmp:Bitmap=new Bitmap(bd);
addChild(bmp);
var isProcessing:Boolean=true;
bd.perlinNoise(150, 150, 3, 50, true, true, 7, true);
stage.addEventListener(MouseEvent.CLICK, toggleProcessing);
toggleProcessing();
toggleProcessing();
function addLayer(event:Event):void {
var seed:uint=Math.random()*1000;
var sizex:uint=Math.random()*250+2;
var sizey:uint=Math.random()*250+2;
bd2.perlinNoise(sizex, sizey, 3, seed, false, true, 7, true);
bd.draw(bd2, null, null, BlendMode.DIFFERENCE);
}
//function toggleProcessing(event:MouseEvent):void {
function toggleProcessing():void {
isProcessing ? stage.removeEventListener(Event.ENTER_FRAME, addLayer) : stage.addEventListener(Event.ENTER_FRAME, addLayer);
isProcessing=!isProcessing;
}
}
}
}