-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Animation hiccups when an object is removed from the DOM #5400
Comments
Without investigating the particulars. In general you should avoid creating and destroying entities and reuse them to prevent unnecessary memory and other resource allocations. Can animate and reset the positions. |
A THREE.js example for reference https://glitch.com/edit/#!/sequoia-global-dove?path=index.html%3A49%3A46 |
Thank you I assume this is not an a-frame issue, but a performance optimization issue then, I'll close it and dismiss it |
I think we should still investigate what's the root cause. no reason I can see why animations shouldn't be always smooth |
Thanks for the clear and concise glitch showing the issue @meduzo. I managed to find the root cause. The removal of the element happens while the scene is processing I've created a PR that addresses this oversight: #5403 setTimeout(() => {
this.parentNode.removeChild(this);
}, 0) |
@mrxz thanks! animation is janky even in the three example: https://glitch.com/edit/#!/sequoia-global-dove?path=index.html%3A49%3A46 There might be additional issues |
With examples above notice that animation can be janky even when the application hits 60fps consistently. So wonder where is the jank coming from. |
Found this https://bugs.chromium.org/p/chromium/issues/detail?id=1164435 but also see stutter in Safari that it's not chromium. Tried on Macbook Air M1. Safari on iOS feels smoother |
@dmarcos I don't really see any jank in the three example. Only occasionally when it hits the bottom, but that's probably due to the With Chrome I did notice that after a while the frame timings started to become inconsistent for brief periods (~1-2s at a time) resulting in slight judder, despite maintaining a steady 60fps. Wondering if it might be better to use the rAF timestamp to derive the delta instead of |
Came across this Codepen: https://codepen.io/joliss/pen/wWKGeV/ @dmarcos Could you test if you see the same issue with this Glitch (using rAF timestamp instead of If that resolves it, this might be worth using as the source for the |
I think more or less the same. I'm not sure whether the issue is on our side or the browser updating the canvas. On chrome I usually have tons of tabs opened so might be a factor. To make sure is not our fault instead of visually it would be worth measuring frame time consistency. If we're hitting the numbers then it might be the browser. |
Description:
Small animation hiccups happen whenever an entity is removed from the dom with "removeChild"
NOTE: Jumps from one frame to another are expected, however sometimes those jumps make the positions mismatch the expected position, see example.
The text was updated successfully, but these errors were encountered: