你能用Javascript控制GIF动画吗?

你能用Javascript控制GIF动画吗?

问题描述:

是否可以使用 javascript 来控制 GIF 图像的哪一帧正在显示和/或停止动画.我希望能够加载带有多个帧的 GIF 并且只显示其中一个.

Is it possible to use javascript to control which frame of a GIF image is showing and/or stop the animation. I want to be able to load a GIF with several frames and only show one of them.

我知道我可以用很多单独的图像来做,但如果我可以用 GIF 做我想做的事,那么它只需要担心一个文件.

I know I could do it with lots of separate images, but if I can do what I want with a GIF, it will only be one file to worry about.

您可以使用 CSS 精灵.