Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
opila

Stuttering effect for marginRight on background element in Apple iOS Safari

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

Share this post


Link to post
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

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

I'm sorry it looks like I didn't post my demo above. I posted yours by accident (fixed now)

 

See if this works for you:

 

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

 

Share this post


Link to post
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

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. 


  • Recently Browsing   0 members

    No registered users viewing this page.

×