Socket
Socket
Sign inDemoInstall

@lottiefiles/lottie-js

Package Overview
Dependencies
28
Maintainers
3
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @lottiefiles/lottie-js

Lottie JSON model for Javascript/Typescript


Version published
Maintainers
3
Created

Changelog

Source

0.1.0 (2021-10-19)

Bug Fixes

  • layer: shape layer serialization (d17188f)
  • Linting issues (e88f426)
  • ellipse: added missing property Direction (58bc619)
  • fix import: fix import for test file (c59c1ab)

Features

  • Add constructors for animated properties and keyframes (be30ed4)
  • add marker support (ec26c59)
  • Add rounded corners shape (589fb43)
  • Add star shape (35360d6)
  • Implement Gradients (ca898bd)
  • Repeater shape (6b42c08)
  • Trim multiple shapes mode (ba6cdad)
  • color extraction updates: color extraction code (e935e00)
  • theming code: theming code (c4fda3f)

Readme

Source

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.

Usage

  1. Install
yarn add @lottiefiles/lottie-js@0.0.1
  1. Use
import { Lottie } 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 = 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

Documentation is available here Click me

The documenting system used is TypeDoc.

The documentation will be made available on the web soon as a way of providing secure access to it within LottieFiles team is setup. In the mean time 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

FAQs

Last updated on 19 May 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc