Jump to content
Search Community

ios bug on rotation

shawnalee test
Moderator Tag

Go to solution Solved by PointC,

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

Hello shawnalee, and Welcome to the GreenSock Forums

 

I'm not near my computer right now, but what if you change your rotation for your city tween:

 

From this -360:

TweenMax.to('#city', 30, {rotation:-360, transformOrigin: '53.3% 54.7%', ease:Linear.easeNone, repeat:-1});

to this using a relative tween "-=360_cw":

TweenMax.to('#city', 30, {rotation:"-=360_cw", transformOrigin: '53.3% 54.7%', ease:Linear.easeNone, repeat:-1});

See CSSPlugin Docs:

 

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

 

Under directionalRotation

 

See if that works for you :)

Link to comment
Share on other sites

  • Solution

Looks like Carl may be working on answer, but I'll sneak in here quickly. Have you tried using svgOrigin instead of transformOrigin on your group? Please give this a try on your city group:

TweenMax.to('#city', 30, {rotation:"-=360_cw", svgOrigin: '188.78 188.96', ease:Linear.easeNone, repeat:-1});

Hopefully that helps.

 

Happy tweening.

:)

  • Like 3
Link to comment
Share on other sites

Interesting - the problem boils down to something you can see with one line of code in your example:

console.log(document.querySelector("#city").getBBox());
//Safari: {x: -0.8500000238418579, y: 0, width: 319.9736328125, height: 335.6852111816406}
//Other browsers: {x: 42.81999969482422, y: 50.01018524169922, width: 276.7608337402344, height: 286.3160705566406}

As you can see, that's not related to GSAP at all. Pretty annoying, I know. I think it has to do with the way Safari is handling the transforms in your elements (I noticed you've got a transform applied to almost everything), like it's including those when it calculates the bounding box. 

 

Craig's solution with svgOrigin seems like the best, easiest solution here. I don't see a good way for GSAP to somehow work around this Safari issue without having to literally loop through every child and remove its transforms, do the measurement, and then add them back (CPU-intensive, and the code would bloat CSSPlugin). Hopefully Safari will get this fixed soon. 

  • Like 3
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...