Today we’re going to push your drawing skills to the limit by looking at special effects and animation. As we’re right at the advanced edge of drawing it’s fair to say these skills are less likely to be used in everyday coding, but as Ralph Waldo Emerson once said, “we aim above the mark to hit the mark.”
As you’re working through today’s topics you’ll learn how to animate shapes, and it’s another instance where SwiftUI can feel a bit like magic. As you’ve seen previously, though, it really isn’t magic – SwiftUI just responds to the way we configured our views. It’s a bit like a Rube Goldberg machine: we set things up exactly right, put the whole machine in motion, then watch as the correct output comes out.
Controlling animation is no different: we don’t want to have the
body property of a view re-invoked 60 or 120 times a second in order to get smooth animation, so instead we just provide the instructions for what should change as an animation progresses. It’s not terribly discoverable – that is, you can’t stumble upon the solution by accident – but I hope you’ll agree that it’s straighforward to use.
Today you have three topics to work through, plus one bonus topic if you’re feeling brave. You’ll learn about blend modes,
AnimatablePair, and more.
And if you’re feeling brave:
I hope you’re able to share some screenshots or videos with what you made today – if you use Twitter make sure you add @twostraws to your tweet so I can see!
Need help? Tweet me @twostraws!
SPONSORED From January 26th to 31st you can join a FREE crash course for iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a senior developer!
Link copied to your pasteboard.