Animating a Stepper Button on SwiftUI

Hi, with reference to the project seen here: https://twitter.com/Volorf/status/1813177399078514884

I've been having a hard time to replicate an 3D-animated stepper button, where the button gets depressed spatially when you click on it. Does anyone know the framework to how this should be done?

I appreciate your help.

Answered by arthurfromberlin in 798655022

You could use a SwiftUI 3D Transform and apply it on the view (https://developer.apple.com/documentation/swiftui/view/rotation3deffect(_:axis:anchor:anchorz:perspective:)) or put your view into a RealityKit Attachment and then rotate the Attachment Entity (https://developer.apple.com/documentation/realitykit/transform/rotation).

You could use a SwiftUI 3D Transform and apply it on the view (https://developer.apple.com/documentation/swiftui/view/rotation3deffect(_:axis:anchor:anchorz:perspective:)) or put your view into a RealityKit Attachment and then rotate the Attachment Entity (https://developer.apple.com/documentation/realitykit/transform/rotation).

Animating a Stepper Button on SwiftUI
 
 
Q