Fading in different items and different times using Greensock Tween

僤鯓⒐⒋嵵緔 提交于 2019-12-06 16:50:06

TimelineLite's .to() method syntax is as follows:

timeline.to(target, duration, vars, position);

This fourth position parameter is something you can use to exactly position wherever you want your tween to appear. So you could, for example, do:

function startFinalAnimation(){
    var fa = new TimelineLite();
    fa.to(finalAvatar, 2, { scale: 0.45, opacity: 1, transformOrigin:"-3% 8.8%" });
    fa.to(finalContent, 4, { opacity: 1 }, '-=1');
    fa.to(logo, 5, { opacity: 1 }, '-=2');
}

Here, -=1 (and -=2) basically tell that the animation should be added at an overlap of 1 second onto the previous animation's end, instead of the default which is to append at the very end of previously added animation.

There are many ways a position can be provided. Above, I used -=. Other options are (taken from the link provided below):

  • at an absolute time (1).
  • relative to the end of a timeline allowing for gaps ("+=1") or overlaps ("-=1").
  • at a label ("someLabel").
  • relative to a label ("someLabel+=1").

Read more about the position parameter here: Timeline Tip: Understanding the Position Parameter.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!