44
Creative Coding with Blocks Thursday, 28 March 2019 12:41 PM Creative Coding Page 1

Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

Creative Coding with BlocksThursday, 28 March 2019 12:41 PM

Creative Coding Page 1

Page 2: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

BYOx DETE- Connecti...

BYOx-Connecting-OSX

OneNote

Office.com

Sign in

Outlook

Find email from me

Click on button

Getting OnlineThursday, 2 May 2019 1:23 PM

Creative Coding Page 2

Page 3: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

- design of user experiences and algorithms incorporating branching and iterations

- testing, modification and implementation of digital solutions

• investigating and designing some common algorithms for generating graphics• checking the accuracy of an algorithm before it is implemented• using structured English to express algorithmic instructions• developing and modifying digital solutions by implementing instructions contained in algorithms through programs • developing digital graphics that manipulates models of real-world objects • implement algorithms in both block-based and text-based code

Getting Started in Scratch

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

2.

3. Follow the steps, making sure to use your school email address.4. Open your school email address to confirm your registration – look for an email from scratch5. Sign in6. Go to my stuff

7. Create new project

8. Call the first project “shapes” by changing the name at the top

9. it should automatically save, but just in case,

Drawing BasicsThursday, 28 March 2019 12:42 PM

Creative Coding Page 3

Page 4: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

Understanding Coordinates!

Add pen extensionGo to the extension button in the bottom left:

Choose:

Initialisation sequenceYou should always initialise your program.This means that you set everything towhere/what it should be at the start of theprogram, e.g.:Clearing the screen

Move to the starting position

Resetting variables (more on this later)

Creative Coding Page 4

Page 5: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

When the code blocks are run one after another, it’s called a SEQUENCE. Remember this, you might be tested on this later!!

Use the blocks below to put the cat sprite in the middle and point upwards, hide itself, clear the screen and put the pen down.- You should know which numbers to put in for x and y!

Move ForwardYou can tell it how far to move (pixels), using:

Add a block to draw a line 100 pixels

Draw a SquareYou’ll probably know from your geometry lessons that a square is made up of four lines of equal width, and four right angles of 90 degrees. When telling the computer how to draw a square, you

Creative Coding Page 5

Page 6: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

width, and four right angles of 90 degrees. When telling the computer how to draw a square, you can tell it how far to move (pixels), and how far to turn (degrees)

Draw a square by repeating

4 times and turning 3 times. You need to decide which way to turn and by how many degrees.Hint: try right-clicking and using duplicate.

Stop Repeating Yourself!

In Algorithm terms, this is known as ITERATION

Add a

control block and make your algorithm more efficient.

Creative Coding Page 6

Page 7: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

control block and make your algorithm more efficient.

Creative Coding Page 7

Page 8: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

- design of user experiences and algorithms incorporating branching and iterations

- testing, modification and implementation of digital solutions

• investigating and designing some common algorithms for generating graphics• checking the accuracy of an algorithm before it is implemented• using structured English to express algorithmic instructions• developing and modifying digital solutions by implementing instructions contained in algorithms through programs • developing digital graphics that manipulates models of real-world objects • implement algorithms in both block-based and text-based code

How good is your Geometry?

Drawing ShapesThursday, 21 March 2019 8:34 AM

Creative Coding Page 8

Page 9: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

Create an efficient algorithm for each of these shapes. You can calculate the turn by dividing 360 by the number of sides.

Eg a trun for a triangle will be 360/3 = 120 degrees

Also, experiment with these blocks

Creative Coding Page 9

Page 10: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

Also, experiment with these blocks

Seeing Stars

Changing backdrops

1. Make sure stage is selected and not sprite

2. Change to the backdrops tab

3. Change the fill colour to black and draw a rectangle

Note: you can use the

block to code this and mace it change.

Drawing Stars

This is similar to polygons but you need to use a different formula to calculate how many degrees to turn

Creative Coding Page 10

Page 11: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

Change the backdrop

Now try drawing a five pointed star

Use the formula: rotate = multiplier*360/sides [rotate = 2*360/5]

Repeat = sides [5]

EG:

Again, try different pen sizes and colours.

