Jump to content
Search Community

Play timeline in reverse with delay. Seems impossible?

heim_designs test
Moderator Tag

Recommended Posts

I have a code that plays existing timelines on button click. I reuse one of the timeline in different places on website. 
The problem is popupOpen timeline with reverse plays correctly first time. And second time it ignores delay 2 seconds and plays instantly.

I tried all possible methods to solve this - wrappet it in setTimeout, setInterval etc. And nothing helps. I just don't understand why. 
 

Array.from(awrdBtn).forEach(function (btn) {
btn.onclick = function () {
popupOpen.play();
awrds.play();
};
});
 
awrdBtnClose.onclick = function () {
awrds.timeScale(2).reverse();
popupOpen.reverse().delay(2);
};
Link to comment
Share on other sites

Wow I just found the solution and it was so simple. I added .delay(0) tho the initial play. Somehow it solved the problem. Hope it will help someone who encountered with the same issue


 

Array.from(awrdBtn).forEach(function (btn) {
btn.onclick = function () {
popupOpen.play().delay(0);
awrds.timeScale(1).play();
};
});
 
awrdBtnClose.onclick = function () {
awrds.timeScale(2).reverse();
popupOpen.reverse().delay(2);
};
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...