Jump to content
GreenSock

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

No translate3d ?

Recommended Posts

Can't i use translate3d in my tweens?

I see x and y for translate, but no translate3d!

Link to post
Share on other sites

Sure, just use z. 

 

TweenLite.to(element, 1, {x:100, y:20, z:300});
 
Link to post
Share on other sites

But x and y will be a 2d translate and not the same as translateX and translateY.

Link to post
Share on other sites
Isn't that right that translate3d triggers hardware acceleration?

So it would be better to use it when it's available...
Link to post
Share on other sites

Yep, and for the record, translate3d() is no different (as far as I know) than adding a translateZ() in terms of triggering hardware acceleration. The whole idea is to just have a non-zero z. It's just that translate3d() is a shorter way than typing out translateX() translateY() translateZ() 

  • Like 1
Link to post
Share on other sites

Ok.

I am using: "{x: 0, y: 0, z: .001}" to replace "translate3d(0, 0, 0)"... is there a way I can trigger this without using a low z value?

Link to post
Share on other sites

Yes in GSAP there is a force3D property you can add to a tween that tells the object to apply this tweak. It only needs to be added to an object once and GSAP will remember it for future tweens.

TweenLite.to(foo, 1, { x:100, force3D:true });
  • Like 4
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

  • Recently Browsing   0 members

    No registered users viewing this page.

×