/**
* Copyright hacker_0gijj6uh ( http://wonderfl.net/user/hacker_0gijj6uh )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/1fFo
*/
package {
import flash.display.*;
import flash.events.*;
public class FlashTest extends Sprite {
public var canvas:BitmapData = new BitmapData(465,465,false,0);
public var noise:BitmapData = new BitmapData(465,465,false,0);
public var counter:Number = new Number(0);
public function FlashTest() {
noise.perlinNoise(465,465,6,Math.random()*100,false,false);
process();
this.addChild(new Bitmap(canvas));
this.addEventListener(Event.ENTER_FRAME,update);
}
public function update(e:Event):void{
counter = this.mouseX*(255/465);
process();
}
public function process():void{
var n:int = new int();
var t:int = new int();
var red:int=new int();
var green:int=new int();
var blue:int=new int();
for(var i:int=0 ; i<465*465 ; i++){
t = noise.getPixel(i%465,i/465);
red=Math.floor(t/0x010000);
t -= red*0x010000;
green=Math.floor(t/0x0100);
t -= green*0x0100;
blue=t;
n = (green+blue+red)/3
t = 0;
if(red > counter%255)
t += 0x010000*red;
if(green > counter%255)
t += 0x000100*green;
if(blue > counter%255)
t += 0x000001*blue;
canvas.setPixel(i%465,i/465,t);
}
}
}
}