DEV Community

Nathan Mattes
Nathan Mattes

Posted on • Originally published at zeitschlag.net on

2 1

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 🤓

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay