使徒襲来
/**
* Copyright watanabe ( http://wonderfl.net/user/watanabe )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/1NRPl
*/
// forked from hacker_n96o8lrr's forked from: BitmapDataSample9
// forked from nutsu's BitmapDataSample9
package {
import flash.display.Sprite;
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.display.BitmapDataChannel;
import flash.geom.Point;
import flash.events.Event;
[SWF(width=465,height=465,backgroundColor=0)]
public class BitmapDataSample9 extends Sprite {
private var bmpdata:BitmapData;
private var out:BitmapData
private var mapR:Array=[]
private var mapG:Array=[]
private var mapB:Array=[]
public function BitmapDataSample9() {
//BitmapDataを作成して表示リストに追加
bmpdata = new BitmapData( 465, 465, false, 0 );
out = bmpdata.clone();
stage.quality="low";
for(var i:int = 0; i < 0x100; i++) {
mapB[i] = (i%2)?255:0
mapG[i] = mapB[i] << 8;
mapR[i] = mapB[i] << 16;
}
var bmp:Bitmap = new Bitmap(out);
addChild( bmp );
//イベント
addEventListener( Event.ENTER_FRAME, enterframe );
}
private var baseX:Number = 90;
private var baseY:Number = 90;
private var octaves:uint = 2;
private var randomSeed:int = Math.random()*0xffffffff;
private var stitch:Boolean = false;
private var fractalNoise:Boolean = true;
private var channelOptions:int = BitmapDataChannel.RED|BitmapDataChannel.BLUE;
private var grayScale:Boolean = true;
private var offset:Array = [new Point(),new Point(),new Point()];
private function enterframe(e:Event):void {
//PerlinNoise
bmpdata.perlinNoise( baseX, baseY, octaves, randomSeed,
stitch, fractalNoise, channelOptions, grayScale, offset );
offset[0].y += 1;
//offset[1].y += 1;
// offset[2].y += 0.5;
out.paletteMap(bmpdata,bmpdata.rect,new Point(),mapR,mapG,mapB);
}
}
}