Interface for triggers. Triggers provide interaction chains that can be handled by Element. Implement this interface when creating a new trigger. You can access the current player, element, and targetElement from the trigger's constructor.

Example:

import lottie from 'lottie-web';
import { defineElement, Element } from '@lordicon/element';

class Custom {
player;
element;
targetElement;

constructor(player, element, targetElement) {
this.player = player;
this.element = element;
this.targetElement = targetElement;
}

onReady() {
this.player.play();
}
}

Element.defineTrigger('custom', Custom);

defineElement(lottie.loadAnimation);

Hierarchy

  • ITrigger

Implemented by

Properties

onComplete?: (() => void)

Type declaration

    • (): void
    • The player has completed an animation.

      Returns void

onConnected?: (() => void)

Type declaration

    • (): void
    • The trigger has been connected to the Element.

      Returns void

onDisconnected?: (() => void)

Type declaration

    • (): void
    • The trigger has been disconnected from the Element.

      Note: Remember to remove any potential event listeners you assigned earlier in this trigger.

      Returns void

onFrame?: (() => void)

Type declaration

    • (): void
    • The player has rendered a frame.

      Returns void

onReady?: (() => void)

Type declaration

    • (): void
    • The player is ready. Now you can control the animation and icon properties with it.

      Returns void

onRefresh?: (() => void)

Type declaration

    • (): void
    • The player was refreshed, for example, due to icon customization.

      Returns void