The movie tasks build on the picture tasks. If you have not already looked at the Blockly Picture Tasks tutorial please do so before continuing with this one.
The picture module provides blocks for creating shapes and lines. The movie module adds to this some sprite blocks and a time block:
This block returns the frame integer from 0 to 101.
The key to understanding these tasks is to realise that the code you write is executed 101 times in a movie time loop to create the animation. (This means that in some instances your code might not complete in each frame which can produce some weird results!)
The process of drawing each movie frame is like this:
1. Remove old objects (shapes and lines).
2. Execute the code blocks in the workspace
3. Draw the objects onto the canvas.
The main blocks:
returns the frame integer from 0 to 101.
This can be used in place of any of the numerical parameters in the Add shape block:
Try running the code in the workspace below. Then try replacing each of the numbers, one at a time, with the time block and re-running the code each time to see what happens.
Interesting huh? Now have a look at the examples below to explore, in a little more detail, how this module works.