My project has a lot of GIF images on all pages as it's a library. This makes the page size huge. So I decided to turn all animated GIF images to PNG image sprites (which reduces image size dramatically) and animate them by JS. But now question appears - the project has been showing those GIF images for years, how will that impact SEO? Will it create problems with search engines?
Have you tried optimizing the GIF images? Properly made GIFs usually shouldn't be much larger than PNG sprite.
But as far as SEO goes - it shouldn't have much, if any, effect on rankings. Just make sure your JS solution works on all browsers and devices. And maybe have the old GIFs as fallback in noscript tags.
The only way that changing your images would change your web rankings is if users hated your site and stopped using it. As long as your users are happy, your Google rankings aren't going to suffer. In fact, with a faster site ranking could even improve.
I've done countless projects where we change technical details such as scripts, images, and which HTML tags are used. Google rankings don't even blink for such changes unless you royally mess up the site.
If the images are ranking in image search, it is likely that image search rankings will be dramatically changed. To minimize impacts you can either leave the old gifs in place or redirect to the new pngs.