@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         }

 

相关文章:

  • 2022-12-23
  • 2022-02-12
  • 2022-12-23
  • 2022-12-23
  • 2021-09-26
  • 2021-05-31
  • 2022-12-23
  • 2021-10-16
猜你喜欢
  • 2022-01-16
  • 2021-09-15
  • 2022-12-23
  • 2022-02-16
  • 2021-08-27
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案