Jump to content
Search Community

Tweening transform in viewport units

tamlyn 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

This works:

TweenLite.to(el, 1, {top: '100vh'})

But this doesn't:

TweenLite.to(el, 1, {y: '100vh'})

In the first instance the elements ends up with style="top: 100vh" but in the second it ignores the unit and ends up with style="transform: translate3d(0, 100px, 0)"

 

Any way to force the transform tween to use viewport units? 

Link to comment
Share on other sites

I'm not exactly sure how the CSS Plugin deals with x/y units that are not "px" or "%".

 

This is probably not what you were looking for, but when all else fails, you can always tween a transform with your special units.

TweenLite.to(element, 1, { transform: "translate3d(15em, 50vh, 0)" });
  • Thanks 1
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...