Lit
Copy as MarkdownQuick start
Section titled “Quick start”-
Install the player.
Terminal window npm i @rupamotion/player -
Put
hero.rupaplay(export as Player file in Rupamotion) where your build serves static files. -
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.
Need control?
Section titled “Need control?”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.