Skip to content

Your own markup

Copy as Markdown

Export the animation as a .rupaplay file and copy its markup (the export dialog has Copy markup). The page keeps your h1, p and div, and the player adds the design, the animation and the control.

<script type="module" src="https://cdn.jsdelivr.net/npm/@rupamotion/player@0.1.0/dist/element.js"></script>
<rupa-player src="/hero.rupaplay" markup="keep">
<div class="hero-root">
<h1 class="hero-title">Your own, editable heading</h1>
<p class="hero-text">Text a search engine reads without JavaScript.</p>
</div>
</rupa-player>

Or from code, on any element that holds your markup:

import { mountFile } from "@rupamotion/player/file";
const result = await mountFile(document.querySelector("#hero"), "/hero.rupaplay", { markup: "keep" });
if (result.error) console.warn(result.error.code, result.error.message);
else result.player.play("exit");

markup says what happens to the markup inside the root:

  • keep (the default of mountFile and <RupaPlayer>) keeps it and animates what matches the classes of the file.
  • replace writes the markup of the file.
  • auto (the default of <rupa-player>) writes the markup of the file into an empty root, keeps a root that has every class of the file, and replaces any other.

The classes in the markup are addresses. Do not rename them: the animation finds its elements by them.

Below, the page holds the markup and the .rupaplay file adds the rest:

Oct 14–15 · Lisbon & online

Kinetic Summit 2027

Two days of motion, interfaces and the people who build them.
Get your pass
See the speakers
A
M
J
K
40+ speakers
import { mountFile } from "@rupamotion/player/file";

const { player } = await mountFile(document.querySelector("#event-hero"), "/event-hero.rupaplay", { markup: "keep" });
player.play("drift");