I've been creating iPhone apps for a while now, using basic transformations (rotations, scale, etc) but now I'd like to do something a little more complex.
Maths really isn't my strongest point... but I was wondering how I might go about adding 'perspective' to a UIView (see the image below). I quickly mocked the screenshot up using skew options in Photoshop.
I have had a look around stackoverflow for solutions to this, I found How do I apply a perspective transform to a UIView? which works excellently - but it's not really what i'm after because the height of the left most edge is larger than the right most edge.
Does anyone know how I might go about doing this CATransform3D but without these differing heights?
alt text http://img594.imageshack.us/img594/4354/perspectivel.png
If you just want to skew, you don't need 3D transform. An affine transform will suffice.
this is a modified copy&paste from a project which has a similar transform, but you may need to tune the parameters a and b. This will give a 1 in 9 rise from left to right (
0.1
/0.9
), while condensing from left to right to 90% (0.9
).