@fivethree/lottie
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

Lottie Animation Component

npm version License

Lottie Animation Component for Angular 8 or higher.

Angular @fivehtree/core
8/9 0.3.x+
7 0.2.x

📦 Installation

npm install @fivethree/lottie lottie-web --save

# or if you are using yarn
yarn add @fivethree/lottie lottie-web

🔨 Usage

Import the module into your root application module:

import { NgModule } from '@angular/core';
import { LottieModule } from '@fivethree/lottie';

@NgModule({
  imports: [LottieModule]
})
export class AppModule {}

🦁 Animation

Add the lottie component to your template:

<fiv-lottie
  [params]="lottieParams"
  [width]="250"
  [height]="250"
  (animationCreated)="onAnimationCreated($event)"
></fiv-lottie>

You need to setup the lottieParams in your component:

import { Component } from '@angular/core';
import { LottieAnimation, LottieParams } from '@fivethree/lottie';

Component({
  selector: 'app-home',
  templateUrl: 'home.page.html',
  styleUrls: ['home.page.scss']
})
export class HomePage {
  lottieParams: LottieParams = {
    path: 'assets/lottie/empty_box.json',
    renderer: 'canvas',
    loop: true
  };

  onAnimationCreated(animation: LottieAnimation) {
    animation.play();
    animation.setSpeed(0.8);
  }
}

Save your lottie files in the assets folder and change the path param, this way they are copied when building your application.

Package Sidebar

Install

npm i @fivethree/lottie

Weekly Downloads

120

Version

0.3.0

License

MIT

Unpacked Size

94.1 kB

Total Files

26

Last publish

Collaborators

  • garygrossgarten
  • marcjulian