SwiftUI: Rotation 3D Effect on the Z-Axis

Mark Moeykens
Oct 10, 2019
What does rotating on the Z-axis in 3D look like?

Ha ha, it looks just like using the rotation effect (.rotationEffect) modifier! Yes, if you just rotate on the Z-axis it has the exact same effect as using the rotation effect modifier.

Why is this?

When you set a value just on the Z-axis, you are establishing a line (vector) that is pointing directly at you.


With this vector going straight through the middle of your view (the default anchor point), it will rotate around it as you see in the video.

As I mentioned in the previous post, this anchor point can be repositioned. You will see examples of this in the following posts as well as what effects you can create by combining axis values.

Free SwiftUI Picture Book



Screenshots for every code example? Yes! Get your FREE SwiftUI picture book here.