Jump to content
Search Community

transform: skewX and TweenLite skewX don't match.

Craig 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

Hey! So I've been using TweenLite to set a ton of CSS properties, but noticed when I converted my script to use TweenLite CSS, my skew was off. It looks like the transform matrix isn't quite right.

 

Here's a CodePen showing what happens: 

See the Pen bnhJy by anon (@anon) on CodePen

 

Any ideas how I could work around this? Thanks!

Link to comment
Share on other sites

Yep, that's very intentional although I can see why it may be a little confusing for you. There are two ways of skewing - one is to simply stretch it along one axis without compensating the other axis at all. The down side of that is that it doesn't "feel" natural (at least the way most people think of "natural") and it can make things SUPER wide/tall. For example, try doing a skewX of 89 degrees. Or worse yet, 89.99deg. The closer you get to 90 degrees, the more it'll move toward infinitely wide. 

 

The other way of doing skew is to compensate along the other axis so that things act more like a 3D spin. That's the algorithm we use, and it is consistent with how things work in Flash (a large portion of our user base comes from Flash and love the consistency). Again, the purpose is to have it look more natural. 

 

If you'd prefer to have the former algorithm, you could either use an onUpdate to calculate and apply the matrix yourself, or create your own plugin. I know, neither of these are ideal and they both require a fair amount of extra work to handle things well across browsers. I wish I had a super easy answer for you, but hopefully you understand now why we use the algorithm we do - it's not a bug, it's actually a feature :)

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