Running a .gif on page scroll?

I’ve seen some great stacks which move images horizontal as I scroll down a page, looks great on mobile especially and I was wondering if that some kind of effect could work for animated gif or png files.

This is probably a feature I might never use but it might be really funfair some things. Has anyone seen a stack that would run through the gif animation on scrolling? Especially if it could run forwards on a scroll down page and then reverse on a scroll up.