Search code examples
javascriptanimationpng

Animated .png files in javascript


I'm writing a game, and I want to be able to animate some of my .png images. My world generator can place static images, is there a way to have javascript search the page for an image, and replace it with something else, or something similar to that?


Solution

  • Have you tried APNG?

    Animated

    is there a way to have javascript search the page for an image, and replace it with something else

    This can be done with jQuery:

    $('img[src="http://foo.bar/image.jpg"]').attr('src', 'http://foo.bar/flower.jpg');