AMP

Important: this documentation is not applicable to your currently selected format email!

amp-bodymovin-animation

Description

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>

Usage

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

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

<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)

Multiple renderers are supported and can be specified:

  • canvas
  • html
  • svg (default)

title (optional)

Define a title attribute for the component to propagate to the underlying <iframe> element. The default value is "Airbnb BodyMovin animation".

Common attributes

This element includes common attributes extended to AMP components.

Actions

play

Plays the animation.

pause

Pauses the animation.

stop

Stops the animation.

seekTo(time=INTEGER)

Sets the currentTime of the animation to the specified value and pauses animation.

seekTo(percent=[0,1])

Uses the given percentage value to determine the currentTime of the animation to the specified value and pauses animation.

Validation

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

도움이 더 필요하신가요?

이 문서를 수십 번 읽었음에도 여전히 궁금한 점이 남아 있나요? 다른 개발자들도 같은 심정일지 모릅니다. Stack Overflow에서 소통해 보세요.

Stack Overflow로 이동
버그나 누락된 기능을 발견하셨나요?

AMP 프로젝트는 여러분의 참여와 기여를 적극 환영합니다! 오픈 소스 커뮤니티를 통해 지속적으로 활동해 주셔도 좋지만 관심 있는 주제에 한 번만 기여하셔도 큰 도움이 됩니다.

GitHub로 이동하기