Skip to content
  1. Install the player.

    Terminal window
    npm i @rupamotion/player
  2. Put hero.rupaplay (export as Player file in Rupamotion) where your build serves static files.

  3. Import the element and use it in a template:

    import { html } from "lit";
    import "@rupamotion/player/element";
    export const hero = html`<rupa-player src="/hero.rupaplay"></rupa-player>`;

That’s it: the animation plays.

This demo loads a .rupaplay file: it plays once JavaScript runs.

The element’s player is the player once the file is mounted. Find the element in your component and call it:

import { LitElement, html } from "lit";
import "@rupamotion/player/element";
class HeroSection extends LitElement {
render() {
return html`
<rupa-player src="/hero.rupaplay"></rupa-player>
<button @click=${this.pause}>Pause</button>
`;
}
pause() {
this.renderRoot.querySelector("rupa-player")?.player?.pause();
}
}
customElements.define("hero-section", HeroSection);

See Control playback and Events.