/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var bm:BitmapData=new BitmapData(img_mc.width, img_mc.height); var disp:DisplacementMapFilter = new DisplacementMapFilter(bm,new Point(0,0),1,2,20,25, DisplacementMapFilterMode.CLAMP); var offsets:Array = [new Point(0, 0), new Point(0, 0)]; addEventListener(Event.ENTER_FRAME, doUpdate); function doUpdate(evt:Event):void { offsets[0].x -=4; offsets[1].y -=1; bm.perlinNoise(45, 20, 2 ,50, true, false, 7, true, offsets); img_mc.filters=[disp]; }