11. Draw spirals

In this practice we are going to move a character around the screen so that it draws several colored spirals.

_images/scratch3-p10-screen-cuadrado.png


  1. We start the Scratch editor.


  2. Press the language button boton-idioma in the top bar and choose English.


  3. We add a new variable Side that will store the size of the side that is currently being drawn.

    Press the variables button boton-variables,

    click on create a variable boton-crear-variable.

    We change the name of the variable to Side


  4. We add a new extension with the button add extension aniadir-extension down left.

    We select the Pencil extension to be able to draw.

    _images/scratch3-extension-lapiz.en.png

    A new icon will appear in the code bar, the Pencil boton-lapiz, with dark green instructions.


  5. We create a new block called start.

    First click on the button my blocks boton-misbloques

    Then click on create a block boton-crear-bloque

    Then we change the name of the new block to start


  6. The start block will be used to start the program. It will move the cat to the center of the screen with small size. Hide the Side variable, lower the pen to paint, set the pen thickness and color, and clear the screen.

    _images/scratch3-p10-inicio.png


  7. We create a new block called square.

    First click on the button my blocks boton-misbloques

    Then click on create a block boton-crear-bloque

    Then we change the name of the new block to square


  8. The square block will be used to draw a square spiral on the screen.

    The size of the side starts with the value 5 and grows by 4 steps until it is equal to or greater than 340.

    Each step draws a line of "Side" size, increases the size of the side, rotates 90º and increases the color of the pencil.

    _images/scratch3-p10-cuadrado.png


  9. If we click on the "define square" block, the square spiral will appear on the screen.

    _images/scratch3-p10-screen-cuadrado.png


  10. Now we are going to create a new block called triangle.

    First click on the button my blocks boton-misbloques

    Then click on create a block boton-crear-bloque

    Then we change the name of the new block to triangle


  11. The triangle block is very similar to the square block, only the angle of rotation changes.

    To take advantage of the program already done, we are going to click with the right mouse button on the square instructions and choose the duplicate option.

    _images/scratch3-p10-duplicar.png

    Once the program has been duplicated, we hook it to the triangle block and change the angle of rotation.

    _images/scratch3-p10-triangulo.png
  12. If we click on the block "define triangle", the triangular spiral will appear on the screen.

    _images/scratch3-p10-screen-triangulo.png

Challenges

  1. Make a new block that draws a star spiral. Modify the parameters of the new block to rotate 150 degrees.

    _images/scratch3-p10-screen-estrella.png


  2. Create a new block to draw an octagonal spiral. Turns must be 45 degrees. The side must add to 1 on each repetition and must be repeated until the side is greater than 150.

    _images/scratch3-p10-screen-octogono.png


  3. Experiment with the program to create new original drawings.