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 }
