Home » Digital Technology » Scratch Spirograph

Scratch Spirograph

Details

Topics

This activity is a fantastic beginner activity that looks at a few key aspects of coding as well as introducing the Pen extension.



1. Navigate to https://scratch.mit.edu/

2. Click "Create"

3. Click this button that adds extension blocks.

4. Click to add Pen blocks

5. Click the "Events" category

6. Drag the "when Green Flag clicked" block to the script area. This is how we will start our code.

7. Click the "Motion" category

8. Grab the "move 10 steps" block and attached it under the "when Green Flag clicked" block

9. Click on the number 10 and change it to 100

10. Grab a "turn 15 degrees" block and attach it under "move 100 steps"

11. Click the Pen category

12. Attach "pen down" under the turn block

13. Click the green flag to see what happens

14. Since we are trying to draw a square, we will need to change the angle that the sprite turns. What number does this need to be?

15. We want our sprite to go back to it’s starting spot and to clear the pen. So we will need to create a reset button.

16. Click "Events"

17. Drag "when space key pressed" block into the scripting area.

18. Click "Motion"

19. Click "go to x: y:"

20. Click "100"

21. Type "0". This will make the sprite go back to the centre of the stage

22. Attach "point in direction 90" under "go to x: y:"

23. Click "Pen"

24. Click "erase all"

25. Now you can reset your sprite after each test using the "space" key

26. Right-click "move 100 steps" block and select "Duplicate"

27. Attach it to the bottom of the script and repeat twice more.

28. Click the green flag to draw a square.

29. If the sprite feels too big for the screen, double-click the "Size" field and change it to 50.

30. This code works to draw a square but we can make the code more efficient. To start this, click "Control"

31. Click "repeat"

32. Grab the second "move 100 steps" block and drag it and the ones underneath it away from the rest of the code.

33. Take the top move and turn blocks and drag them inside the "repeat 10" block.

34. Change the 10 to a 4 to draw the four sides of the square.

35. Drag the blocks over and reattach to the "when Green Flag clicked" block.

36. Click the green flag and see that it draws a square just like it did before.

37. Drag the leftover turn and move blocks back into the category area to delete them.

38. Now we need to turn the sprite after it draws a square to start making it into a spirograph. To start, click "Motion"

39. Grab another "turn 15 degrees" block and attach it under the "repeat 4" block.

40. Now when the green flag is clicked, the sprite draws a square and then turns 15 more degrees.

41. Each time it is clicked, it draws the square and then turns a little.

42.

43. We can automate this so we don’t have to click the green flag over and over. TO do this, click "Control"

44. And get another "repeat 10" block

45. Place the "repeat 4" block and the turn that is attached to it all inside the new "repeat 10"

To make the sprite do a full circle of squares, we need to make the amount of repeats and the degrees turned equal 360 when they are multiplied together.

46. Click the green flag to see it work.

47. We can play around and change these numbers as long as they still multiply to equal 360.

48. Now to add some interesting colour effects, click "Pen"

49. Grab the "change pen colour by 10" and add it under "repeat 4"

50. Click the green flag to run the code and create a rainbow spirograph design.

51. Remember to name your project

52. And to save it.

53. Can you make the spirograph out of triangles instead of squares?

54. Or hexagons?

55. Have a play with combining different shapes to see what you can make!


Discover more from

Subscribe now to keep reading and get access to the full archive.

Continue reading