WebKit Transform Perspective Function
Yar, 3D transform be ahead. Safari only. The examples below also live together in a lovely house in this fiddle.
Safari has support for a perspective transform function. This is pretty convenient for doing a simple 3d transform, like a card flip.
#wkptfn-example1 .alpha {
background: blue;
-webkit-transform: perspective(800) rotateY( 0deg);
}
#wkptfn-example1:hover .alpha {
-webkit-transform: perspective(800) rotateY(-180deg);
}
#wkptfn-example1 .beta {
background: red;
-webkit-transform: perspective(800) rotateY(180deg);
}
#wkptfn-example1:hover .beta {
-webkit-transform: perspective(800) rotateY( 0deg);
}
Hover for Card Flippin’ Action
The problem with it is that the perspective is only for the one element. If you use the same transform across elements with different position, each element will have its own vanishing point.
#wkptfn-example2 div {
-webkit-transform: perspective(800) rotateY(45deg);
}
To remedy this, you need to specify a perspective or the parent with -webkit-perspective:
and then let the children inherit it with -webkit-transform-style: preserve-3d;
#wkptfn-example3 {
-webkit-perspective: 800;
}
#wkptfn-example3 div {
-webkit-transform-style: preserve-3d;
-webkit-transform: rotateY(45deg);
}