ANI

A powerful multifunctional animator (HP 49G/49g+)


ANI is a tiny tool but much more powerful than the built-in ANIMATE. Examples in this package illustrate this. With ANI you may generate own exciting graphic animations in UsrRPL. ANI has two arguments as follows: A list of at least 2 grobs of size not greater then 131 x 64 in Level 2 called GL in the sequel, and a Parameter list in Level 1. Speed and direction of the moving pictures are controlled by the arrow keys. UpArrow = speed up, DownArrow = slow down. NXT is the Stand-by key. With a double-click on NXT one gets the pictures in single steps (strobe).

ANI can operate in two modes. In the alternating picture mode the grobs change at a fixed place like in ANIMATE. In the moving picture mode, the grobs move in addition over the screen from left to right or conversely. Moving direction can be reversed with RightArrow and LeftArrow. CANCEL or Backspace abort. In addition, one or two programs for sounds or other events can be put into the Parameter list as explained below and illustrated by the examples. Development and tests were made in ROM 19-6 and in ROM 1.22 of the HP 49g+.


NEW in version 2.2003
Animation ORBIT made more perfect. 30 precise pictures of the earth are used.

NEW in version 1.2003
This htm document added. Previous versions were not numbered.


The Parameter list argument in Level 1

It has has the shape { x y ... z } and is of minimum size 3 and maximum size 5. The parameters x, y, z are reals or zints. z may have the values -3, -2, -1, 0, 1, 2 and 3. Put z = 0 just for the alternating picture mode. If z is positive, the grobs move at the beginning from left to right like in HORSE, if negative pictures move from right to left like in DINO. While the animation is running, the moving direction may repeatedly be changed with any key. The absolute value of z is the jump from picture to picture in pixels. Actually, the jump may even greater than 3 pixels.

x,y are the pixel coordinates of the left upper corner of the first grob from GL that appears on the screen. In alternating picture mode, x,y remain fixed. In moving picture mode, only y is fixed while x changes its value as the animation proceeds. The dots in the Parameter list { x y ... z } represent either nothing or one or two additional actions or its names, mostly sounds, but perhaps also some additional display. The 1st action is evaluated right after the display of the 1st grob from GL. A 2nd action is evaluated right after the appearance of the other grobs. These optional actions must not leave anything on the stack! See the parameter values in the examples below.

Commenting the examples

Our examples are SysRPL programs in order to keep them small. They could have been written in UsrRPL as well. The programs generate the two argument lists, prepare the screen, and then call ANI. Grob lists or the animation as a whole are BZ-compressed. Load Ani49.zip to your PC and unzip. Then load ANI and one or several of the animations to the calculator, best in a separate directory Games. ANI does not use PICTURE nor does it affect any flags or the stack.

 BOY (left-hand screen) is essentially the program This means the grobs alternate in fixed position at (87,28). The grobs have the left upper corner at the true pixel coordinates x=87 and y=28 all the time. Snd is a single (kick) sound at the begin of each grob cycle. GIRL (right-hand screen) is essentially  « GL { 0 0 0} ANI ». This means the many 131x64 grobs alternate on the full screen with left upper corner position at (0,0). In this case the program itself is a self-decompressing code (for seeing the decompressed program you may use the BZ-toggler of OT49). It first generates the 24 full screen grobs in GL from smaller grob elements. This saves a lot of bytes. The program also prepares the screen. In the present case this means essentially cleaning it and erasing the menu while in BOY the menu is preserved.

Dino is  « CLLCD "Time for breakfast" { 30 0 } 1 DISPXY GL { 4  0  Act1  Act2  -3 } ANI ». That is, first the screen is blanked and "Time for breakfast" is written on top before the animation starts. In this animation is z = -3 which means the move starts from right to left with pixel jump 3. But as always, you may force the Dino also to walk backward. Act1 is simply a sound. Act2 yields another sound and redraws the "Sun&Palm" picture each time the 2nd Dino picture is displayed. This ensures that the Sun&Palm picture reappears when the walking Dino covered it and then disappeared. This example presents the only 49g+ screen-shot in this document. On the 49g+, the screen's title text will not be erased anymore by the walking Dino, because of the larger screen. Attention: Dino is for the 49G ROM 19-6, DinoP is for the 49g+. As soon as the 49 gets a ROM >19-6, DinoP will run on both calculators.

 

The ORBIT animationORBIT is essentially  « GL { 5  0  Act  1 } ». Here Act is a program which does this:  « Display the sun, and while the earth disappears  use a very small earth grob to generate the impression that the earth returns behind the sun on its orbit ». Here the program delimiters are somewhat misused but it is obvious how to program this action provided it is known in any moment whether the earth is still on the screen or disappeared. Clearly, the sun cannot be implanted into the screen before starting the animation but must be regenerated during each earth rotation. Otherwise we would not see the sun again after the earth moves on and ceases to cover the sun. GL consist of 30 different views of the earth of size 64x64 each, 15.7 kB uncompressed in the whole. In this animation the pictures are jumping just 1 pixel, hence many grobs are needed.

 

The HORSE animation uses a list of 5 different grobs (45 x 28) from the times when the newsgroup comp.sys.hp48 had still a lot of very skilled painters and programmers. Each horse picture had carefully been painted by hand.

 

Hint for experts. ANI has 8 nulllams which may be used in the action programs. Most useful are Lam3 and Lam4 (current delay modified by the arrow keys, and current x-coordinate of the moving grobs). Both are positive reals and are essentially used in the program Act occurring in the ORBIT Parameter list. In the moving picture mode, ANI enlarges ABUFF to size 393x64, with the upper left window corner at pixel position (131, 0).

Credits. The new earth pictures stem essentially from Otto Praxl who also helped to prepare this html-document.


Wolfgang Rautenberg - raut@math.fu-berlin.de - www.math.fu-berlin.de/~raut
The program ANI (360 bytes, CRC 6B8D) is strongly copyrighted and
must not be used or transmitted for commercial purposes.
2006-03-07