teachers, students, everyone
Tools | Blog | Account | Learn
Login Status

Intro to Scratch
Creating Fractals
Feb 28, 2017


Login to Scratch and click "create".

Go to the Scratch 2.0 Web Tool - https://scratch.mit.edu/

LET'S START: Use the CREATE tab at the top.

Making Fractals

Fractals is basically the idea of a detailed pattern that repeats itself. In some ways, this is a lot like programming itself. Programming often includes details that repeat using loops. Thus, creating fractals is a great starter task for students to learn in Scratch. We're going to use the "Pen" function included in Scratch to draw shapes on the screen and change either direction and/or size and repeat.


This a great time to introduce the concept of methods. Methods allow us to create blocks of code that can be reused over and over again.

Before we create our first function first create a data variable named "side".

To create a function in Scratch you go to the "More Block" tab in scripts" Click on Make a Block and in the space provided give your function a name. Let's name our first one drawTriangle. Also, select the number option.

This will drop a "define" block into your coding area. We can add code to this function just like we do other areas.

We're going to add a "pen down" --> this lets us draw on the canvas as the cat moves around.

Next let's add to repeat loops (one inside the other). The outer repeat will last "number1" times. The inner will last 3 iterations. Inside the inner repeat add a move and a turn motion. The "move" line will go "side" steps. and the turn will go 120 degrees. After the inner repeat add a turn and set it to 15 degrees.

Add a start line (green flag) and set side to 70. Next, add a "forever" loop. Inside this loop add an if statement with arrow up detection. Call the drawTriangle method from inside here.

Run this and check out the interesting design that is created. Experiment with changing the side variable and/or the turn degree to get interesting effects.

See if you can make a clear board function that gets activated by pressing the space bar. This method should erase all pen drawings from screen and reset the cat to the center of the screen at 90 degree angle.

Next we'll do some Math with Scratch, click here>>.



No comments posted


Past Posts

Dropbox Public Folder Alternative
Jun 4, 2017

Getting Started with NodeJS
May 1, 2017

Scratch Intro: Racing Game
Jan 15, 2017

Five Best Educational Tools For Teachers
Feb 3, 2017

Coding Gravity
Feb 22, 2017

Drones in Eduction
March 2, 2017

Javascript Intro
April 1, 2017

iPhone Streaming Audio App
April 15, 2017

Installing MySQL
May 15, 2017




Thank You!