There is a perception that instead of using hundreds of pictures, a single video file could be a better approach. If we talk about it globally, then yes, it is doable. However, there are several factors to consider:
- If you want the animation to function appropriately, then it must be encoded and formatted correctly. The experience can be ruined if you use the wrong format and only a few frames of the video might be shown.
- You might experience some problems in searching the specific keyframe when utilizing a video because different browsers' implementations depend on the platform and codec being used. On lots of gadgets, it won't look as smooth.
- The video quality is substantially lower, and there isn't much support for codecs other than h264.
From a code and dependability perspective, using images is a much simpler approach. The only drawback here is that occasionally, images are larger from the size perspective than well-compressed videos.
However, if you think the video approach is the most appropriate idea for you then definitely go for it. In
this amazing and very interactive tutorial by Dev Ed, you'll get all the instructions needed.