
ANIMATE
A difficult but rewarding action is the animate action, which allows a user to make interesting objects. An animation is basically a collection of images that flash in a certain order in order to see something happen. This is a principle used in TV and movies, and allows users to show lightning flash or a person move. In fact, anyone can create their own images and put them onto the browser.
The animate action takes the following parameters: trigger animate [tag=tag] object-name animation-name imagecount framecount framedelay [framelist], where the parts between the [ ] are optional.
Let's explore each part of the action (this may be confusing so refer to the examples afterwards):
sign and picture objects have a special "tag" on them that specify the area where text or art is shown. For example, if we add a picture to a TV object, the picture only occupies the screen part of the object. If you want your animation to be like that also, be sure to add tag=100 (for signs) or tag=200 (for pictures). If you are animating a picture or sign object, ignore the tag parameter
the object-name is the name of the object to animate. Names are given using the name action. If you are creating the animation for the object itself, then write me to specify that. If you want the action to happen to the object called happy, then you specify the object-name to happy.
the animation-name is name of the texture that you wish to apply to the object
the imagecount is the number of textures you wish to include into your animation
the framecount is the number of frames you want include into your animation; this usually is the same as the imagecount but can be more if you want an image to appear more than once
the framedelay is the length of time you want each frame to remain on-screen (in milliseconds)
the framelist is optional and it defines the order which you want to display your images
Now let's look at some examples:
Example 1: create animate me hrglas 3 3 600
In this example, I'm creating an animation right away (through the create trigger). I am applying it onto the object so I write animate me. I want the hrglas texture (which has three different images) so I put the imagecount at 3. I also want to show the three images in order so I put 3 for framecount. Finally, I want each frame to show for 0.6 seconds so I put 600. Notice I didn't need the tag or the framelist parameters. It looks like this, rotating between the three pictures:
Example 2: create animate me hrglas 3 3 300 3 2 1
In this example, I changed one of my previous parameters plus I added 3 2 1 at the end. I changed my framedelay value at 300 instead of 600. The result? It will rotate faster. The 3 2 1 is the framelist parameter and what it will do is start with the third image and work backwards. Thus, when you see the hourglass, it seems that the sand is going upwards.
Example 3: create animate tag=200 me wood 6 6 600
Here, I am using the xaw5.rwx object, which is a picture object with a frame. I am now showing the wood textures. I am using 6 of its images in order. Notice I added the tag=200 parameter. This specifies that the animation only shows on the screen rather than the whole object. Notice the different between the three objects. The left is before the animation, the middle is with the tag=200, and the right is without.
|
|
Example 4: Creating animation on other objects
I create two objects, a xaw5.rwx (picture) and sign3.rwx (sign). I want to display stone textures onto the picture when I touch the sign. Thus, first I put the code create name stonetext for the picture. This identifies the object and we will refer to it in our sign object. I put bump animate tag=200 stonetext stone 8 8 600; create sign "Touch the sign to see stone textures". I put the trigger as bump so the action will run when touched. I put tag=200 so that the animation only occurs in the picture box. I referred to the object stonetext. Finally, I added the text that is displayed on the sign itself. It looks something like this:

There's much more you can do. Refer to the User
Guide or visit
http://www.activeworlds.com/help/aw36/animate_command.html for more
information.
Learn to use astart, astop and frame actions
Go back to main screen
© John Sun 2004. Comments? Problems? Suggestions? Email me.