r/javascript • • Mar 13 '22

Javascript mouse hover 3d card effect :D

https://codepen.io/rudtjd2548/details/GRyRwoj

[removed] — view removed post

114 Upvotes

22 comments sorted by

View all comments

2

u/sigmazaddy Mar 13 '22

Idk why but when you hover down it looks like the bottom is coming up

3

u/yummy-codding Mar 13 '22

https://codepen.io/evan-jin/pen/VwywNOB

I made it for you to understand :) it is because we are rotating 2d card so if we just rotate to top or bottom, then it looks the same

transform: rotate3d(2, 0, 0, 20deg);

transform: rotate3d(-2, 0, 0, 20deg);

these two options will look the same

thank you!

ref: https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/rotate3d()