Drawing a Circle

Creative Coding Page 11

Page 12: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

Drawing a Circle

Thinking Mathematically what do you notice?

How can you draw a smaller circle?

HINT: it's all about degrees in a circle

What's the smallest circle you can draw?

Creative Coding Page 12

Page 13: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

The goal of this project is to create your own pendant. You already know how to use arbitrary squares, rectangles, triangles, polygons, and other 2D shapes.

You can build the Peace Symbol,

various astrology symbols such as Mars, or Venus

ancient alchemy symbols such as Air,

You can create ancient symbols like the Pentagram,

or perhaps the first letter of your name.

Really, the sky is the limit! Feel free to create anything you want!

- Identify the kind of design that you will make by assembling a mood board

EG

Mini-ProjectThursday, 21 March 2019 8:52 AM

Creative Coding Page 13

Page 14: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

Creative Coding Page 14

Page 15: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

Other places to find ideas:

https://www.yeggi.com/https://libre3d.com/https://www.youmagine.com/https://www.myminifactory.com/

design of user experiences

- Make a sketch of your proposed design

Eg

- Develop your algorithm in ScratchEg

initialise1. Draw circle2. Draw line across diameter3. Back up half way4. Draw at 45 degrees and reverse to starting position

5. Draw other leg 6. Add loop for necklace7.

Creative Coding Page 15

Page 16: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

Other blocks you may need:

design of user experiences and algorithms incorporating branching and iterations

- Test your algorithm in Scratch, taking care to record each test and iteration

testing, modification and implementation of digital solutions

- Produce your Pendant

testing, modification and implementation of digital solutions

- evaluate the process and the product

evaluation of information systems and their solutions in terms of meeting needs, innovation and sustainability

Resources

Creating an SVG

- download inkscape: https://inkscape.org/ or get from G:\StudentCommon\BYOx Installs

Extruding

Printing

Creative Coding Page 16

Page 17: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

Printing

Creative Coding Page 17

Page 18: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

- design of user experiences and algorithms incorporating branching and iterations

- testing, modification and implementation of digital solutions

• investigating and designing some common algorithms for generating graphics• checking the accuracy of an algorithm before it is implemented• using structured English to express algorithmic instructions• developing and modifying digital solutions by implementing instructions contained in algorithms through programs • developing digital graphics that manipulates models of real-world objects • implement algorithms in both block-based and text-based code

We have already learned that we can stop repeating ourselves when drawing a square

Now, say we want to draw many squares, we can do that by repeating our new more efficient algorithm

own block(1)

Make your Own Block (function)Thursday, 28 March 2019 12:51 PM

Creative Coding Page 18

Page 19: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

This is a lot of code for drawing 3 squares and it would be a lot longer for say 10 squares.

There is a better way: create your own block (or function)

Make a Block

1. Go to

2. Then click

3. Give the block a name

4. Define your square

Creative Coding Page 19

Page 20: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

5. Use your new block

Hint: Drag it out of

6. Try multiples

OR

Challenge

Make a square and a triangle block

Draw a row of houses

Draw the Olympics' Ring (create a circle block)

Creative Coding Page 20

Page 21: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

- design of user experiences and algorithms incorporating branching and iterations

- testing, modification and implementation of digital solutions

• investigating and designing some common algorithms for generating graphics• checking the accuracy of an algorithm before it is implemented• using structured English to express algorithmic instructions• developing and modifying digital solutions by implementing instructions contained in algorithms through programs • developing digital graphics that manipulates models of real-world objects • implement algorithms in both block-based and text-based code

Basic Geometric Art with Repeat BlockThis is generated by drawing a shape, rotating a factor of 360 degrees and repeating. The rotation is calculated by the rotation factor. For example, if you rotate by 30 degrees, then you need to repeat for 360/30 = 12 rotations.

Repeat = 360/turn in degrees

Example

So the turtle moves forward 50 pixels, then turns left 30 degrees, and loops 12 times.

To draw the pattern, we add another loop (looping 12 times again), and turn left 30 degrees after drawing each shape

1. Initialise your environment

