Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Robert Wildling

GSAP skew different from CSS skew

Recommended Posts

Hi and prosit 2017!

 

I was wondering why GSAP produces different skew-results than CSS? (See CodePen:

See the Pen bgbaeV) by rowild (@rowild) on CodePen

 

I'd like to think to understand the mathematical implementations underneath it, which, in my opinion, would be keeping the sides the same length. But CSS does not adhere to that rule when told to draw 100vh.

 

Is there a way to achieve the similar result with GSAP?

 

Thanks!

See the Pen bgbaeV by rowild (@rowild) on CodePen

Link to comment
Share on other sites

Thank you so much for pointing that out! Very helpful!

 

I did another pen with some "counter clockwise" animation: the parent div contains a child div with an image. That image is skewed counter clockwise in order to appear "correct" all the time. That also means that during the "unskewing" animation, the image is "unskewed" counter-clockwise.

 

During that animation, the image disappears in Chrome, but not in FF. (And, actually, the codepen looks even better that in "real life", where the image is really totally hidden during animation; on codepen it is at least sometimes visible...)

 

Any idea what I am doing wrong here?

 

Adapted CodePen:

See the Pen bgbaeV by rowild (@rowild) on CodePen

Link to comment
Share on other sites

I see nothing wrong in Chrome or Firefox or Safari. The only thing I would say that could be causing this behaviour is the fact that your JavaScript is not waiting the page/assets to finish loading before animating. I'd reckon you're animating the skew before the image has finished loading.

Link to comment
Share on other sites

Hello Robert Wildling and Welcome to the GreenSock Forum!

 

I tested your example in latest Chrome on Windows 10 and the image is still there when animated. It animated the same like Firefox.

 

Maybe your seeing this in Chrome on Mac? .. Is that correct?

Link to comment
Share on other sites

Hello Robert Wildling and Welcome to the GreenSock Forum!

 

I tested your example in latest Chrome on Windows 10 and the image is still there when animated. It animated the same like Firefox.

 

Maybe your seeing this in Chrome on Mac? .. Is that correct?

 

Shouldn't be. I have tested on a Mac, all looked fine.

  • Like 1
Link to comment
Share on other sites

It appeared to look fine for me in Chrome (MAC) but in firefox the red shape seemed flicker erratically during the animation. 

I couldn't get the image to disappear on either browser though.

 

I may not be understanding the exact effect you are going for but I would think an SVG mask would be worth exploring. 

Whatever the issue my hunch is that its a browser rendering bug and not necessarily something GSAP can fix. 

  • Like 1
Link to comment
Share on other sites

If you test and see the image disappear then try viewing your example in a private browsing or incognito mode tab. That will make sure that no extensions or addons are affecting the render of the page. If it still disappears, then it's something else on your computer causing this issue. I would agree with Carl an SVG Mask would be a better option ;)

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