forked from: forked from: BitmapDataSample9
/**
* Copyright hesselbom ( http://wonderfl.net/user/hesselbom )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/2LSo
*/
// 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;
public function BitmapDataSample9() {
//BitmapDataを作成して表示リストに追加
bmpdata = new BitmapData( 120, 120, false, 0 );
var bmp:Bitmap = new Bitmap(bmpdata);
bmp.scaleX = bmp.scaleY = 4;
addChild( bmp );
//イベント
addEventListener( Event.ENTER_FRAME, enterframe );
}
private var baseX:Number = 60;
private var baseY:Number = 60;
private var octaves:uint = 3;
private var randomSeed:int = Math.random()*0xffffffff;
private var stitch:Boolean = false;
private var fractalNoise:Boolean = true;
private var channelOptions:int = BitmapDataChannel.RED;
private var grayScale:Boolean = true;
private var offset:Array = [new Point(),new Point(),new Point()];
private var speed:Number = 0.5;
private function enterframe(e:Event):void {
//PerlinNoise
bmpdata.perlinNoise( baseX, baseY, octaves, randomSeed,
stitch, fractalNoise, channelOptions, grayScale, offset );
offset[0].x += 2 * speed;
offset[1].x += 1 * speed;
offset[2].x += 0.5 * speed;
}
}
}