码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2016-02-25 15:18:04      阅读:248      评论:0      收藏:0      [点我收藏+]

标签:

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);

 

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

标签:

原文地址:http://www.cnblogs.com/frost-yen/p/5216986.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!