Question on Animated Pictures

I’m just curious as to how to make these animated pictures with multiple slides put together to create a moving picture. I heard somewhere that your suppose to use .GIFs. Is this true and how would I go about it?

Thanks for your time.