I'm playing around with rotation3DEffect trying to have a text "orbiting" around an axis while having the text always facing me.
I realized I could apply rotation3DEffect twice:
first time before offsetting the text so it rotates on itself and the second time after the the offsetting so it rotates around an axis with the offset as radius.
While it works with the Z axis, it doesn't work with the others. As if as soon as the angle is 90° the text has to be "flat".
Can't figure out why. I looked everywhere and saw no mention of this so I might have missed something. Any help appreciated thanks!
struct ContentView: View {
@State private var rot = 0.0
var body: some View {
VStack{
Text("BLABL fsdfsqfsfq ZBLA ")
.frame(width: 40)
.rotation3DEffect(.degrees(-rot), axis: (x: 0, y: 0, z: 1), perspective: 0.10)
.offset(x: 0, y: 180)
.rotation3DEffect(.degrees(rot), axis: (x: 0, y: 0, z: 1), perspective: 0.10)
Slider(value: $rot, in: 0...360).frame(width: 300).padding(.vertical, -10)
}