Introduction: Spirograph on Scratch

About: I am an 11-year-old who likes making stuff!

Today, you will be making a spirograph on the block-based coding site Scratch.

Supplies

Internet

Scratch with the pen extension

Step 1:

Open the Scratch interface, either offline or online. I did this project offline.

If you are creating this online, use this link and make sure to sign in to keep your work. https://scratch.mit.edu/

If you do not wish to use the Internet, make sure you have downloaded and installed Scratch Desktop.

Step 2:

Add a sprite. I used a ball.

Step 3:

Create the following variables:

Degrees

Rate of change (moving) // how much x changes every time the cat moves

x

Step 4:

Define a block called setup

Setup

erase all

pen up

go to center // x = 0, y = 0

pen down

set pen color red // Color = 0, Brightness = 100, Saturation = 0

set (variable) x to Rate of change (moving)

Step 5:

Define a block called draw (steps) (degrees) (rate of change)

Draw (steps) (degrees) (rate of change)

move (steps) steps

turn right (degrees) degrees

change (variable) x by (rate of change) // the my block variable

change pen color by 1

Step 6:

Create the following code

When green flag clicked

setup

forever

draw [variable (x)] degrees rate of change (moving)

When I receive (message) draw // create new message

draw [variable (x)] degrees rate of change (moving)

When I receive (message) clicked & responded // create new message

stop other scripts in sprite

setup

broadcast (message) draw

Step 7:

In the other sprite (in this case the ball), create and define the following blocks:

Clicked

ask (New rate of change) // the question in parenthesis so it is not confusing // and wait

set (variable) rate of change (moving) to answer

ask (New degrees) and wait

broadcast (message) clicked and responded

set (variable) degrees to answer

Clear

erase all

go to x; 173 y; 142 // not necessary*

Step 8:

Create the following code:

When green flag clicked

go to x; 173 y; 142 // *reason why not necessary

clear // my block

forever

wait 0.1 seconds

next costume // not necessary

When this sprite clicked

clicked // my block

clear // my block

Step 9: Time to Test!

Steps 9-11 will be the testing phase.

But a reminder: I suggest using Turbo Mode because I tested it regularly and it took FOREVER! But in Turbo Mode it took less than 10 seconds!

Step 10: Setting With the Ball

I set the rate of change to 0.1, and the degrees to 35.

Step 11: The Result

And a reminder: it took less than 10 seconds because I used Turbo Mode.

P.S: This isn't a perfect spirograth. When the "drawing" sprite (in this case the cat) eventually touches three (or 4) borders in a row, then it starts messing up. The right border will most likely be the third border touched by the "drawing" sprite.