Creating an Animation

In this activity, you will add an animation to your project.
  1. Choose at least one of your animation ideas to build now, and then click the matching link below and follow the instructions. (You will tell your program when to show your animation later. For now, you can just click the script to test it.)
    Explain 4 'hidden' costume options: "can rotate," "only face left/right," "don't rotate," and "draggable"
    The switch to costume block changes the sprite costume to the one you select in the block's dropdown menu. The next costume block changes the sprite costume to the next one on the list of costumes. Both blocks also work for changing stage backgrounds.

    1. If you haven't already, add the costumes (or backgrounds) that you want to switch between.
    2. Experiment with the switch to costume () or next costume blocks (in the "Looks" palette) to understand how they work.
    3. Use switch to costume or next costume to create an animation.

    1. Experiment with the blocks that apply to the animation style you are looking for so you understand what they do:
      • To change sprite size, try these blocks in the "Looks" palette: change size by (10) set size to (100) %
      • To turn your sprites, try these blocks in the "Motion" palette: turn ↻ (15) degrees turn ↺ (15) degrees point in direction (90)
      • To move sprites, there are many options. Try these blocks in the "Motion" palette first: move (10) steps glide (1) secs to x: (0) y: (0)
        What are x and y coordinates in Snap!?

        Locations on the Snap! stage (the white rectangle where sprites perform their scripts) are specified by coordinates. The center of the stage is (0, 0). The left edge is x = -240; the right edge is x = 240. The bottom and top are y = -180 and y = 180.
        Snap! coordinate plane with labels

        Maybe add: goto random, goto xy, change by x, change by y, set x too and set y to.

    2. To check the x or y position, direction, or size of your sprite, click the checkbox in the palette next to the reporter for the information you want. The value of that reporter will be displayed on the stage until you uncheck that box.
      screenshot of checkbox next to 'size' reporter in 'Looks' palette screenshot of checkboxes next to 'x position', 'y position', and 'direction' reporters in 'Motions' palette screenshot of 'x position' and 'size' reporters appearing on Snap! stage
    3. You'll probably want to repeat the movement (by using repeat or forever) and to include a pause (by using wait) so the animation doesn't happen too quickly.
      repeat (10) forever wait (1) secs
    4. You can use these blocks to reset the size, rotation, or position of your sprite:
      set size to (100) % point in direction (90) go to x: (0) y: (0)

    1. To add speech or thought bubbles, use some of these blocks from the "Looks" palette:
      say ('Hello!') say ('Hello!') for (2) secs
      think ('Hmmm...') think ('Hmmm...') for (2) secs

      If you want the text to disappear after a while, use a block with "for () secs" on the end. If you want the text to stay, use a block without it.

    2. To remove any previous thought or speech bubbles, use say or think with a blank input slot: say () think ()

    1. To add special effects, use one of these blocks from the "Looks" palette and experiment with the inputs to get the effect you want:
      change (ghost) effect by (25) set (ghost) effect to (0)
    2. To check the level of an effect, choose the effect from the dropdown menu of the (ghost) effect block, and then click the block to report the level (100 is all the way on; 0 is off).
    3. To reset one effect, use the set (ghost) effect to (0) block (with the effect you are resetting in the first input slot and 0 in the second input slot).
    4. To reset all effects, use the clear graphics effects block.

    1. To make the sprite turn or move toward something (such as the mouse pointer, a random position, the center of the stage, or another sprite), use one of these blocks from the "Motion" palette, and set the input slot to tell the sprite where to point or where to go: go to (mouse-pointer) point towards (mouse-pointer)
    2. If you want the movement to repeat forever or for a certain number of times, use one of these blocks:
      forever repeat (10)
    3. To slow down the movement, use the wait (1) secs block inside the repeat or for block to slow it down.
    4. To reset position of your sprite, use this block: go to x: (0) y: (0)

    1. To make a sprite trace a path as is moves, use the pen down block in the "Pen" palette.
    2. To stop a sprite from leaving a path, use the pen up block.
    3. To clear all the marks on the stage, use clear block.
    4. To change the style of path drawn, use these blocks: set pen color to (magenta color shown) set pen size to (1)

  2. Try out your animation(s) and adjust them until they work the way you want them to.
  3. Now Is a Good Time to Save
  1. Add additional animations to your project.
  2. You learned about creating command blocks in Unit 2 Lab 1 Activity 3: Programming Styles.
    Create command blocks to name your different animations so you can reuse them without rewriting them.
    spin in a circle:
repeat (36) {
	turn ↻ (10) degrees
	wait (0.1) secs
} fade away:
repeat (10) {
	change (ghost) effect by (10)
	wait (0.2) secs
}
  3. Take photos of an object (such as a figurine) in different positions in front of a white wall, import them as costumes, and animate anything you want!
In this activity, you used animation to bring your project to life.