2. Draw a 12 sided polygon (what's it called again?)

Art with Repeating PatternsThursday, 28 March 2019 1:20 PM

Creative Coding Page 21

Page 22: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

3. Rotate the same number of degrees and repeat drawing 12 sided polygon

Challenge

Try experimenting with different shapes, repeats and rotations

Can you repeat a circle?

Geometric Art with Repeat Until Block

Most coding languages have what is called a For loop, where you can repeat something a number of times, but also keep track of how many times you have looped and use this number as part of what you want to do. For example, say we want to draw a square with 2 steps in the for loop and then 3, 4.. and so on. This would give us a square that get bigger and bigger.In Scratch, however, the closest we have is the repeat until loop. To make it work like a for loop with a counter variable that we can use, we first make a variable and set it to an initial value:

1. Make a variable called steps and set it to equal 1

2. Keep making squares until the length of a side is greater than 100 steps. We really need a > or = here, but Scratch doesn’t have it. Bring on text-based coding!

Creative Coding Page 22

Page 23: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

3. Draw a square, using the current value stored in the steps variable as the length. This will gradually get bigger with each repeat until loop

4. After drawing a square, increase the length of each side by an extra 10 steps

5. Add some nice things at the beginning: set the pen to the middle and erase all old lines.

This should yield

6. Now add another loop, after this is drawn, reset the count and turn with a 90 degree rotation

Creative Coding Page 23

Page 24: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

7. How about a colour change

OR

Creative Coding Page 24

Page 25: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

Challenge

Try this with different Shapes

Spirals

How about

Creative Coding Page 25

Page 26: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

Challenge

Try different shapes

Creative Coding Page 26

Page 27: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

Creative Coding Page 27

Page 28: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

favouriteShape

More Art

from turtle import *

Creative Coding Page 28

Page 29: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

from turtle import *

pensize(5)pencolor('skyblue')

for i in range(6): forward(100) right(45) forward(50) backward(50) left(90) forward(50) backward(50) right(45) backward(100) right(60)

Creative Coding Page 29

Page 30: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

Creative Coding Page 30

Page 31: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

Creative Coding Page 31

Page 32: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

Creative Coding Page 32

Page 33: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

Creative Coding Page 33

Page 34: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

From https://www.ucl.ac.uk/ioe/research/projects/scratchmaths

Scratch StampsFriday, 26 April 2019 10:51 AM

Creative Coding Page 34

Page 35: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

Creative Coding Page 35

Page 36: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

Creative Coding Page 36

Page 37: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

Creative Coding Page 37

Page 38: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

Creative Coding Page 38

Page 39: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

https://mcr.dozuki.com/c/User_Guides

MarginallyClever-Mak...

Makelangelo

Convert to SVG first

Turtle_Graphics_Spiral

3D Printing

>drag and drop into flashprint

spiral spiral_plane

Or http://3dp.rocks/lithophane/

Carve wood and plastic with cnc mill

http://easel.inventables.com/projects/FgFgjwOeF_W7Exnl5CnYrQ

Plastic - downcut Wood - upcut

Etch with cnc mill

769comment...

circles

Output OptionsThursday, 4 April 2019 1:32 PM

Creative Coding Page 39

Page 40: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

769comment...

circlesTriangle

Heat Transfers

Ready to print

Ready to print Ready to print

Temporary Tattoo

tattoo print

Creative Coding Page 40

Page 41: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

Embroidery

https://www.turtlestitch.org/run#cloud:Username=ByVeru_2&ProjectName=Rockstar

Rockstar

https://www.turtlestitch.org/run#cloud:Username=SimonMong&ProjectName=crossStitch1

crossStitch1

https://www.turtlestitch.org/run#cloud:Username=amasta&ProjectName=769%20commented2

769comment...

https://www.turtlestitch.org/run#cloud:Username=sapperlot&ProjectName=Triangle

Triangle

https://www.turtlestitch.org/run#cloud:Username=Byveru&ProjectName=schnecken%20Haus

https://www.turtlestitch.org/run#cloud:Username=shelucia&ProjectName=Blackhole

https://www.turtlestitch.org/run#cloud:Username=bducey2020&ProjectName=MandaI

https://www.turtlestitch.org/run#cloud:Username=SimonMong&ProjectName=bubbles

Creative Coding Page 41

Page 42: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

schneckenHaus

Username=shelucia&ProjectName=Blackhole

Blackhole

oud:Username=bducey2020&ProjectName=MandaI

MandaI

cloud:Username=SimonMong&ProjectName=bubbles

bubbles

https://www.turtlestitch.org/run#cloud:Username=SimonMong&ProjectName=foldline1

foldline1

https://www.turtlestitch.org/run#cloud:Username=amarkatsc&ProjectName=%20My%20meeth%20project%20acctual

_My meethproject ac...

https://www.turtlestitch.org/run#cloud:Username=rebelsky&ProjectName=Twisty

Twisty

https://www.turtlestitch.org/run#cloud:Username=Dotrax&ProjectName=Cool%20muster

Coolmuster

https://www.turtlestitch.org/run#cloud:Username=LOLO&ProjectName=OK%20COOL

OK COOL

https://www.turtlestitch.org/run#cloud:Username=jaykay&ProjectName=new%20collection

newcollection

https://www.turtlestitch.org/run#cloud:Username=mbeavers&ProjectName=chris

chris

https://www.turtlestitch.org/run#cloud:Username=chmod&ProjectName=Whizzy%3a%20Spiral_using_for-block

Whizzy_Spiral_usi...

https://www.turtlestitch.org/run#cloud:Username=Examples&ProjectName=Random%20stitch%20length%20-%20explosion

https://www.turtlestitch.org/run#cloud:Username=amws&ProjectName=Spiral%20Vici

https://www.turtlestitch.org/run#cloud:Username=TinkerTank&ProjectName=Multi%20colored%20spiral%20starburst

https://www.turtlestitch.org/run#cloud:Username=ByAbru&ProjectName=Cooler%20Kreis%202

Creative Coding Page 42

Page 43: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

Randomstitch len...

Spiral Vici

Name=Multi%20colored%20spiral%20starburst

Multicolored s...

Cooler Kreis2

https://www.turtlestitch.org/run#cloud:Username=SimonMong&ProjectName=newflower

newflower

https://www.turtlestitch.org/run#cloud:Username=kvdspek&ProjectName=polar%20flowers

polarflowers

https://www.turtlestitch.org/run#cloud:Username=rebelsky&ProjectName=Twisty

Twisty (1)

https://www.turtlestitch.org/run#cloud:Username=rebelsky&ProjectName=spirals6

spirals6

https://www.turtlestitch.org/run#cloud:Username=jlin2017&ProjectName=spiral

spiral

https://www.turtlestitch.org/run#cloud:Username=Richard&ProjectName=Sedona%20spiral

Sedonaspiral

https://www.turtlestitch.org/run#cloud:Username=Maaike&ProjectName=Spiral_using_for-block%20bewerkt

Spiral_using_for-block...

https://www.turtlestitch.org/run#cloud:Username=bits4kids&ProjectName=Spirale%20density%20warning

Spiraledensity w...

https://www.turtlestitch.org/run#cloud:Username=EdTechNYC&ProjectName=Spiral

https://www.turtlestitch.org/run#cloud:Username=Zaharu109&ProjectName=Mandala%20Kranz

https://www.turtlestitch.org/run#cloud:Username=shelucia&ProjectName=circles%20mandala

https://www.turtlestitch.org/run#cloud:Username=terem&ProjectName=star4

Creative Coding Page 43

Page 44: Creative Coding with Blocks - Through The Classroom Door Coding.pdfCreative Coding Page 22 3. Draw a square, using the current value stored in the steps variable as the length. This

e=EdTechNYC&ProjectName=Spiral

Spiral (1)

Username=Zaharu109&ProjectName=Mandala%20Kranz

MandalaKranz

oud:Username=shelucia&ProjectName=circles%20mandala

circlesmandala

cloud:Username=terem&ProjectName=star4

star4

https://www.turtlestitch.org/run#cloud:Username=josborn&ProjectName=star

star

https://www.turtlestitch.org/run#cloud:Username=TinkerTank&ProjectName=Star%20flower

Star flower

Creative Coding Page 44