From the course: Advanced iOS App Development: Core Animation

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Working in 3D

Working in 3D - iOS Tutorial

From the course: Advanced iOS App Development: Core Animation

Start my 1-month free trial

Working in 3D

- [Instructor] To affect a layer in 3D space, we'll need to focus on transforms. Let's go ahead and run the app and see what we're working with with the party time view controller. Now it's not terribly interesting, I'll grant you, but we're gonna liven it up. In this example, we're gonna rotate the party label by 45 degrees on its Y-axis. As usual, we'll start with a new function. We're gonna call this position label, and make ourselves some room inside. Now the first thing we need to do is construct our rotation angle. So we'll say rot angle equals CG float dot pi divided by four, now that's 45 degrees in radians, which is gonna work out good for us. Now we need to transform with the Z-axis perspective set so we can use our helper function here and say rotated transform equals create 3D perspective transform, and we're gonna give the camera distance 800, so that's gonna give us enough distortion that we'll see the 3D rotation, but not too much that it will look silly. Now when…

Contents