-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
scrollTop animation flashes when animating #257
Comments
Seems to be working for me for me. I can't see any flashing, testing on Safari and Chrome. Have you tried different easing functions? |
Oh I think I just saw it. Seems to happen only when I click to move to the next section before the previous animation has finished. |
@LukeCThompson it happens a frame before the animation ends, best way to see it is click twice and wait for the animation to end. While this demo doesn't show it off greatly, it's very noticeable when you scroll to a section of a website and before the animation ends you get a flash of the website (where you scrolled from). Edit: |
This seems to fix it:
I have actually come across this before with other elements, for example an open and close on an accordion. I think that if you call anime() on an object that already is animating it should remove it before setting the animation again. That way it doesn't fight. Or if anime is called on an object but it's animating the same properties. |
This is an issue that shows up often.
It can be useful to keep the option to call multiple anime instance on the same element without canceling the animations when multiple parameters are animated. I'm looking into this right now. Looking for a way to detect if the element as a similar property animated and only cancel this property, but not the full animation. I'm just a bit worried about the performance cost of this kind of initial check. |
@juliangarnier Just to let you know, I've tried 3.0.0 and it's so much better now. Thank you very much 👍 . I'm using this in a different example where an underline follows the menu link, it was flashing before as per ScrollTop, no longer happening. I understand 3.0.0 isn't finished, but I had to compile it as .min.js currently isn't working. |
I see same flushes with completely different animations. Looks like this is the issue with this library itself. |
@TomS- thanks a lot for pointing this anime.remove() this solved an issue for me as well! |
Fixed in V3. |
Hi @juliangarnier |
I tried @TomS- method of removing any animations from the target element first before animating again, and it worked. |
I've pretty much dropped jQuery in favour of pure Javascript. One thing I used jQuery for was animating scrollTop, now I'm using anime.js for that.
However, it causes "flashes" and doesn't feel smooth.
https://codepen.io/anon/pen/mBLGRx - if you just keep clicking the page, you can see the flash.
The text was updated successfully, but these errors were encountered: