Snap Projects, March 2, 2012, Cardinal Forest Elementary School
Snap website
Snap is available online - about Snap.
back to more Snap! projects
Part 1: drawPolygon
- Spinning Polygons Snap
- Choose 'make a block':
- Select 'motion' for the block's category. Type 'drawPolygon' for the name of this new block
- Click on the '+', this will let us create an input to this block.
- Name this input 'sides'. This variable will represent the number of sides we want for our polygon
- Use a repeat block. Drag 'sides' onto this repeat block for the number of times.
- Drag a formula block from the 'operators' menu into the turn block: __ divided by __
For the formula, use 360 divided by the number of sides. This equals the angle we need to turn for all regular polygons.
- To run this program of blocks, use: clear, pen down, drawPolygon 5. This draws a pentagon. Try other shapes too, like a triangle, hexagon, and octagon.
PART 2: Spin Polygon
- Now we'll extend this program to spin polygons. Choose make a block, and name this block spinPolygon
- Add one input variable named 'numberOf Polygons':
- Use a repeat block in our new block for SpinPolygon. Drag 'numberOfPolygons' onto the repeat block:
- Add the formula: 360 divided by 'numberOfPolygons' on a turn block. Put this turn block into our new block definition.
- Run the program: clear, pen down, spinPolygon 20 times. This will draw 20 pentagons spinning in a circle.
- To change from a spinning pentagon to spinning octagon, 'edit' your block definition. Change the number of sides from 5 to 8:
-
- Try spinning other kinds of polygons, like triangles and hexagons. Try spinning more than 20 polygons each time.