27
  Animation workshop (3)
  Animate * Timer * Astart * Adone
 

In the third animation class, Bach Zhaa(#360197) explains about the animate command, the timer command , and the astart command

Location of the Workshop : AWSchool 33N 121E .and also 42N 102E

On the Activeworlds wiki pages, you can view the syntax of these commands :
http://wiki.activeworlds.com/index.php?title=Animate
http://wiki.activeworlds.com/index.php?title=Astart
http://wiki.activeworlds.com/index.php?title=Adone (=trigger)
 
http://wiki.activeworlds.com/index.php?title=Timer
http://wiki.activeworlds.com/index.php?title=At (=trigger)

With the animate and timer command, you can create the same animations, but you can see that the animate command is used with the trigger "adone" , and uses the commands astart, astop and frame. Whereas the timer command is used with the trigger "at" , and uses the commands reset, stop and loop.

********** Dominos Animation (with the animate command) ***************
This is how the astart dominos work : The commands are in each of the dominos , and they are seperated by 150 milliseconds. When the dominos start to fall down, they make a rotation. The animation starts by clicking upon the sign object, but also by clicking upon the first domino (because activate astart is also added in the action command of the first domino).
sign4.rwx
create sign q=100;activate astart dom1 global
boardv2m.rwx
create name dom1,animate me 01. 1 1 150;adone rotate 0 0 26 time=.5 wait=30;activate astart dom1 global (= the first domino)
create name dom1,animate me 02. 1 1 300;adone rotate 0 0 26 time=.5 wait=30
create name dom1,animate me 03. 1 1 450;adone rotate 0 0 26 time=.5 wait=30
create name dom1,animate me 04. 1 1 600;adone rotate 0 0 26 time=.5 wait=30 (....and so on....)
create name dom1,animate me 02. 1 1 13250;adone rotate 0 0 26 time=.5 wait=30 (=> the animation continues until the last domino)
********** Dominos Animation (with the timer command) ***************
This is how the timer dominos work : The commands are also in each of the dominos , and they are seperated by 150 milliseconds. When the dominos start to fall down, they make a rotation. The animation starts by clicking upon the sign object.
sign4.rwx
create sign q=100 bcolor=b,timer dom2 4000 stop; activate timer dom2 reset global
boardv2m.rwx
create texture 01;at tm dom2 150, rotate 0 0 26 time=.5 wait=30 (= the first domino)
create texture 02;at tm dom2 300,rotate 0 0 26 time=.5 wait=30
create texture 03;at tm dom2 450,rotate 0 0 26 time=.5 wait=30
create texture 04;at tm dom2 600, rotate 0 0 26 time=.5 wait=30 (....and so on....)
create texture 04;at tm dom2 3600,rotate 0 0 26 time=.5 wait=30 (=> the animation continues until the last domino)
As you can see , the timer command and the animation command have the same animation.

 

********** Horse Animation **********
In this example, we start the animation by clicking upon the green pole.The animation itself is stored in the 3rd pole, where the horse starts to walk during 5 seconds, then turns around and walks back. After 10 seconds the horse stops walking (2nd pole) and then the horse is waiting (3rd pole : qwait1 sequence)
horse15.rwx (=avatar object)
create name horse
pole1m.rwx
create color green; activate timer walk reset global
pole1m.rwx
create timer walk 10000 stop
pole1m.rwx
at tm walk 1,seq walk loop name=horse,move 0 0 10 ltm time=5 wait=0 name=horse
;at tm walk 5000,rotate 60 time=.5 wait=4.5 name=horse
;at tm walk 10000,seq qwait1 name=horse

********** Dolfin Animation 1 **********
By rescaling the xaw14 object, you will obtain a dolfin. In the first animation example, the dolfin goes around in circles and goes up and down by using gravity commands.
xaw14
create scale 5 .7 .8,collider hull nograv,hinge 0 0 12,animate me . 1 1 1000,astart;adone velocity -6 0 0 ltm,astart

 

********** Dolfin Animation 2 **********
In this example, we start with 4 dolfins, en make a square animation, just like the cubes animation in the previous animation workshop, and only 1 dolfin remains visible.
xaw14.rwx
create name flip1,scale 5 .6 .8,color grey
create name flip2,scale 5 .6 .8,color grey,visible no
create name flip3,scale 5 .6 .8,color grey,visible no
create name flip4,scale 5 .6 .8,color grey,visible no
We create a pole object and add the timer command. Then we create 4 pole objects, upon which we put the animation for each dolfin.
pole1m.rwx
create timer swim 11800 loop=10 stop
at tm swim 1,move 0 0 10 ltm time=3 reset name=flip1,rotate 60 time=.25 wait=2.75 name=flip1,visible flip1 on,visible flip4 no
at tm swim 3000,move 0 0 10 ltm time=3 reset name=flip2,rotate 60 time=.25 wait=2.75 name=flip2,visible flip2 on,visible flip1 no
at tm swim 6000,move 0 0 10 ltm time=3 reset name=flip3,rotate 60 time=.25 wait=2.75 name=flip3,visible flip3 on,visible flip2 no
at tm swim 9000,move 0 0 10 ltm time=3 reset name=flip4,rotate 60 time=.25 wait=2.75 name=flip4,visible flip4 on,visible flip3 no
Finally we create a sign object, where the animation is activated when clicking on it.
sign3.rwx
create sign "start" ;activate timer swim reset global
Examples of the domino and dolfin animations are located in AWschool on position 33N 121E , and you can see the difference between the animate and the timer command.