The GIF89a standard (the one we use today) includes the so-called User Input
flag that was designed exactly for this.
That flag, being set on a certain frame, should tell a GIF decoder not to show the next frame until either the timeout expires or the user interacts with the current one.
Zero timeout coupled with nonzero User Input
means that the decoder should wait for an interaction indefinitely.
Quote from the standard:
v) User Input Flag - Indicates whether or not user input is
expected before continuing. If the flag is set, processing will
continue when user input is entered. The nature of the User input
is determined by the application (Carriage Return, Mouse Button
Click, etc.).
Values : 0 - User input is not expected.
1 - User input is expected.
When a Delay Time is used and the User Input Flag is set,
processing will continue when user input is received or when the
delay time expires, whichever occurs first.
Unfortunately, no GIF decoders I know of even bother to handle this flag properly — so I guess your best bet is to give both frames reasonable timeouts, 10±5 seconds or so.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…