EU Code Week 2020 - Day Ten - Create with Shapes
About this lesson
Shapes is another one of our "explore and experiment type" lessons.
Before we start using the Canvas page, we should take a look through some pre-written code to see what capabilities of the Shapes playground code is. Basically, someone has written a lot of code that we are now able to use to our own ends.
But we'll need all your skills as new coders to read through the code, and we'll do that a little bit in today's lesson. How many of the things we've learned, from functions to variables to types, can you identify in the code in these playground pages?
And how are you going to use it in the Canvas page, in the end?
Before we start using the Canvas page, we should take a look through some pre-written code to see what capabilities of the Shapes playground code is. Basically, someone has written a lot of code that we are now able to use to our own ends.
But we'll need all your skills as new coders to read through the code, and we'll do that a little bit in today's lesson. How many of the things we've learned, from functions to variables to types, can you identify in the code in these playground pages?
And how are you going to use it in the Canvas page, in the end?
Video
Recorded 10 December, 2020:
Unplugged Activity
Dance party!
You will need:- A4 paper
- Coloured pens
Activity:
Collage activity -- Dance party!On A4 paper, you can create a poster or advert for a school dance. You need to include a title, date, time, description and draw each part inside a different shape.
Which poster will attract the most dancers?
Extend
The Shapes playground and the pages we didn't cover in this lesson is an excellent place to explore the different types of shapes there are for us to use. We could focus on the shapes available to us: do we fill our canvas with text to tell a story? Do we paint the canvas with almost graffiti-like scenes? Is there a specific creation we have in mind we want to display?
Or maybe the interactive pages were more interesting to us. How can we use animation to make something really cool? What would we want to animate?
Or, lastly, touch. How would we want someone to interact with our scene? Is it like a touch pool at an aquarium? What happens if we tap on something too many times? How would we keep track of how many times an object was tapped?
To extend today's lesson, how about you build a game or app with just these shapes? What does your app do? Who is it for?
Or maybe the interactive pages were more interesting to us. How can we use animation to make something really cool? What would we want to animate?
Or, lastly, touch. How would we want someone to interact with our scene? Is it like a touch pool at an aquarium? What happens if we tap on something too many times? How would we keep track of how many times an object was tapped?
To extend today's lesson, how about you build a game or app with just these shapes? What does your app do? Who is it for?
Code in this session:
Copy
Canvas
let bird = Image(name: "SwiftBird")
bird.draggable = true
let button = Text(string: "Fly Away", fontSize: 36.0)
button.center = Point(x: 0, y: 15)
button.color = .black
button.onTouchUp {
for i in 1...20 {
animate {
bird.center = Point(x: Double(i), y: Double(i))
}
}
}
Canvas.shared.color = .white