你可以用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 sprites