zoukankan      html  css  js  c++  java
  • Laya 渐隐渐显的递归实现

    Laya 渐隐渐显的递归实现

    @ixenos 2021年3月9日

    1.frameLoop 版

     1         public function lineFadeInOut():void{
     2             fadeInFunc(4,fadeInFunc);
     3         }
     4         
     5         private function fadeInFunc(lastTimes:int,complete:Function):void{
     6             if(lastTimes>0){
     7                 this.timer.frameLoop(1,this,fadeLoop,[lastTimes-1,complete]);
     8             }
     9         }
    10         
    11         private function fadeLoop(lastTimes:int,complete:Function):void{
    12             var add:Boolean = (lastTimes-1)%2==0;
    13             if(add){
    14                 if(lineImg.alpha>0){
    15                     lineImg.alpha -= 0.075;
    16                 }else{
    17                     this.timer.clear(this,fadeLoop);
    18                     if(complete){
    19                         complete.call(this,lastTimes,complete);
    20                     }
    21                 }
    22             }else{
    23                 if(lineImg.alpha<1){
    24                     lineImg.alpha += 0.075;
    25                 }else{
    26                     this.timer.clear(this,fadeLoop);
    27                     if(complete){
    28                         complete.call(this,lastTimes,complete);
    29                     }
    30                 }
    31             }
    32         }

    2.tween实现

     1         private function lineFadeInOut():void{
     2             fadeInFunc(4,Handler.create(this,fadeInFunc,null,false));
     3         }
     4         
     5         private function fadeInFunc(lastTimes:int,complete:Handler):void{
     6             Tween.clearTween(boxT.lineImg);
     7             if(lastTimes>0){
     8                 var aimAlpha:Number = 0;
     9                 if(boxT.lineImg.alpha<1){
    10                     aimAlpha = 1;
    11                 }
    12                 if(complete){
    13                     complete.args = [lastTimes-1,complete];
    14                 }
    15                 Tween.to(boxT.lineImg,{alpha:aimAlpha},380,null,complete);
    16             }
    17         }
  • 相关阅读:
    远程调试 ASP.NET MVC 项目
    两行代码搞定 JavaScript 的日期验证
    ASP.NET MVC 静态资源打包和压缩问题小记
    CodeSmith7连接Mysql
    网站开发烦心记-1
    感悟还是教训,或者。。。
    可以断点续传的scp
    CTP报单状态
    android studio 0.8.8下载
    期货结算单查询
  • 原文地址:https://www.cnblogs.com/ixenos/p/14507521.html
Copyright © 2011-2022 走看看