AMP
  • websites

amp-bodymovin-animation

Introduction

Embed Bodymovin animations in your AMP HTML files. The amp-bodymovin-animation component embeds an AirBnB Bodymovin animation player, which renders an animation from JSON generated by Adobe After Effects. The doc describing this element can be found here and the actions supported by this element can be found on the AMP Actions and Events page here.

Setup

Import the amp-bodymovin-animation component in the header.

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

Basic Usage

Embed Bodymovin animations via the src attribute.

<amp-bodymovin-animation layout="fixed" width="200" height="200" src="https://amp.dev/static/samples/json/bodymovin_red_circle.json">
</amp-bodymovin-animation>

Attributes

This section covers how you can customize the animation produced by bodymovin for your needs.

  • src - The path to the exported Bodymovin animation object. Must be https protocol.
  • loop - 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 - By default, an animation autoplays. If this attribute is added the video waits for an action to start playing.

The following animation only loops five times.

<amp-bodymovin-animation layout="responsive" width="1920" height="1080" src="https://amp.dev/static/samples/json/bodymovin_happy_2016.json" loop="5">
</amp-bodymovin-animation>
자세한 설명이 필요하신가요?

이 페이지의 설명만으로 궁금한 점이 모두 해결되지 않는다면 다른 AMP 사용자에게 문의하여 구체적인 활용 사례를 논의해 보세요.

Stack Overflow로 이동
설명이 부족한 기능을 발견하셨나요?

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

GitHub에서 샘플 수정하기