The offset parameter is used to move a small GIF image inside the boundaries of a larger image. This can produce very efficient animation when a single background cell can be used, and one or more small images can be translated around the background producing the movement.
Successful use of this method may require the use of an associated disposal method, and these, once again, suffer from incorrect support in some browsers.
This method of animation is the fundamental principle behind the 'automated' FRAME OPTIMIZATION schemes used in most of the public domain, and commercial animation packages. They divide the animation into small parts, and then use offsets to move each succeeding frame. See page 3 and page 4 of a previous section on optimization. To avoid using the disposal methods, the small frames contain enough additional information to write over the contents of previous frames. (Described in more detail elsewhere.)
Let's examine an animation created by using two GIF files, file A and file B. A is the background and is the larger, a grid to make it easier to explain (about 160 pixels wide by 60 pixels high). B, the smaller, is a red box about 20x20 pixels.
The first two frames of the animation are shown next. The RED BOX (file B) is placed on the GRID (file A) and is set to the coordinates (0,0). (0,0) represents the upper left corner of the GRID. Positive x-displacement is to the left and positive y-displacement is down.
RED BOX frame 1 (0,0)
RED BOX frame 2 (20,20)
RED BOX frame 3 (40,40)
RED BOX frame 4 (60,20)
...
RED BOX last frame (140,20)
Each of these frames is about a 500 byte GIF file, and there are 10 frames for a total of about 5K. If each frame were displayed in its entirety (flip-book style) this would be a rough estimate of the animation size.
|