Is there any way to detect via javascript whether a GIF image's animation is completed or not?
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- Can php detect if javascript is on or not?
No, it is not. Javascript cannot manipulate GIF directly. But maybe jsgif can help you
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.