Graphics Reference
In-Depth Information
CATransform3D outer = CATransform3DIdentity ;
outer. m34 = - 1.0 / 500.0 ;
outer = CATransform3DRotate (outer, M_PI_4 , 0 , 1 , 0 );
self . outerView . layer . transform = outer;
//rotate the inner layer -45 degrees
CATransform3D inner = CATransform3DIdentity ;
inner. m34 = - 1.0 / 500.0 ;
inner = CATransform3DRotate (inner, - M_PI_4 , 0 , 1 , 0 );
self . innerView . layer . transform = inner;
}
We should expect to see something like Figure 5.17.
Figure 5.17 Expected result of opposite rotations around the Y axis
But that's not what we see. Instead, what we see looks like Figure 5.18. What's happened?
Our inner layer is still noticeably tilted to the left, and it's also distorted; it was supposed to
be face-on and square!
It turns out that although Core Animation layers exist in 3D space, they don't all exist in the
same 3D space. The 3D scene within each layer is flattened. When you look at a layer from
face on, you see the illusion of a 3D scene created by its sublayers, but as you tilt the layer
away, you realize that 3D scene is just painted on the layer surface.
Search WWH ::




Custom Search