more ANIMATE

We have seen some animations but so far we are unable to control them. All that happens is that they loop forever. The astart, astop, adone and frame actions allow us to completely modify what is shown and how it's shown.

Astart:
    The astart parameter eliminates the looping and instead makes the animation run exactly once. For example, if I took Example 1 from the previous page and added astart, the code would look like this: create animate me hrglas 3 3 600, astart. Note that there is a comma. This time, when it runs, it will only run once, then stop.

Astop:
    The astop parameter stops the animation at its current frame. This is useful if you want to pause or stop an animation. You can then start them up again by touching the object or pressing a sign (whatever you have in mind. See the next page for some examples). Thus, if I write create animate me hrglas 3 3 600, astop, the animation would be paused at its first frame.

Frame:
    The frame function let's you increase or decrease the image that is shown on screen. For example, if I typed in the code create animate me hrglas 3 3 600, astop; activate frame +1, then what I did is I made an hourglass animation and initially stopped it. Then, with every mouse click of the object (the activate trigger), the frame increases by 1. You could also put -2 and that would decrease the frame by 2.

Adone:
    The adone function is a trigger and initiates an action after the animation is finished (using the astart action). Let's show an example: create animate me hrglas 3 3 600, astart; adone noise http://www.pacdv.com/sounds/sounds/car_start_turn_off.mp3. Here, the animation is going to run once. After it finishes, the object is going to play a sound. Try it out!
 

Make some interesting examples!
Go back to main screen

© John Sun 2004. Comments? Problems? Suggestions? Email me.