水面杂点滤镜

时间:2018-09-06 04:01:17
【文件属性】:

文件名称:水面杂点滤镜

文件大小:2KB

文件格式:AS

更新时间:2018-09-06 04:01:17

水面杂点滤镜

BitmapWater,水面杂点滤镜 package { import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.BitmapDataChannel; import flash.display.Sprite; import flash.events.TimerEvent; import flash.filters.DisplacementMapFilter; import flash.geom.Point; import flash.utils.Timer; /** * ... * @author telds[kingfo] */ public class BitmapWater extends Sprite { public function BitmapWater() { var renderTimer:Timer; var img:Bitmap = new IMG() as Bitmap; var imgH:Number = img.height; var imgW:Number = img.width; var bmd:BitmapData = new BitmapData(imgW, imgW, false, 0); var baseX:Number = 50; var baseY:Number = 50; var numOctaves:uint = 3; var randomSeed:int = Math.floor(Math.random() * 100000); var stitch:Boolean = true; var fractalNoise:Boolean = true; var channelOptions:uint = BitmapDataChannel.RED; var grayScale:Boolean = false; var offsets:Array = [new Point()]; addChild(img); renderTimer = new Timer(10, 0); renderTimer.addEventListener(TimerEvent.TIMER, function Todo(event:TimerEvent):void { bmd.perlinNoise(baseX, baseY, numOctaves, randomSeed, stitch, fractalNoise, channelOptions, grayScale, offsets); offsets[0].x = offsets[0].x + 20; offsets[0].y = offsets[0].y - 20; img.filters = [new DisplacementMapFilter(bmd, new Point(0, 0), channelOptions, channelOptions, 10, 10)]; }) renderTimer.start(); } [Embed(source='../bin/123.jpg')] private var IMG:Class; } }


网友评论