Jump to content
Search Community

gsap.config force3D doesn't affect already animated objects.

evomedia.lt test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

gsap.config({force3d: true}) only gets honoured on new tweens with untouched elements.
In my example, if you click on first element, then resize the window to >600px and click the second element, one uses translate() and the other translate3d(), now, if you resize the window (that changes force3d) and keep clicking on the elements they stick to their initial transform variant.

 

Mind, that each click creates new gsap.set or gsap.to animations respectively, so it's not reusing old timeline.

 

Is there a way to force 2d transforms in to 3d globally on the fly as new gsap animation instances are created?

See the Pen OJdEgVG by driezis (@driezis) on CodePen

Link to comment
Share on other sites

  • Solution

That's expected behavior - once you set a force3D on a particular element, that is remembered and you can of course set it to something different anytime. 

 

So you can either set the force3D value on the elements in the matchMedia() -or- you could just use defaults() instead so that it literally acts as if that value is passed into every tween: 

See the Pen mdvKwYb?editors=1010 by GreenSock (@GreenSock) on CodePen

  • Thanks 1
Link to comment
Share on other sites

2 hours ago, GreenSock said:

That's expected behavior - once you set a force3D on a particular element, that is remembered and you can of course set it to something different anytime. 

 

So you can either set the force3D value on the elements in the matchMedia() -or- you could just use defaults() instead so that it literally acts as if that value is passed into every tween: ...

Thank you, defaults will be the way to go.

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