The randomSeed parameter is responsible for the randomness of the noise
package {
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.utils.Timer;
import flash.events.TimerEvent;
public class Main extends Sprite {
private var _bitmapData:BitmapData = new BitmapData(400, 400);
public function Main () {
var bitmap:Bitmap = new Bitmap(_bitmapData);
addChild(bitmap);
var timer:Timer = new Timer(50);
timer.addEventListener(TimerEvent.TIMER, timerHandler);
timer.start();
}
private function timerHandler(event:TimerEvent):void {
_bitmapData.perlinNoise(100, 100, 1, Math.random() * 1000, false, false);
}
}
}
Related examples in the same category