Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some questions about rotate 180deg and SkewX 180deg #605

Open
zbysir opened this issue Nov 29, 2024 · 1 comment
Open

Some questions about rotate 180deg and SkewX 180deg #605

zbysir opened this issue Nov 29, 2024 · 1 comment

Comments

@zbysir
Copy link

zbysir commented Nov 29, 2024

The previous issue related to this one is: #585

In this issue, I fixed the previous problem using a temporary solution: gsap.set(squares, {clearProps: true});. However, now I am encountering another issue.

The example is here: https://codepen.io/zbysir/pen/azozVYx. After clicking on the squares, the elements undergo some strange transformations due to the SkewX transition.

Now that I understand how GSAP works, I realize that it cannot accurately obtain the rotate value from the matrix, as referenced here: https://gsap.com/resources/mistakes/#not-setting-all-transforms-with-gsap.

However, I am reluctant to switch to the (“directly via GSAP”) approach because, in my application, the transformations of the elements are controlled by the class of the parent element, and the elements themselves do not know what they should look like. Therefore, implementing "directly via GSAP" is a bit challenging for me (though not impossible).

I am still hoping for some unknown tech that could alleviate my problem.

@jackdoyle
Copy link
Member

Yeah, it's always going to be cleanest to set things via GSAP directly. You could still basically recreate what you're doing in your CSS rule, but with a gsap.set() (and the same rule for the target selector text).

If that's too painful for some reason, I suppose in this case you could avoid the rotation issue by setting rotate(179.9deg) instead of rotate(180deg) because the decomposed matrix values more closely align with what you're attempting here. But again, I think it's always best to be explicit with your transform values in GSAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants