If you're talking about making it in HTML, then yes, you can do this. Basically, animated gifs are the same images just like any other ones. Here's an example code:
HTML:
<a href="https://www.macrumors.com/">
<img src="some.gif" alt="Link to MacRumors">
</a>
I attached a page with the code so you can take a look at it your browser.