這是一個小問題,與您的代碼。當您在時間軸上使用fromTo時,from值會賦予您的元素。所以當你說:
tlMeetingFormClose
.fromTo(ctaForm1, 0.8, { autoAlpha: 1, xPercent: '0' }, { autoAlpha: 0, xPercent: '-50', display: 'none', ease: Power2.easeOut })
.set(mainBoxies, {display: 'block'})
.fromTo(mainBoxies, 0.8, { autoAlpha: 0, xPercent: '-50' }, { autoAlpha: 1, xPercent: '0', ease: Power2.easeOut });
tlOnlineFormClose
.fromTo(ctaForm2, 0.8, { autoAlpha: 1, xPercent: '0' }, { autoAlpha: 0, xPercent: '-50', display: 'none', ease: Power2.easeOut })
.set(mainBoxies, {display: 'block'})
.fromTo(mainBoxies, 0.8, { autoAlpha: 0, xPercent: '-50' }, { autoAlpha: 1, xPercent: '0', ease: Power2.easeOut });
然後greensock將autoAlpha 0和xpercent -50應用到mainBoxies。 你只需要使用到,然後給你想要然後在最後的位置,因爲當mainBoxes已經關閉這個時間表將只運行。
當你寫下面的,一切都將正常工作。
tlMeetingFormClose
.fromTo(ctaForm1, 0.8, { autoAlpha: 1, xPercent: '0' }, { autoAlpha: 0, xPercent: '-50', display: 'none', ease: Power2.easeOut })
.set(mainBoxies, {display: 'block'})
.to(mainBoxies, 0.8, { autoAlpha: 1, xPercent: '0', ease: Power2.easeOut });
tlOnlineFormClose
.fromTo(ctaForm2, 0.8, { autoAlpha: 1, xPercent: '0' }, { autoAlpha: 0, xPercent: '-50', display: 'none', ease: Power2.easeOut })
.set(mainBoxies, {display: 'block'})
.to(mainBoxies, 0.8, { autoAlpha: 1, xPercent: '0', ease: Power2.easeOut });
我希望最終結果是您的預期。如果沒有,那麼請讓我知道。
THX的答案,對不起,我沒有注意到它越快。是的,它有幫助 –