Have a go at coding…
Learning to code is for everyone and it is fun, create digital art, make games, explore AI, IoT and robotics.
This is an opportunity to have a go at coding, you don’t need to understand it but you can learn through doing. If you want to learn how to code then I have a course for you as a series of eBooks (kindle on Amazon) which you can use on any device (you don’t need a kindle) even your phone. Click on this link https://www.amazon.co.uk/dp/B09KPVLBL1 for the first book in the series or visit the home page on www.thehappycoder.org.
Here you can have a go by typing in the code and running it. These are just coding snippets or doodles. So if you have never coded before here is your chance to try for free. You can’t fail, you can only try. Just follow the instruction below:
- delete to code that is already there below,
- type the code that is below,
- take care to do it exactly as shown,
- Press the play button,
- try changing things to see what happens,
- that is the best way to learn, play, experiment and try things.
The web editor, delete the code below…
…now add this code
let angle1 = 0 let angle2 = 0 let angle3 = 0 let angle4 = 0 let angle5 = 0 let angle6 = 0
function setup() { createCanvas(400, 400) angleMode(DEGREES) rectMode(CENTER) noStroke() }
function draw() { background(40) translate(width/2, height/2) push() fill(100) rotate(angle6) square(0, 0, 400) angle6 = angle6 + 0.5 pop() push() fill(200) rotate(angle5) square(0, 0, 350) angle5 = angle5 - 0.75 pop() push() fill(100) rotate(angle4) square(0, 0, 300) angle4 = angle4 + 1 pop() push() fill(200) rotate(angle3) square(0, 0, 250) angle3 = angle3 - 1.25 pop() push() fill(100) rotate(angle2) square(0, 0, 200) angle2 = angle2 + 1.5 pop() push() rotate(angle1) fill(200) square(0, 0, 150) angle1 = angle1 - 2 pop() circle(0, 0, 100) fill(100) }