✅ Jittery CSS pan animation
Hi I'm having trouble trying to make a background pan animation in CSS. It pans but it's very jittery. Does anyone have an idea as to why?
Code: https://hastebin.com/share/ewodonebim.javascript
Demo (delete the post if not allowed to post personal links): https://www.tyrells.net/
Hastebin
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
15 Replies
Making the SVG larger has no effect.
I'm going to see if I can do something with transform maybe
I've added
with no difference
going to try a different star pattern svg
No difference with a different star svg
I'd personally do something like
Which is a bit dirty, but it works and
translateX
is much more performant than background-position-x
So its a probably a performance issue. I'm not very good with CSS and frontend stuff but I'll try to get it working with translate like you said. Thank you 🙂
Might take me a few minutes.
:ThumbsUpSmile:
Also, forgot to mention, because
bgWrapper
's position is absolute
the parent; which would be your star-pattern-container
needs to have a relative position
You might also wanna set star-pattern-container
overflow to hidden, or set bgWrapper
's overflow to hiddenYou're a saint. hiding the overflow makes sense to me. I'll mess around with positioning in a few minutes.
:ThumbsUp:
:catlove:
I've got the translate working. I just need to put in on the right div but it does work
https://codepen.io/TyrellR/pen/YzbEmYJ
Thank you
Of course there might be a better way to do it :XD:
I will remove "im a software developer" from the site and replace with "im a code monkey".
Having the background divs inside parent div confused me but I see what you have done. The background is absolute, pushed to the top left and the height of the parent.
I really need to go find a good CSS book and practice it.
We are all code monkeys aren't we :XD:
And yeah having the background be absolute allows it to fill the parent div, though I guess it could be easier to do with flex
Though I think using
absolute
position is easier to reason about personallyI think I will have to abandon the idea unfortunately. Even after switching to transform the performance is identical :pepecry:
https://www.tyrells.net/
The site uses react (just because I like the component structure) so I don't know if that has negatively made a difference
I don't really know how to make use of firefox performance tools to figure out whats going on but I will figure that side of stuff at a later date
It might just be an issue with my browser on further investigation. its perfectly smooth on my phone...
its a problem with firefox. works fine on chromium browers.
Please ignore my ramblings above.
I've got it working exactly as I wanted it to 🙂
https://tyrells.net/
Unknown User•6mo ago
Message Not Public
Sign In & Join Server To View
If you have no further questions, please use /close to mark the forum thread as answered