forked from: Reverse Engineering Noise
forked from Reverse Engineering Noise (diff: 1)
ActionScript3 source code
/**
* Copyright bambula.filip1 ( http://wonderfl.net/user/bambula.filip1 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/23lm
*/
// forked from Quasimondo's Reverse Engineering Noise
package {
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
public class AnalyzeNoise extends Sprite {
public function AnalyzeNoise() {
test();
}
private function test():void
{
var b:BitmapData = new BitmapData( 64 * 16, 64 * 16, false,0 );
var n:BitmapData = new BitmapData( 256, 1, false, 0 );
var gridSize:int = 40;
var p:int;
var offset:int = 0;
for ( var yy:int = 0; yy < 16; yy++ )
{
for ( var xx:int = 0; xx < 16; xx++ )
{
var seed:int = 1;
for ( var y:int = 0; y < gridSize; y++ )
{
for ( var x:int = 0; x < gridSize; x++ )
{
n.noise( seed++,0,255,4,false);
b.setPixel( xx * gridSize + x, yy * gridSize + y, ( p = (n.getPixel( offset, 0 ) & 0xff ) ) | ( p << 16 ) | ( p << 8));
}
}
offset++;
}
}
addChild( new Bitmap( b ) );
}
}
}
