2

How do x, y and z arguments define an axis in the rotation3DEffect ?

Since the documentation doesn't explain anything, I've found this on Hacking With Swift by Paul Hudson.

It says

If you’ve never done 3D rotation before you should think about the X/Y/Z axes as being skewers through your views. The X axis goes horizontally, so if you rotate on the X axis it’s like putting a horizontal skewer through your view – any rotation makes the top or bottom nearer or further, but won’t adjust the leading and trailing edges.

Okay but now my doubt is, in :

Text("EPISODE LLVM")
    .font(.largeTitle)
    .foregroundColor(.yellow)
    .rotation3DEffect(.degrees(45), axis: (x: 1, y: 0, z: 0))

How does the value of x, y and z matter if we are going to anyways turn it an angle of 45 degrees with respect to those axes

Won't it make more logical sense to have something like this ?

.rotation3DEffect(.degrees(45), axis: (x: true, y: false, z: false))
Tilak Madichetti
  • 4,110
  • 5
  • 34
  • 52
  • It should be an axis from the origin. so the normal of (x,y,z) gives the direction – E.Coms Jan 08 '20 at 05:13
  • You can find example of `rotation3DEffect` usage (with animation) in [this post](https://stackoverflow.com/a/59573632/12299030). BTW, axis can be (x: 0.2, y: 0.7, z: 0), which you can't achieve with boolean. – Asperi Jan 08 '20 at 05:41

0 Answers0