All Projects → LottieFiles → Lottie Player

LottieFiles / Lottie Player

Licence: mit
Lottie viewer/player as an easy to use web component! https://lottiefiles.com/web-player

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Lottie Player

qtlottie
QtLottie is a tiny C++ library that can render Adobe® After Effects™ animations exported as JSON with Bodymovin.
Stars: ✭ 23 (-94.97%)
Mutual labels:  lottie
Ng Lottie
Render After Effects animations on Angular based on lottie-web
Stars: ✭ 311 (-31.95%)
Mutual labels:  lottie
Vaadin Grid
vaadin-grid is a free, high quality data grid / data table Web Component. Part of the Vaadin components.
Stars: ✭ 383 (-16.19%)
Mutual labels:  web-component
tgskit
Toolkit for dealing with Telegram Stickers and Bodymovin/Lottie animations.
Stars: ✭ 45 (-90.15%)
Mutual labels:  lottie
LottieExampleProject
This is an example project for using Lottie in Android applications
Stars: ✭ 17 (-96.28%)
Mutual labels:  lottie
X Frame Bypass
Web Component extending IFrame to bypass X-Frame-Options: deny/sameorigin
Stars: ✭ 335 (-26.7%)
Mutual labels:  web-component
vaadin-icons
Vaadin Icons is a collection of 600+ unique icons designed for web applications
Stars: ✭ 59 (-87.09%)
Mutual labels:  web-component
Polymer Redux
Polymer bindings for Redux.
Stars: ✭ 450 (-1.53%)
Mutual labels:  web-component
Lottieuwp
UWP port of Lottie(https://github.com/airbnb/lottie-android)
Stars: ✭ 276 (-39.61%)
Mutual labels:  lottie
Zhumulangma
高仿喜马拉雅Android客户端,单activity多fragme组件化架构(新增ams版)
Stars: ✭ 377 (-17.51%)
Mutual labels:  lottie
svelte-webcomponents
A ready-to-use project template to build custom elements (web components) with Svelte 3 with support and examples for web components, jest, sass, nested components with props, eslinting, stylelinting, Github actions, propagating custom events from shadow-DOM to real-DOM etc.
Stars: ✭ 22 (-95.19%)
Mutual labels:  web-component
puppeteer-lottie-cli
CLI for rendering Lottie animations via Puppeteer to image, GIF, or MP4.
Stars: ✭ 85 (-81.4%)
Mutual labels:  lottie
Css Doodle
🎨 A web component for drawing patterns with CSS.
Stars: ✭ 4,014 (+778.34%)
Mutual labels:  web-component
vaadin-text-field
The themable Web Component providing input controls. Part of the Vaadin components.
Stars: ✭ 29 (-93.65%)
Mutual labels:  web-component
Urweatherview
Show the weather effects onto view written in Swift4.2
Stars: ✭ 439 (-3.94%)
Mutual labels:  lottie
streamlit-lottie
Streamlit component to render Lottie animations
Stars: ✭ 47 (-89.72%)
Mutual labels:  lottie
Lottie Windows
Lottie-Windows is a library (and related tools) for rendering Lottie animations on Windows 10.
Stars: ✭ 322 (-29.54%)
Mutual labels:  lottie
React Native Pull Refresh
Custom pull to refresh component for Android
Stars: ✭ 456 (-0.22%)
Mutual labels:  lottie
Lottie Flutter
Render After Effects animations natively on Flutter. This package is a pure Dart implementation of a Lottie player.
Stars: ✭ 444 (-2.84%)
Mutual labels:  lottie
React Native Messenger
Facebook Messenger Implementation using react-native
Stars: ✭ 351 (-23.19%)
Mutual labels:  lottie

lottie-player Web Component

This is a Web Component for easily embedding and playing Lottie animations and the Lottie-based Telegram Sticker (tgs) animations in websites.

npm webcomponents.org

Demo

screencast

Documentation

Installation

In HTML, import from CDN or from the local Installation:

Lottie Player:
  • Import from CDN.
<script src="https://unpkg.com/@lottiefiles/[email protected]/dist/lottie-player.js"></script>
  • Import from local node_modules directory.
<script src="/node_modules/@lottiefiles/lottie-player/dist/lottie-player.js"></script>
Telegram Sticker (TGS) Player:
  • Import from CDN.
<script src="https://unpkg.com/@lottiefiles/[email protected]/dist/tgs-player.js"></script>
  • Import from local node_modules directory.
<script src="/node_modules/@lottiefiles/lottie-player/dist/tgs-player.js"></script>

In Javascript or TypeScript:

  1. Install package using npm or yarn.
npm install --save @lottiefiles/lottie-player
  1. Import package in your code.
import "@lottiefiles/lottie-player";

Usage

Lottie-Player

Add the element lottie-player and set the src property to a URL pointing to a valid Bodymovin JSON.

<lottie-player
  autoplay
  controls
  loop
  mode="normal"
  src="https://assets3.lottiefiles.com/packages/lf20_UJNc2t.json"
  style="width: 320px"
>
</lottie-player>

You may set and load animations programatically as well.

<lottie-player autoplay controls loop mode="normal" style="width: 320px">
</lottie-player>
const player = document.querySelector("lottie-player");
player.load("https://assets3.lottiefiles.com/packages/lf20_UJNc2t.json");

// or load via a Bodymovin JSON string/object
player.load(
  '{"v":"5.3.4","fr":30,"ip":0,"op":38,"w":315,"h":600,"nm":"new", ... }'
);

TGS-Player

Add the element tgs-player and set the src property to a URL pointing to a valid TGS JSON.

<tgs-player autoplay loop mode="normal" src="https//domain/example.tgs">
</tgs-player>

Properties

Property Attribute Description Type Default
autoplay autoplay Autoplay animation on load. boolean false
background background Background color. string undefined
controls controls Show controls. boolean false
count count Number of times to loop animation. number undefined
direction direction Direction of animation. number 1
hover hover Whether to play on mouse hover. boolean false
loop loop Whether to loop animation. boolean false
mode mode Play mode. PlayMode.Bounce | PlayMode.Normal PlayMode.Normal
preserveAspectRatio preserveAspectRatio Valid preserve aspect ratio value. string 'xMidYMid meet'
renderer renderer Renderer to use. `"svg" "canvas"`
speed speed Animation speed. number 1
src (required) src Bodymovin JSON data or URL to JSON. string undefined

Methods

getLottie() => Promise<any>

Returns the instance of lottie player used in the component.

Returns

Type: Promise<any>

load(src: string | object) => void

Load (and play) a given Bodymovin animation.

Parameters

Name Type Description
src string or object URL, or a JSON string or object representing a Bodymovin JSON.

Returns

Type: void

pause() => void

Pause animation play.

Returns

Type: void

play() => void

Start playing animation.

Returns

Type: void

setDirection(value: number) => void

Animation play direction.

Parameters

Name Type Description
value number Direction values.

Returns

Type: void

setLooping(value: boolean) => void

Sets the looping of the animation.

Parameters

Name Type Description
value boolean Whether to enable looping. Boolean true enables looping.

Returns

Type: void

setSpeed(value?: number) => void

Sets animation play speed.

Parameters

Name Type Description
value number Playback speed.

Returns

Type: void

stop() => void

Stops animation play.

Returns

Type: void

seek(value: number | string) => void

Seek to a given frame. Frame value can be a number or a percent string (e.g. 50%).

Returns

Type: void

snapshot(download?: boolean) => string

Snapshot the current frame as SVG. If 'download' argument is boolean true, then a download is triggered in browser.

Returns

Type: string

toggleLooping() => void

Toggles animation looping.

Returns

Type: void

togglePlay() => void

Toggle playing state.

Returns

Type: void

resize() => void

Resize animation stage and elements in response to changes in component.

Returns

Type: void

Events

The following events are exposed and can be listened to via addEventListener calls.

Name Description
load Animation data is loaded.
error An animation source cannot be parsed, fails to load or has format errors.
ready Animation data is loaded and player is ready.
play Animation starts playing.
pause Animation is paused.
stop Animation is stopped.
freeze Animation is paused due to player being invisible.
loop An animation loop is completed.
complete Animation is complete (all loops completed).
frame A new frame is entered.

Styling

Custom property Description Default
--lottie-player-toolbar-height Toolbar height 35px
--lottie-player-toolbar-background-color Toolbar background color transparent
--lottie-player-toolbar-icon-color Toolbar icon color #999
--lottie-player-toolbar-icon-hover-color Toolbar icon hover color #222
--lottie-player-toolbar-icon-active-color Toolbar icon active color #555
--lottie-player-seeker-track-color Seeker track color #CCC
--lottie-player-seeker-thumb-color Seeker thumb color rgba(0, 107, 120, 0.8)

License

MIT License © LottieFiles.com

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].