您的位置:首页 > 其它

[ActionScript 3.0] AS3.0 水面波纹效果

2016-02-25 14:51 405 查看
import flash.geom.Point;
import flash.display.BitmapData;
import flash.filters.DisplacementMapFilter;
import flash.display.MovieClip;
import flash.events.Event;
/**
* 创建湖面微波效果
*/
function createWater(target:MovieClip):void
{
var count:int = 1;
var point:Point = new Point(0,0);
var bitmap:BitmapData = new BitmapData(target.width,target.height,false,0);
var displ:DisplacementMapFilter = new DisplacementMapFilter(bitmap,point,10,2,10,15,"clamp");
var filter:Array = [];
filter.push(displ);
target.addEventListener(Event.ENTER_FRAME,onEnter);
function onEnter(e:Event):void
{
var offset:Array = [];
offset[0] = new Point(count,count/8);
bitmap.perlinNoise(45,5,3,50,true,false,7,true,offset);
displ.mapBitmap = bitmap;
target.filters = filter;
count++;
}
}
createWater(mc);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: