Animated .GIF vs Spritesheet + JS/CSS

后端 未结 8 483
忘了有多久
忘了有多久 2020-12-23 11:51

Which will scale best for performance, file-size, (and my sanity): Animated .gifs or a spritesheet with animations using CSS (and JS when need be)?

File

8条回答
  •  一向
    一向 (楼主)
    2020-12-23 12:08

    If you're talking hundreds of sprites, then go with .gif. The more complex the animation, the more animations there is, the higher the load on the browser since more resources will be utilized to render the animation 'slide by slide' rather than just letting the animated .gif itself play.

    This gets worse when you take into consideration cross-browser compatibility where, as always, IE fails big time. I've never seen a site choke on lots of small .gifs but I see sites choke on simple javascript all the time. I can only imagine how bad it would get with hundreds of css/js animated images flipping all the time.

    If you don't mind me asking, what kind of site are these animations meant for? Is it some sort of animations portfolio or...?

提交回复
热议问题