zoukankan      html  css  js  c++  java
  • [ActionScript 3.0] AS3.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);
  • 相关阅读:
    JAVA多线程之AQS
    LRU算法
    JAVA设计之SPI
    JAVA多线程之CAS
    操作系统之中断处理
    计算机领域思想
    操作系统之I/O
    操作系统之虚拟内存
    Mysql事务原理
    Mysql添加索引
  • 原文地址:https://www.cnblogs.com/frost-yen/p/5216986.html
Copyright © 2011-2022 走看看