How to make the following animation? Aura appears when touching the button and the whole box shrinks a bit like from the weight of finger.
struct ContentView: View {
var body: some View {
Button(action: {
}, label: {
Image(systemName: "camera")
.font(.title)
.opacity(1)
})
.padding(.horizontal, 20)
.frame(height: 80)
.background(Color.yellow.opacity(0.2).clipShape(Circle()))
}
}
Here is a solution using a ZStack and scaleEffect. Shrink the icon when pressed and restore on complete. Opposite for the circle, scale when pressed and restore on complete.
Credit to @nils for the Gesture magic