确定 GIF 动画状态? [英] Determine GIF Animation Status?

查看:25
本文介绍了确定 GIF 动画状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法通过javascript检测GIF图片的动画是否完成?

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

推荐答案

现在可以了.有一些包可用于从字节缓冲区中提取信息.像 gif-info.

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

结合 HTMLImage.onload 当动画应该已经结束时,可以完全延迟开始超时.

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

或者有持续时间值,我们可以在目标图像上设置 CSS 动画,以更稳定的方式工作.

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.

这篇关于确定 GIF 动画状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