Do you build things with AMP? Fill out the AMP Developer Survey!
AMP

amp-bodymovin-animation

Displays an AirBnB Bodymovin animation player.

Required Scripts

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

The <amp-bodymovin-animation> component embeds an AirBnB Bodymovin animation player, which renders an animation from JSON generated by Adobe After Effects.

Behavior

The width and height attributes determine the aspect ratio of the animation embedded in responsive layouts.

Example:

<amp-bodymovin-animation
  layout="fixed"
  width="200"
  height="200"
  src="https://nainar.github.io/loader.json"
  loop="5"
>
</amp-bodymovin-animation>

Attributes

src The path to the exported Bodymovin animation object. Must be https protocol.
loop (optional) Indicates whether the animation should be looping or not. By default, this attribute is set to true. Values for this attribute can be: true, false, or a number value. If a number is specified, the animation loops that number of times.
noautoplay (optional) By default, an animation autoplays. If this attribute is added the video waits for an action to start playing.
renderer (optional) By default, this component uses the SVG renderer, this uses a light version of the Bodymovin animation player. However, if developers feel that they need the full player and want to use an HTML renderer they may do so by specifying the renderer attribute to be html.
This attribute only accepts the values html and svg.
common attributes This element includes common attributes extended to AMP components.

Actions

Please see AMP Action Documentation for the actions available on amp-bodymovin-animation component.

Validation

See amp-bodymovin-animation rules in the AMP validator specification.

需要更多帮助?

您多次阅读的资料未能涵盖您的所有问题?也许其他人也这么觉得 在 Stack Overflow 上与他们取得联系。

前往 Stack Overflow
找到一个 bug 或者缺失某项功能?

AMP 项目强烈鼓励您参与其中并作出贡献!我们希望您能成为我们开源社区的持续参与者,但我们也欢迎您对热衷问题做出单次贡献。

前往 GitHub