forked from: Chapter 36 Example 16
forked from Chapter 36 Example 16 (diff: 5)
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/dUoq
*/
// forked from actionscriptbible's Chapter 36 Example 16
package {
import flash.display.*;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.events.TimerEvent;
[SWF(frameRate="200")]
public class ch36ex16 extends Sprite {
protected var bmp:BitmapData;
protected var stitch:Boolean = false;
public function ch36ex16() {
bmp = new BitmapData(20, 200);
var shape:Shape = new Shape();
shape.graphics.lineStyle(100, 0, 0);
shape.graphics.beginBitmapFill(bmp);
shape.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);
shape.graphics.endFill();
addChild(shape);
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
protected function onKeyDown(event:KeyboardEvent):void {
stitch = !stitch;
}
private function onEnterFrame(event:Event):void {
bmp.perlinNoise(100, 100, 2, Math.random()*1000000000000000000, stitch, false, 100, true);
}
}
}
