perlineNoiseのテスト1
/**
* Copyright curvedstraightline ( http://wonderfl.net/user/curvedstraightline )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/1ADK
*/
package {
import flash.display.Sprite;
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.display.BitmapDataChannel;
import flash.events.Event;
import flash.geom.Point;
public class FlashTest extends Sprite {
public var _bp:Bitmap;
public var _bmd:BitmapData;
public const STAGE_SCALE:int = 6;
public const STAGE_WIDTH:int = stage.stageWidth / STAGE_SCALE;
public const STAGE_HEIGHT:int = stage.stageHeight / STAGE_SCALE;
public function FlashTest() {
init();
}
public function init():void{
_bmd = new BitmapData(
STAGE_WIDTH,
STAGE_HEIGHT,
false,
0xffffff
);
_bp = new Bitmap();
_bp.bitmapData = _bmd;
_bp.scaleX = _bp.scaleY = STAGE_SCALE;
addChild(_bp);
stage.addEventListener(Event.ENTER_FRAME,onEnterFrame);
}
public const BASE_X:int = stage.stageWidth;
public const BASE_Y:int = stage.stageHeight / 4;
public const OCTAVE_NUMBER:uint = 4;
public var RANDOM_SEED:int = Math.floor(Math.random() * 0xffffff);
public var CHANNEL_OPTION:int = 15;//BitmapDataChannel.RED |BitmapDataChannel.BLUE;//7;
public var offset_array:Array = [new Point(),new Point(), new Point()];
public function onEnterFrame(evt:Event):void{
_bmd.perlinNoise(
BASE_X,
BASE_Y,
OCTAVE_NUMBER,
RANDOM_SEED,
false,
true,
CHANNEL_OPTION,
false,
offset_array
);
offset_array[0].y += 0.5;
offset_array[1].x -= 0.7;
offset_array[2].y -= 0.8;
}
}
}