EU Code Week 2020 - Day Seven - Draw with Spirals
About this lesson
It builds on our work yesterday with variables and lets us feel the effects of the changes we make to the code. What kind of spiral can you make? What does your end design look like?
Recorded ..., 2020:
Learn how to waltz!You will need:
- Space to move around the room
Activity:Strictly Come Learning! -- Do you know the moves to a dance? It could be a Tik-Tok style dance, a Fortnite dance or Banana, Banana, Meatball? Do you know how to Ballroom dance?
We will learn the steps for the waltz. We will start in a 1 metre square space. We will try the 6 steps around the square to perform the waltz. Then we can work on our technique and start to spiral around the room!
If you enjoyed coming up with funky new spirals, you might like to explore turtle graphics: a playground in which we explore using code to direct a monkey to draw on the screen. You'll find the Turtle Graphics - simplified playground in The Code Hub's playground feed. Try using commands to solve some drawing challenges and then come up with your own creations in the On Your Own page.
There is a lot you can do with a fairly limited set of commands. I would love to see some of the advanced drawings and configurations you can come up with. Feel free to post them with the hashtags #EveryoneCanCode and #QuickStartToCode and we'll check them out!
Code in this session:
// This will determine how large the track your wheel moves on is. trackRadius = 5 // Remember to use a negative value here to draw an epi- shape. wheelRadius = 1 // Make spokeLength equal to the wheelRadius for a cycloid, or not equal for a trochoid. spokeLength = 1 pathColor = #colorLiteral(red: 0.3823705912, green: 0.7347578406, blue: 0.2736029625, alpha: 1) trackColor = #colorLiteral(red: 0.8941176471, green: 0.2117647059, blue: 0.2431372549, alpha: 1) spokeColor = #colorLiteral(red: 0.9607843137, green: 0.5098039216, blue: 0.1215686275, alpha: 1) wheelColor = #colorLiteral(red: 0.9921568627, green: 0.7215686275, blue: 0.1529411765, alpha: 1) // Try some of the new options below! backgroundColor = #colorLiteral(red: 0.09019607843, green: 0.09411764706, blue: 0.1333333333, alpha: 1) // For best results, choose a draw speed value from 1.0 to 10.0 drawSpeed = 1.0 // Note: Setting lightTheme to true will *override* backgroundColor. lightTheme = false drawSpiral()