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. Mark rupa-player as a custom element in nuxt.config (vue.compilerOptions.isCustomElement):

    nuxt.config.ts
    export default defineNuxtConfig({
    vue: { compilerOptions: { isCustomElement: (tag) => tag === "rupa-player" } },
    });
  4. Load the element in onMounted and use it in a component. The element loads in the browser only:

    <script setup>
    onMounted(() => import("@rupamotion/player/element"));
    </script>
    <template>
    <rupa-player src="/hero.rupaplay"></rupa-player>
    </template>

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 (null before). A template ref is the element:

<script setup>
const hero = ref(null);
onMounted(() => import("@rupamotion/player/element"));
</script>
<template>
<rupa-player ref="hero" src="/hero.rupaplay"></rupa-player>
<button @click="hero?.player?.pause()">Pause</button>
</template>

See Control playback and Events.