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         }
  • 相关阅读:
    Navicat加载缓慢
    使用Typora上传博客到博客园
    echart柱状图X轴文字换行
    pc端可以滑动,手机端不能滑动
    select选择最近3年的年份查询
    JQ延时模糊查询
    reset.css
    base64加密
    第四次博客作业结对项目
    WPF DataGrid显示网格 和TImer定时器
  • 原文地址:https://www.cnblogs.com/ixenos/p/14507521.html
Copyright © 2011-2022 走看看