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.
![](fig/figF_1.gif)
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.
![](fig/figF_2.gif)
2.The contents of the "Holder" area are copied to the "Zap" area, then the drag-able
object is drawn on top.
![](fig/figF_3.gif)
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.
![](fig/figF_4.gif)
1. The contents of the "Holder" area are copied into the "Under"
area.
![](fig/figF_5.gif)
2. The area of the screen that the drag-able item
is moving to is copied to the "Holder" area.
![](fig/figF_6.gif)
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.
![](fig/figF_7.gif)
4. The contents of the "Holder" area are copied into the "Zap" area.
![](fig/figF_8.gif)
5. The drag-able item is drawn onto the "Zap" area.
![](fig/figF_9.gif)
6. That area of the "Zap" area which intersects with the "Under" area is copied to the "Under" area.
![](fig/figF_10.gif)
7. The contents of the "Zap" area are copied onto the screen.
![](fig/figF_11.gif)
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