Challenge: Create fun visual effects in Swift Playgrounds
June 10, 2021
Ever wonder how to make it seem like confetti is raining down from the sky? Or how to create a kaleidoscope effect using code? In this challenge, your goal is to create a compelling visual effect using the Shapes book from the Swift Playgrounds app. Maybe it’s a constellation of objects revolving in intriguing mathematical patterns, or a textural and fluid shape that adapts to your touch. It’s all up to you: What kind of visual effect would you like to dream up?
Begin the challenge
To get started, download and open Swift Playgrounds on your iPad or Mac, then select See All from the lower right corner to launch the Swift Playgrounds content screen. From here, you can find the Shapes book under “Starting Points” and download a copy to your device.
The Shapes starting point has some great examples to reference as you get started. Check out the page “Shape Graphics” to explore the book’s basic API for creating all shape types and placing them in the scene. “Touches and Animations” will show you how to apply animations to shapes and use touch events to drive behaviors. And finally “Sprite Shapes” can help you learn how to set up physics interactions between different shapes. From there, you’ll have all you need to create your own visual composition.
Want to show off your visual concept to the community? You can share your creation (or creation-in-progress) on the Developer Forums.