Appendix G - "Animation" Effects


Various package modules allow the user to drag items around to position them, whilst not erasing the contents of the window underneath. This dragging effect utilises a set of program routines contained in the animation unit. In the following example of animation, a drag-able object - a pointing hand, is moved over a picture of a boy, without erasing the picture of the boy as the hand passes over it.


Initialise Sequence.

Initialisation consists of three stages.


1.Three off-screen areas, called "Holder", "Under" and "Zap", and as large as the drag-able object are created. The area of the screen that is to be occupied by the dragged object is copied to the "Holder" area.


2.The contents of the "Holder" area are copied to the "Zap" area, then the drag-able object is drawn on top.


3. The contents of the "Zap" area are copied onto the screen. Initialisation is complete.


Animate Sequence

The following sequence occurs whenever the drag-able object's position changes on the screen, and consists of the following 8 stages.


1. The contents of the "Holder" area are copied into the "Under" area.


2. The area of the screen that the drag-able item is moving to is copied to the "Holder" area.


3. Where the original position rectangle intersects the destination rectangle (the intended position for the drag-able object), the contents of that part of the "Under" area is copied to the "Holder" area. If the area of intersection is empty (the 2 rectangles do not intersect), then no copying needs to be done in this step.


4. The contents of the "Holder" area are copied into the "Zap" area.


5. The drag-able item is drawn onto the "Zap" area.


6. That area of the "Zap" area which intersects with the "Under" area is copied to the "Under" area.


7. The contents of the "Zap" area are copied onto the screen.


8. The contents of the "Under" area are copied onto the screen, effectively erasing the previous view of the drag-able object.


A complete cycle of animation is complete. If the drag-able object is moved again, control starts again from stage 4.
back to Appendix F. forward to Appendix H