AMP
  • websites

amp-anim

Introduction

Use amp-anim to embed animations (gif, webp) into your AMP HTML files. Animation files should be loaded via HTTPS.

Setup

Import the animation component in the header.

<script async custom-element="amp-anim" src="https://cdn.ampproject.org/v0/amp-anim-0.1.js"></script>

Basic usage

A basic embed. The usage of amp-anim is similar to that of amp-img.

<amp-anim width="245" height="300" src="/static/samples/img/gopher.gif" alt="an animation" attribution="The Go gopher was designed by Reneee French and is licensed under CC 3.0 attributions.">
</amp-anim>

Placeholder

You can use amp-img as a placeholder when loading of src file takes time. The placeholder attribute must be added to the nested amp-img in this case.

<amp-anim width="245" height="300" src="/static/samples/img/gopher.gif" alt="an animation" attribution="The Go gopher was designed by Reneee French and is licensed under CC 3.0 attributions.">
  <amp-img placeholder width="245" height="300" src="/static/samples/img/gopher.png"></amp-img>
</amp-anim>
Ti servono altre spiegazioni?

Se le spiegazioni riportate in questa pagina non rispondono a tutte le tue domande, non esitare a contattare altri utenti AMP per discutere il tuo caso d'uso specifico.

Vai a Stack Overflow
Ci sono funzioni non descritte?

Il progetto AMP invita tutti a partecipare e dare il proprio contributo! Ci auguriamo che tu possa partecipare regolarmente alla nostra community open source, ma saremo anche lieti di ricevere eventuali contributi una-tantum sulle questioni che ti interessano.

Modifica esempio in GitHub