效果
首先将创建6个eui.Label,将6个push到一个数组中,
private TweenTest() { for (var i = 0; i < this.cry.length; i++) { egret.Tween.removeTweens(this.cry[i]); if (this.cry[i].y < 25) { this.cry[i].y = 150; this.cry[i].textFlow = HtmlUtil.HTMLPARSER.parser(RandomCarousel.getCarousel()); }if(i==5){ egret.Tween.get(this.cry[i]).to({ y: this.cry[i].y - 25 }, 1000, egret.Ease.sineIn).call(this.TweenTest, this); }else{ egret.Tween.get(this.cry[i]).to({ y: this.cry[i].y - 25 }, 1000, egret.Ease.sineIn); } } }egret.Tween.removeTweens(this.cry[i]);首先清除缓动;
this.cry[i].textFlow = HtmlUtil.HTMLPARSER.parser(RandomCarousel.getCarousel());将含有html标签的代码转义
egret.Tween.get(this.cry[i]).to({ y: this.cry[i].y - 25 }, 1000, egret.Ease.sineIn).call(this.TweenTest, this);设置缓动效果,在后面添加CALL函数在缓动执行完成后再调用CALL里面的方法
f (i == 5)添加IF判断可以避免引擎在FPS的影响下导致Y值得不确定性,Y值不确定会导致this.cry[i].y < 25条件不成立不能递归
要设置渐渐消失的动画就要添加一个遮罩(遮罩)