egret study notes screen message scrolling 5.6

Effect

First will create 6 eui.Labels, push 6 into an array,
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]); first clear the easing;
this.cry[i].textFlow = HtmlUtil.HTMLPARSER.parser(RandomCarousel.getCarousel()); Escape the code containing html tags

egret.Tween.get(this.cry[i]).to({ y: this.cry[i].y - 25 }, 1000, egret.Ease.sineIn).call(this.TweenTest, this); set For the easing effect, add the CALL function later and call the method in the CALL after the easing execution is completed.

f (i == 5) Adding IF judgment can avoid the uncertainty of Y value caused by the engine under the influence of FPS, and the uncertainty of Y value will lead to the condition that this.cry[i].y < 25 is not established and cannot be recursed

To animate the fade away add a mask (mask)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325480278&siteId=291194637