• Stars
    star
    143
  • Rank 257,007 (Top 6 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created about 4 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An object model for representing and manipulating the Lottie JSON structure in JS.

lottie-js

An object model for representing the Lottie JSON structure.

This library was created to make interacting with the Lottie JSON object simpler. The library consists of methods to map the Lottie JSON to the object model and interact with properties as well as manipulate them. The goal is to fully map the Lottie object model and add in enough helper methods to the library such that Lottie manipulation can be made easier without having to learn the entire complex structure of a Lottie file.

Full Documentation is available here Click me

Usage

  1. Install
yarn add @lottiefiles/[email protected]
  1. Use
import { Animation } from '@lottiefiles/lottie-js';

async function loadAnimation() {
  // Create Lottie instance
  // (you can also use Animation.fromJSON method if you already have the Lottie JSON loaded)
  const anim = await Animation.fromURL('https://assets1.lottiefiles.com/packages/lf20_u4j3xm6r.json');

  // Print some data of the animation
  console.log('Frame Rate', anim.frameRate);
  console.log('Number of Layers', anim.layers.length);
  console.log(anim.getColors());

  // Manipulate animation
  anim.name = 'Woohoo';
  anim.width = 512;
  anim.height = 512;

  // Get the new JSON
  const woohooLottie = JSON.stringify(anim);
  console.log(woohooLottie);
}

Promise.resolve(loadAnimation());

Documentation & API


The documenting system used is TypeDoc.

Clone the repo and run the yarn command: yarn docs to generate the docs to browse locally.

The generated documentation is placed in the docs/ folder.

Testing


The testing system used is Jest and each file should have an accompanying test suite for functional and integration tests.

Development


Development work on the toolkit requires Nodejs and Yarn.

Guidelines

  • Use defensive programming techniques: Ensure type and range of input values, cast values to native representation whenever possible, etc.
  • Refrain from using external dependencies: Discuss before adding a dependency. Check with Bundlephobia for package size and dependencies when choosing one.
  • Use code formatting in the IDE using the given eslint+prettier configs.
  • Write tests to cover all functions and code branches with valid and invalid values.

Setting up

git clone https://github.com/LottieFiles/lottie-js

cd lottie-js

yarn install

Running test suite

yarn test

Building

yarn build

More Repositories

1

lottie-player

Lottie viewer/player as an easy to use web component! https://lottiefiles.com/web-player
TypeScript
1,539
star
2

lottie-react

lottie web player as a react component
TypeScript
718
star
3

lottie-interactivity

A small javascript library to enable interactivity with Lottie animations
HTML
428
star
4

awesome-lottie

A curated list of bookmarks, libraries, tools and resources related to Lottie and Bodymovin
306
star
5

jlottie

A small-footprint lottie player in Javascript
CSS
182
star
6

dotlottie-web

Official LottieFiles player for rendering Lottie and dotLottie animations in the web. Supports React, Vue, Svelte, SolidJS and Web Components.
TypeScript
155
star
7

dotlottie-rs

A universal, high-performance Lottie and dotLottie player built with Rust. Offers smooth rendering across platforms, low resource consumption, and extensive compatibility. Features FFI bindings for Kotlin, Swift, and WASM for seamless integration in Android, iOS, and Web projects.
Rust
147
star
8

svelte-lottie-player

Lottie Player component for Svelte
HTML
136
star
9

glottie

OpenGL/WebGL based Lottie animation player
C++
117
star
10

lottie-vue

Lottie player wrapper for Vue.js
Vue
112
star
11

tgskit

Toolkit for dealing with Telegram Stickers and Bodymovin/Lottie animations.
TypeScript
62
star
12

relottie

Lottie processor powered by plugins
TypeScript
45
star
13

lottie-docs

Documentation for the lottie file format
Python
45
star
14

dotlottie-ios

.lottie player for iOS
C
41
star
15

dotlottie-android

Kotlin
37
star
16

svg-to-lottie-converter

SVG to Lottie API
Python
25
star
17

demo-audio-visualisation

Demonstration code for visualising audio with Lottie
C#
14
star
18

Course-for-Developers

In this quick course, you will learn the basics about implementing Lottie animations across your web and mobile apps.
10
star
19

lottie-theming

JavaScript
10
star
20

dotlottie-cs

C#
8
star
21

plugin-strapi

TypeScript
4
star
22

LottieNB

Simple insertion of Lottie player into Jupyter Notebooks
Jupyter Notebook
4
star
23

labs-epub3

Testing lottie support in an epub3 document
Shell
4
star
24

test-files

A collection of basic lotties to test lottie tooling
Python
3
star
25

lottie-styler

TypeScript
3
star
26

app-tutorial-lottieinteractions

A tutorial for Lottie Interactions
Swift
2
star
27

dotlottie-react-native

Kotlin
2
star
28

gltf-color

TypeScript
1
star