[ad_1]
I can set featured images as a gif, and I know how to style the featured images from their div container, but I’m wondering how it’d be possible to only animate the gif while it’s in the viewport? Does this require JavaScript, and would it slow down page speed considerably?
I want to copy what a lot of VOD sites do that play a preview of the video (WEBP or GIF) while it’s in view before clicking on it.

Yes it requires JavaScript. Most sites use mp4 now as gif are extremely heavy for video files as they don’t have compression. Look into the new JS “intersection observer”