Astro
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) inpublic/. -
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.
Need control?
Section titled “Need control?”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.