npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@aliabbas101/dotlottie-angular

v0.0.2

Published

Angular wrapper for @lottiefiles/dotlottie-web

Readme

dotlottie-angular

Angular wrapper for @lottiefiles/dotlottie-web — the official Rust/WASM-powered Lottie & dotLottie player.

Files

index.ts                      ← public barrel
lib/
  dotlottie.types.ts          ← shared TypeScript types
  dotlottie.component.ts      ← <dot-lottie> standalone component
  dotlottie.directive.ts      ← canvas[dotLottie] standalone directive
  dotlottie.service.ts        ← DotLottieService (imperative / shared instances)
  dotlottie.module.ts         ← NgModule for non-standalone apps

Installation

npm install @lottiefiles/dotlottie-web
# copy the lib/ folder into your project's shared library, e.g. src/lib/dotlottie/

Usage

1. Component (recommended for most cases)

Drop <dot-lottie> anywhere in a template. Size it with Tailwind or plain CSS — the inner <canvas> fills the host element automatically.

<!-- standalone app.component.html -->
<dot-lottie
  src="assets/animations/welcome.lottie"
  [loop]="true"
  [autoplay]="true"
  [speed]="1"
  class="w-36 h-36"
  (playerReady)="onReady($event)"
  (complete)="onComplete()"
></dot-lottie>
// app.component.ts
import { DotLottieComponent } from '@/lib/dotlottie';
import type { DotLottie } from '@/lib/dotlottie';

@Component({
  standalone: true,
  imports: [DotLottieComponent],
  templateUrl: './app.component.html',
})
export class AppComponent {
  onReady(player: DotLottie) {
    console.log('total frames:', player.totalFrames);
  }

  onComplete() {
    console.log('animation finished');
  }
}

2. Directive (use on your own <canvas>)

Use canvas[dotLottie] when you need to own the canvas element directly — useful for custom id, aria-*, or fixed pixel dimensions.

<canvas
  dotLottie
  [src]="animSrc"
  [loop]="true"
  [autoplay]="true"
  width="200"
  height="200"
  class="rounded-xl"
  (complete)="onDone()"
></canvas>
import { DotLottieDirective } from '@/lib/dotlottie';

@Component({
  standalone: true,
  imports: [DotLottieDirective],
  template: `...`,
})
export class MyComponent {
  animSrc = 'assets/animations/success.lottie';
}

3. Service (imperative / shared instances)

Use DotLottieService to create and control players from TypeScript — useful for route-level pre-loading or cross-component control.

import { DotLottieService } from '@/lib/dotlottie';

@Component({ ... })
export class HeroComponent implements AfterViewInit {
  @ViewChild('canvas') canvasRef!: ElementRef<HTMLCanvasElement>;

  constructor(private lottie: DotLottieService) {}

  ngAfterViewInit() {
    this.lottie.create('hero', {
      canvas: this.canvasRef.nativeElement,
      src: 'assets/hero.lottie',
      autoplay: false,
      loop: true,
    });
  }

  play()  { this.lottie.play('hero');  }
  pause() { this.lottie.pause('hero'); }

  ngOnDestroy() {
    this.lottie.destroy('hero');
  }
}

4. NgModule (non-standalone apps)

import { DotLottieModule } from '@/lib/dotlottie';

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

All Inputs

| Input | Type | Default | Description | |--------------------------|-----------------------|---------------|-----------------------------------------------| | src (required) | string | — | URL or data-URI of .lottie / .json file | | autoplay | boolean | true | Start playing immediately after load | | loop | boolean | false | Loop the animation | | speed | number | 1 | Playback speed multiplier | | backgroundColor | string | '' | CSS color string for canvas background | | mode | Mode | 'forward' | forward / reverse / bounce / reverse-bounce | | segment | [number, number] | undefined | [startFrame, endFrame] to play | | useFrameInterpolation | boolean | true | Smooth sub-frame playback | | renderConfig | RenderConfig | undefined | { autoResize, devicePixelRatio, freezeOnOffscreen } | | layout | Layout | undefined | { fit, align } — controls canvas layout | | animationId | string | undefined | For multi-animation .lottie files | | themeId | string | undefined | Theme ID from .lottie manifest | | stateMachineId | string | undefined | State machine to activate after load |


All Outputs

| Output | Payload | |-------------------------------------------|----------------------------------------------------| | playerReady | DotLottie instance | | load | void | | loadError | { error: Error } | | ready | void | | play | void | | pause | void | | stop | void | | complete | void | | loop | { loopCount: number } | | frame | { currentFrame: number } | | render | { currentFrame: number } | | freeze | void | | unfreeze | void | | destroy | void | | stateMachineStart | void | | stateMachineStop | void | | stateMachineTransition | { fromState: string; toState: string } | | stateMachineStateEntered | { state: string } | | stateMachineBooleanInputValueChange | { inputName, oldValue, newValue: boolean } | | stateMachineNumericInputValueChange | { inputName, oldValue, newValue: number } |


Accessing the player instance via template reference

<dot-lottie
  #lottie
  src="assets/confetti.lottie"
  [autoplay]="false"
  class="w-24 h-24"
></dot-lottie>

<button (click)="lottie.play_anim()">Play</button>
<button (click)="lottie.pause_anim()">Pause</button>
<button (click)="lottie.seekToFrame(0)">Reset</button>