Skip to content
  1. Install the player.

    Terminal window
    npm i @rupamotion/player
  2. Put hero.rupaplay (export as Player file in Rupamotion) in public/.

  3. Use the element in a page or component. Astro bundles the script once per page:

    <rupa-player src="/hero.rupaplay"></rupa-player>
    <script>
    import "@rupamotion/player/element";
    </script>

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. Pause it from a button in the same script:

<rupa-player src="/hero.rupaplay"></rupa-player>
<button id="pause">Pause</button>
<script>
import "@rupamotion/player/element";
document.querySelector("#pause")?.addEventListener("click", () => {
document.querySelector("rupa-player")?.player?.pause();
});
</script>

See Control playback and Events.