+(defconst image-minimum-frame-delay 0.01
+ "Minimum interval in seconds between frames of an animated image.")
+
+(defun image-current-frame (image)
+ "The current frame number of IMAGE, indexed from 0."
+ (or (plist-get (cdr image) :index) 0))
+
+(defun image-show-frame (image n &optional nocheck)
+ "Show frame N of IMAGE.
+Frames are indexed from 0. Optional argument NOCHECK non-nil means
+do not check N is within the range of frames present in the image."
+ (unless nocheck
+ (if (< n 0) (setq n 0)
+ (setq n (min n (1- (car (image-multi-frame-p image)))))))
+ (plist-put (cdr image) :index n)
+ (force-window-update))
+
+(defun image-animate-get-speed (image)
+ "Return the speed factor for animating IMAGE."
+ (or (plist-get (cdr image) :speed) 1))
+
+(defun image-animate-set-speed (image value &optional multiply)
+ "Set the speed factor for animating IMAGE to VALUE.
+With optional argument MULTIPLY non-nil, treat VALUE as a
+multiplication factor for the current value."
+ (plist-put (cdr image) :speed
+ (if multiply
+ (* value (image-animate-get-speed image))
+ value)))
+