7

Building a Series of Belts and Gears

In this project, we’re going to explore rotation, and more specifically, how to use the rotation3DEffect modifier to rotate objects on the x-, y-, and z-axis. We will be doing this by animating a series of gears and belts that will eventually move a fan blade.

As we create this project, we will also explore how to use Groups and Pragma Marks to make your code more organized, and the zIndex property, which changes the depth of views.

In this chapter, we will cover the following topics:

  • Animating our first circular gear
  • Adding a worm gear using shadows
  • Using a marching ants effect to create a gear belt
  • Animating a gear shaft image
  • Animating a fan image
  • Bringing everything together in ContentView

Technical ...

Get Animating SwiftUI Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.