I use image / css sprites to optimize a webpage I’m working on, and one of the things thats often needed is an animated loading icon of some kind, which are typically animated .gif files.
Is it possible to add an animated gif to an image sprite (and not have to use gif for the whole sprite)? if so, how do I do that? Do any other image formats support animation?
No, this is not possible. Either the entire sprite sheet is a GIF, or not. you can’t mix filetypes in a single sprite. You could instead put all your GIF sprites into a sheet (if their frames are all divisible by one another), and all your PNG/JPG sprites into a second sheet, and use them separately.
The only other format (that I know of) that supports animation is APNG, but it’s supported only in Firefox. (Chrome has a buggy extension that supports it.)