Basic animation was added to the GIF89a spec via the Graphics Control Extension (GCE), which allows various images (frames) in the file to be painted with time delays. An animated GIF file comprises a number of frames that are displayed in succession, each introduced by its own GCE, which gives the time delay to wait after the frame is drawn. Global information at the start of the file applies by default to all frames. The data is stream-oriented, so the file-offset of the start of each GCE depends on the length of preceding data. Within each frame the LZW-coded image data is arranged in sub-blocks of up to 255 bytes; the size of each sub-block is declared by the byte that precedes it.

By default, however, an animation displays the sequence of frames only once, stopping when the last frame is displayed. Since GIF is designed to allow users to define new blocks, Netscape in the 1990s used the Application Extension block (intended to allow vendors to add application-specific information to the GIF file) to implement the Netscape Application Block (NAB). This block, placed immediately before all the animation frames, specifies the number of times the sequence of frames should be played. (The value 0 signifies continuous display.) Support for these repeating animations first appeared in Netscape Navigator version 2.0, and then spread to other browsers. Most browsers now recognize and support NAB, though it is not strictly part of the GIF89a specification.

Copyright © CCJK Technologies Co., Ltd. 2000-2018. All rights reserved.