Hacker News new | past | comments | ask | show | jobs | submit login

No need to guess. Here's a very complete and detailed article about precisely why and how this particular animation works the way it does:

http://awardwinningfjords.com/2012/03/08/image-sequences.htm...




That only explains why use a sprite sheet. But not why use jpg instead of gif. Neither it talks about the alternative of gif animation. Does the javascript dom method really offers better performance than a simple gif animation? Or were gif animations taken off the equation before that comparison for other reasons?


Animated GIFs max out at 8 bits of color (per frame, but still). The animation cycle of GIFs starts when the image is loaded and can't be controlled via JS. Yes, if you just wanted an 8-bit orb bouncing, it's a fine choice. For a game sprite, it's less so.


Thanks for that article. Makes sense now. They were able to achieve higher frame rates and take advantage of hardware acceleration by using CSS animations with the individual sprite slices serving as key frames.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: