/** * ... * @author Fraanske */ package { import flash.display.*; import flash.events.*; import flash.geom.*; import flash.utils.*; public class Main extends Sprite { [Embed(source = '../lib/wasteland.jpg')] private var Wasteland:Class; private var bmp:Bitmap; private var sfx_bmp:Bitmap; private var sfx_spr:Sprite; private var count:Number = 0; private var offSets:Array; private var t:Timer; public function Main() { stage.scaleMode = StageScaleMode.EXACT_FIT; bmp = new Bitmap(new Wasteland().bitmapData); addChild(bmp); sfx_spr = new Sprite(); sfx_bmp = new Bitmap(new BitmapData(100, 100, false)); sfx_bmp.bitmapData.fillRect(new Rectangle(0, 0, 1200, 900), 0x000000); sfx_spr.addChild(sfx_bmp); addChild(sfx_spr); sfx_spr.blendMode = BlendMode.MULTIPLY; sfx_spr.width = 1200; sfx_spr.height = 900; var fps:FPS = new FPS(stage); addChild(fps); t = new Timer(10); t.addEventListener(TimerEvent.TIMER, render); t.start(); } private function render(e:* = null):void { count++; offSets = [ new Point(t.currentCount, 0-count * 2), new Point(count, 0-t.currentCount), new Point(count, count), new Point(count, count), new Point(count, count) ]; sfx_bmp.bitmapData.perlinNoise (200, 375, 2, 1, false, false, 2 | 1 | 0, false, offSets); } } }