
What is the trick of a cartoon, a movie having animation?
It's created one design for each frame of the movie, having a little modification in the movements of the figures.
When the movie runs, we have the ilusion of something real.
We can do the same thing in Squeak. We need to put in the desktop two objects: a "Holder" and a "Playfield". In the Holder we will have the "frames" of the film and the Playfield is the "screen" where the animation can be seen.
In the Holder, we need to do a new design (a new object) for each frame of the film, opening a new PaintBox and keeping each design etc.
After create all the frames you need to do a copy (using the halo) of the first frame and put this copy in the Playfield.
Open the Viewer of this copy (not the Viewer of the Playfield) and, in the part: "miscellaneous" drag the line having the method: look like: dot to create a new script.
Open the Viewer of the Holder and drag, from the part: "collections", the line: "Holder's PlayerAtCursor" over the word: "dot".Like you can see in the figure:
The second line of the script is created dragging the line: "Holder's cursor: 1.00".
Using the first little green arrow change the method for: "cursor increase by: 1". Look in the figure:
After this, you need to "define", in the Holder, each frame, double clicking over each design. You will see a moldure appearing.
To run indefinitely the animation, change "normal" to "ticking".
In the demo you will see how we did two new scripts to "pause" and restart the animation (clicking in the "yellow exclamation" or creating buttons). This lines of code are in the part: "scripting" of the Viewer of that object: copy-of-the-first-frame-in-the-Playfield.
PREVIOUS LESSON NEXT LESSON T. CONTENTS HOMEPAGE
