DEV Community

Nathan Mattes
Nathan Mattes

Posted on • Originally published at zeitschlag.net on

100 Days of SwiftUI — Day 32

Today's Day 32, time for another technique-project to learn new things: This time, it was about animations — and they were really fun!

A few weeks ago, I built some animations and transitions. And today it was pretty impressive to see how easily I can build a pulsing button in SwiftUI. I did the same thing with UIKit and CoreAnimation those few weeks ago.

What really blew my mind in the end was how easily I can build a coin-flip-like rotation animation 🤯🤯🤯🤯🤯🤯🤯

Have a look at this!

coinflip

And this is all the code it takes to flip the button three times in a second:

Button("Tap Me") { withAnimation(.easeInOut(duration: 1)) { self.animationAmount += 1080 } } .padding(50) .background(Color.red) .foregroundColor(.white) .clipShape(Circle()) .rotation3DEffect(.degrees(animationAmount), axis: (x: 0, y: 1, z: 0)) 

Wow, that's really awesome! I have to find out how to do this with UIKit 🤓

Top comments (0)