Search code snippets, questions, articles...

Embed animated files AMP

To add or embed animated files like gif or webp on your AMP page then you can use amp-anim component of AMP.
<!-- Load animation script in the head tag -->
<script async custom-element="amp-anim" src="https://cdn.ampproject.org/v0/amp-anim-0.1.js"></script>

<!-- Use amp-anim where you want to show the animated file -->
<amp-anim width="500" height="350" src="/path/to/gif/or/webp/image.gif" alt="animation of file" attribution="">
  <amp-img placeholder width="500" height="350" src="/path/to/placeholder/image.png"></amp-img>
</amp-anim>

Search Index Data (The code snippet can also be found with below search text)

add gif file AMP
Was this helpful?
0 Comments