Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeline play() and seek() when completed #122

Closed
tomsercu opened this issue Mar 9, 2017 · 1 comment
Closed

Timeline play() and seek() when completed #122

tomsercu opened this issue Mar 9, 2017 · 1 comment

Comments

@tomsercu
Copy link

tomsercu commented Mar 9, 2017

I believe there's a bug with the behavior of play() when a timeline animation is completed (fwiw I also have autoplay: false).
The animation restarts, but TL.completed (in chrome console) shows false.
When triggering play() again in this fake-restarted state, the animation is interrupted and restarted.

And kind of related, when using TL.seek(t) with t<TL.duration, the TL.completed flag stays false, and TL.play() has no effect. This behavior seems wrong also.

I have the following fixes for now:

mySvg.on({
    // Some kind of playItSafe() function which doesn't fake-restart.
    mouseenter: function() { TL.completed ? null : TL.play() },
    mouseleave: TL.pause,
    click:      TL.restart
});
seekbar.addEventListener('input', function() {
    if (TL.completed && seekbar.value < 100) { TL.restart(); TL.pause();}
    TL.seek(TL.duration * seekbar.value / 100);
});
@tomsercu
Copy link
Author

Confirmed that this works for me on the canary-59-debug branch. Thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants