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

the removed animation played when page state changed (document visibilitychange event) #560

Closed
elvira1112 opened this issue Mar 25, 2019 · 2 comments · Fixed by #701
Closed

Comments

@elvira1112
Copy link

Describe the bug:
I remove an animation, but it played when i trigger the document visibilitychange event.
I found that It doesn't remove the animation when i removed. And when it run into visibilitychange event, it played all of pause animation.

To Reproduce:

  1. remove an animation
  2. i slide my desktop on my mac, i guess switch tab also can trigger the bug. Anyway, to trigger the visibilitychange event.

Expected behavior:

  1. my removed animation can not replay

Desktop:
browser chrome v73.0.3683.75

@juliangarnier
Copy link
Owner

Fixed in v3.1.0!

@fljot
Copy link
Contributor

fljot commented Jun 29, 2020

@juliangarnier @chrisbrown-io I think bug is still there, at least partially perhaps.

Steps to reproduce:

  1. deactivate tab (so it would become document.visibilityState === 'hidden')
  2. run myAnimation.pause() (while document.visibilityState === 'hidden')
  3. get back to tab, so it would trigger visibilitychange event

Actual results:
Anime restores animations https://github.com/juliangarnier/anime/blob/3.2.0/src/index.js#L875 including those which were explicitly paused by user (in step 2)
image

upd: opened PR #701

fljot added a commit to fljot/anime that referenced this issue Jul 6, 2020
…liangarnier#560)

instances paused by user were starting again after returning to browser tab ('visibilitychange' event)
fljot added a commit to fljot/anime that referenced this issue Jul 6, 2020
…liangarnier#560)

instances paused by user were starting again after returning to browser tab ('visibilitychange' event)
fljot added a commit to fljot/anime that referenced this issue Jul 19, 2020
Bug description:
animation instances, previously paused by user, were activated again after returning back to browser tab ('visibilitychange' event).
This could cause unwanted animations and memory leaks.

Demo:
https://codepen.io/fljot/pen/oNbEdBj

Solution:
Instead of dealing with animations' public API (pause, play methods), which are used in userland code, we suspend engine itself (rAF ticks).
fljot added a commit to fljot/anime that referenced this issue Jul 19, 2020
Bug description:
animation instances, previously paused by user, were activated again after returning back to browser tab ('visibilitychange' event).
This could cause unwanted animations and memory leaks.

Demo:
https://codepen.io/fljot/pen/oNbEdBj

Solution:
Instead of dealing with animations' public API (pause, play methods), which are used in userland code, we suspend engine itself (rAF ticks).
juliangarnier added a commit that referenced this issue Oct 11, 2020
Fix bug with 'visibilitychange' event and paused instances (fixes: #560)
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

Successfully merging a pull request may close this issue.

3 participants