Perspective based rotation : I have a div which i want to rotate in CSS3 using webkit. The div is rotated after a usermouse down event in jquery
I use keyframes to do that
@-webkit-keyframes rotate {
enter code here
0% {
-webkit-transform: rotate(0deg);
}100% {
-webkit-transform: rotate(90deg);
}
}
@-webkit-keyframes rotate2 {
0% {
-webkit-transform: rotate(90deg);
-webkit-transform: rotateX(45deg);
}100% {
-webkit-transform: rotate(180deg);
-webkit-transform: rotateX(45deg);
}
}
@-webkit-keyframes rotate3 {
0% {
-webkit-transform: rotate(180deg);
}100% {
-webkit-transform: rotate(270deg);
}
}
@-webkit-keyframes rotate4 {
0% {
-webkit-transform: rotate(270deg);
}100% {
-webkit-transform: rotate(360deg);
}
}
My question is I have also applied webkit perspective to give a 3d kind of view and I have to rotate the div keeping the perspective X angle to 45deg...how is it possible ?
body {
-webkit-transform-style: preserve-3d;
-webkit-perspective: 500;
-webkit-perspective-origin: 45%;
}
#mydiv {
height: 300px;
width: 100px;
border: 2px solid #D3DAED;
position:absolute;
top:29%;
left:45%;
**-webkit-transform: rotateX(45deg);**
}
I don't really understand exactly what you are trying to do, but in jquery you can alter css dynamically like this: