Jump to content
Search Community

Stuttering effect for marginRight on background element in Apple iOS Safari

opila test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

I noticed that very specific to  Apple iOS mobile devices using the Safari browser on mobile, using the animation effect marginRight for background elements having a background-image with repeat-x seemed to have a stuttering effect. When viewed in desktop browsers and browsers other than Safari, the stuttering effect on the background repeated element is not seen. Is it because of one of the CSS effects I applied, which is the width != 100%, or is it the way GSAP JavaScript code is written? Please kindly view the Codepen attached. All good helpful feedback appreciated!

See the Pen jaJwbO by opila (@opila) on CodePen

Link to comment
Share on other sites

Thanks for the demo. It's usually recommended to avoid animating margin as it triggers layout changes in the browser.

https://www.html5rocks.com/en/tutorials/speed/high-performance-animations/

https://csstriggers.com/

 

I did not see your demo stuttering, but I'm running some older iOS software.

 

I think animating x or xPercent (uses css transforms) might do better.

Please test this:

 

See the Pen WXmOPx by GreenSock (@GreenSock) on CodePen

 

  • Like 2
Link to comment
Share on other sites

I did try replacing marginRight with x in the JavaScript section, however the background itself won't repeat after passing 70-80% mark.

Which CSS properties would be required to be modified in order to allow the background itself to have an infinite loop of the same image, but having the JS animate on the x property instead of marginRight?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...