Laya 拖尾简要示例
Laya 拖尾简要示例
@author ixenos 2020-05-26 16:13:42
1 Laya.timer.frameLoop(2,this,trailLoop);//隔几帧,看效果来决定 2 3 private function trailLoop():void{ 4 var trail:Image = Pool.getItemByClass("FLY_TRAIL",Image);//拖尾必须用对象池,你懂的 5 trial.skin = TRAIL_SKIN; 6 parent.addChild(trail); 7 trail.pos(target.x,target.y);//帧跟随宿主 8 Tween.to(trail,{scaleX:0,scaleY:0,alpha:0},500,null,Handler.create(this,recoverTrail,[trail]));//recover时进行事件清理和属性初始化,注意要Pool.recover 9 }