Jump to content
Search Community

TweenMax.to animation issue on iOS9

AcharaKelley 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

Hi,

I'm experiencing an issue with TweenMax.to on iOS9. 

 

var scrollTarget = { scrollLeft: 100 };

var animTime = 0.25;

TweenMax.to(this._contentContainer, animTime, scrollTarget);

 

The animation works fine on desktop, iOS 7, and iOS 8. But on iOS 9 the animation is very choppy and instead of animating for 0.25 second, it would take 5 - 10 seconds to move with the choppy animation to complete.

 

I found that once I set the animTime to zero, the slide will just snap to place without the animation but that will prevent it from the poor performance.

 

I'm wondering if anyone had the similar experience and can give me suggestions.

 

Thank you so much!

Link to comment
Share on other sites

Thanks, Diaco.

 

I will create a codepen.

 

The issue didn't happen with only ScrollLeft though. It happened with 

-  TweenMax.to(obj, 0.3, {display: 'block'});  and TweenMax.to(obj, 0.3, {display: 'none'});

 

- var target = {

              className: 'tile',
              overwrite: 'none'
            }

  TweenMax.to(obj, 0.3, target);

 

- TweenMax.to(obj, 0.3, { scale: 1 });

 

Have you ever seen this issue on iOS9 before? Thanks!

Achara

Link to comment
Share on other sites

Hello AcharaKelley, and Welcome to the GreenSock Forum!

 

Is there any reason you are trying to animate display:block to display none? i could see why that might cause an issue on iOS.

 

GSAP can animate any numerical object or property. But i notice you are trying to animate a static string value like display block to none.

 

Why not just use autoAlpha and then you can do your fadeOut. autoAlpha is part of the GSAP CSSPlugin:

 

autoAlpha

Identical to opacity except that when the value hits 0 the visibility property will be set to "hidden" in order to improve browser rendering performance and prevent clicks/interactivity on the target. When the value is anything other than 0, visibility will be set to "inherit". It is not set to "visible" in order to honor inheritance (imagine the parent element is hidden - setting the child to visible explicitly would cause it to appear when that's probably not what was intended). And for convenience, if the element's visibility is initially set to "hidden" and opacity is 1, it will assume opacity should also start at 0. This makes it simple to start things out on your page as invisible (set your css visibility:hidden) and then fade them in whenever you want.

//fade out and set visibility:hidden
TweenLite.to(element, 2, {autoAlpha:0});
 
//in 2 seconds, fade back in with visibility:visible
TweenLite.to(element, 2, {autoAlpha:1, delay:2});

If you only need to just set the display to block or none.. Then you wont need a to() tween and then you can just use the GSAP set() method

 

GSAP set() : http://greensock.com/docs/#/HTML5/GSAP/TweenMax/set/

GSAP to() : http://greensock.com/docs/#/HTML5/GSAP/TweenMax/to/

GSAP CSSPlugin : http://greensock.com/docs/#/HTML5/Plugins/CSSPlugin/

 

But as Diaco advised above a codepen demo example would really be helpful to see your code in context

 

:)

  • Like 3
Link to comment
Share on other sites

  • 3 months later...

Hello AcharaKelley, and Welcome to the GreenSock Forum!

 

Is there any reason you are trying to animate display:block to display none? i could see why that might cause an issue on iOS.

 

GSAP can animate any numerical object or property. But i notice you are trying to animate a static string value like display block to none.

 

I can confirm this causes is issues in iOS9 web views based on somebody at my company trying to do exactly that with display block to none and back. In one method they did it on like a dozen elements causing an entire app to crash to desktop. Looks like iOS9's renderer isn't too picky about how it handles properties that aren't on a continuum that it pulls in from requestAnimationFrame handlers. Browsers seem smart enough to just set the target on the last frame.

 

Visibility:hidden doesn't make elements unclickable or pull them out of flow, FYI. You want display:none for that.

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...