The following code makes a BitmapData object with Perlin noise, and then uses that object as a bitmap fill. Because the stitch parameter is false, the edges are visible as it tiles. : BitmapData : Graphics Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Graphics » BitmapData »

 

The following code makes a BitmapData object with Perlin noise, and then uses that object as a bitmap fill. Because the stitch parameter is false, the edges are visible as it tiles.


 
package {

    import flash.display.BitmapData;
    import flash.display.Shape;
    import flash.display.Sprite;
    import flash.utils.Timer;
    import flash.events.TimerEvent;

    public class Main extends Sprite {

        private var _bitmapData:BitmapData = new BitmapData(200200);

        public function Main() {
            var shape:Shape = new Shape();
            shape.graphics.lineStyle(000);
            shape.graphics.beginBitmapFill(_bitmapData);
            shape.graphics.drawRect(00600400);
            shape.graphics.endFill();
            addChild(shape);

            var timer:Timer = new Timer(1000);
            timer.addEventListener(TimerEvent.TIMER, timerHandler);
            timer.start();

        }

        private function timerHandler(event:TimerEvent):void {
            _bitmapData.perlinNoise(1001001, Math.random() 100000, false, false);
        }

    }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Graphics
» BitmapData