-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
[v4] Make 3D rotations composable #13319
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
Conversation
|
This looks good but I think it's weird that |
|
Do we want to reconsider whether arbitrary |
@thecrypticace tough one — I agree overall but it also means it wouldn't be possible to cancel something on the I think my gut here is to leave it as-is to avoid backing ourselves into a corner by being too clever, even if it could be helpful. Easier to add later than to take away I think? I dunno. |
@KrisBraun I think I still feel like |
KrisBraun
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
c6cdafb to
0e8292b
Compare
Our original implementation of 3D rotations was limited to the
rotateproperty in CSS, which only allows specifying a single angle around either a specified axis or vector.The more I played with this the less intuitive I found it to be, so we've decided to support composable 3D rotations via
transformthat let you do stuff like this:The order of rotations matters in transforms, so I looked to Framer Motion to see what order they use, which is X → Y → Z.
I think you can make arguments for a variety of orders, but I've decided to use the same one as Framer Motion just because I think it's nice to be able to build something with Tailwind, then later move those styles to Framer Motion because you have some idea for some interesting effect and be able to reuse all of the same values.
Importantly, I've kept the
rotate-*utilities as well which still use therotateproperty. It can also be composed withrotate-x-*androtate-y-*because it's a separate property, but generally I think it will make more sense to userotate-z-*explicitly when trying to compose a 3D rotation, as the order of operations feels more intuitive to me at least.