import { Component, AfterViewInit, ElementRef, Input, HostListener, Output, EventEmitter } from '@angular/core'; import { ScriptLoaderService } from "../../library/script-loader.service"; import { RdComponent } from '../../base/rdComponent'; declare const bodymovin; /** Functions * play(), pause(), stop(), setSpeed() */ @Component({ selector: 'rd-lottie-icon', template: `
` }) export class LottieIcon extends RdComponent implements AfterViewInit { constructor(script: ScriptLoaderService, private element: ElementRef) { super(); script.load(["./assets/js/bodymovin.min.js"]); this.id = "lottie" + Math.random() * 100; } @Input("rd-width") width: number | string = "2rem"; @Input("rd-height") height: number | string = "2rem"; @Input("rd-path") path: string; // ./assets/common/lottie-download.json @Input("rd-data") data: any; // path or data optional @Input("rd-color") color: string; @Input("rd-hover-active") hoverActive: boolean = false; @Output("rd-click") clickEvent: EventEmitter