Determine GIF Animation Status?

2019-02-25 18:45发布

Is there any way to detect via javascript whether a GIF image's animation is completed or not?

2条回答
太酷不给撩
2楼-- · 2019-02-25 19:34

No, it is not. Javascript cannot manipulate GIF directly. But maybe jsgif can help you

查看更多
We Are One
3楼-- · 2019-02-25 19:44

By now it's possible. There are packages available to extract information from byte buffer. Like gif-info.

Combining that with HTMLImage.onload it's possible to start timeout exactly with delay when animation should already ended.

Or having duration value we can set up CSS animation on target image that would work in more stable way.

But although it's technically possible it still looks as overkill.

查看更多
登录 后发表回答