I'm not sure an animated GIF will work inside a PDF file, but section 14.1 of the Beamer User Guide (at least, in the latest version) offers various suggestions for animating images. The images would be in individual files (unless you used an external program to convert them into a timed "movie", which is one possibility).
As far as the book goes, would this book be stored as a PDF file? Obviously a book cannot contain an animated image (unless you use the "flip book" approach that is sometimes used for children's books). Paul