100 Days of SwiftUI
2026-05-22
Project 6, part 3
Animation wrap up
Quiz: 12/12
Challenge
Go back to the Guess the Flag project and add some animation:
- When you tap a flag, make it spin around 360 degrees on the Y axis.
- Make the other two buttons fade out to 25% opacity.
- Add a third effect of your choosing to the two flags the user didn’t choose – maybe make them scale down? Or flip in a different direction? Experiment!
This is a lot harder than previous Technique challenges. I flailed around putting .animation just about everywhere and it didn’t seem to have the right effect.
Eventually, Bill and I worked through something that kinda worked, and then we watched the solution video and went OOOOOHHHHHH. We had the logic right (how to pick the flag to rotate and by extension the other two would do something else), but the syntax of where the modifiers goes still eluded us a bit. Also, remember kids that nil doesn’t animate.
But we got it, and here’s a little animation of it
