Tempusxr Français
Menu
  1. Docs
  2. Get started

Install the SDK

The Tempusxr SDK is free to use and needs no key or account today. Pick the way that fits your project. Every way gives the same experience.

1. A plain HTML page with A-Frame: three files

No build step. Copy this page, replace the target and the content, and open it from an HTTPS address (phones need HTTPS for the camera).

<script src="https://aframe.io/releases/1.8.0/aframe.min.js"></script>
<script src="https://tempusxr.vercel.app/v1/tempusxr-aframe.min.js"></script>
<script src="https://tempusxr.vercel.app/v1/tempusxr-image.min.js"></script>

<a-scene tempusxr="tracker: image; targets: targets.txr" renderer="alpha: true" vr-mode-ui="enabled: false">
  <a-camera look-controls="enabled: false" wasd-controls="enabled: false"></a-camera>
  <a-entity tempusxr-image-target="index: 0">
    <a-box position="0 0 0.15" scale="0.3 0.3 0.3" color="#fecb02"></a-box>
  </a-entity>
</a-scene>

The three files are A-Frame, Tempusxr for A-Frame (it holds the scene file loader and photo and video capture too), and the tracker. Make targets.txr with the image compiler. Try the page: three files, A-Frame.

2. A plain HTML page with Three.js: three files

<script type="importmap">
  {
    "imports": {
      "three": "https://cdn.jsdelivr.net/npm/three@0.187.0/build/three.module.js",
      "three/addons/": "https://cdn.jsdelivr.net/npm/three@0.187.0/examples/jsm/",
      "@tempusxr/sdk-core": "https://tempusxr.vercel.app/v1/tempusxr-three.esm.js",
      "@tempusxr/sdk-three": "https://tempusxr.vercel.app/v1/tempusxr-three.esm.js"
    }
  }
</script>
<div id="ar"></div>
<script type="module">
  import { create } from '@tempusxr/sdk-three';
  import 'https://tempusxr.vercel.app/v1/tempusxr-image.esm.js';

  const ar = create({ container: '#ar' });
  const tracker = await ar.use('image', { targets: ['targets.txr'] });
  ar.attach(tracker.anchors[0], myThreeObject);
  await ar.start();
</script>

The three files are Three.js, Tempusxr for Three.js (core, scene file loader, capture), and the tracker. The two @tempusxr lines are the same file on purpose: a tracker file asks for @tempusxr/sdk-core, and has to find the very same module. The three/addons/ line is read only by a scene that uses Draco or KTX2 compressed models. Try the page: three files, Three.js.

3. npm

npm install @tempusxr/sdk-three @tempusxr/sdk-tracker-image three
# or, for A-Frame
npm install @tempusxr/sdk-aframe @tempusxr/sdk-tracker-image aframe
import { create } from '@tempusxr/sdk-three';
import '@tempusxr/sdk-tracker-image'; // registers the 'image' tracker

Three.js and A-Frame are peer dependencies: you choose the version. The packages are @tempusxr/sdk-core, sdk-three, sdk-aframe, sdk-capture, scene (the scene file format) and one package per tracker. They ship minified, with types.

4. A scene file: describe the experience in JSON

Instead of writing the content in HTML or JavaScript, you can describe the whole experience in a scene file (what to track, what to show, what happens on a tap) and open it with one line. It works in all three ways above, with the same three files or the same npm packages. Nothing more to install.

A-Frame: one attribute opens the scene.

<script src="https://aframe.io/releases/1.8.0/aframe.min.js"></script>
<script src="https://tempusxr.vercel.app/v1/tempusxr-aframe.min.js"></script>
<script src="https://tempusxr.vercel.app/v1/tempusxr-image.min.js"></script>

<a-scene tempusxr-scene="src: scene.json" renderer="alpha: true" vr-mode-ui="enabled: false">
  <a-camera look-controls="enabled: false" wasd-controls="enabled: false"></a-camera>
</a-scene>

Three.js or npm: one call.

import { loadScene } from '@tempusxr/sdk-three';
import '@tempusxr/sdk-tracker-image'; // and '@tempusxr/sdk-tracker-world' for a floor or wall scene

const experience = await loadScene('scene.json', { container: '#ar' });
startButton.addEventListener('click', () => experience.start()); // from a tap, so sound and video can play

A scene that tracks the floor or a wall needs the world tracker file (tempusxr-world.min.js or tempusxr-world.esm.js) in place of, or next to, the image one. The scene says which it needs, and the page tells you if the tracker is missing.

Write your first one in five minutes: Your first scene file. The format is in Scene format v1, and ready scenes to copy are in the Experience Library: open an experience and pick its Scene file link.

The trackers

A page loads only the tracking it uses, one file each.

TrackingA-Frame or script tagThree.js modulenpm
Imagetempusxr-image.min.jstempusxr-image.esm.js@tempusxr/sdk-tracker-image
World (floor and walls, Android Chrome)tempusxr-world.min.jstempusxr-world.esm.js@tempusxr/sdk-tracker-world
Face, hand, bodycomingcomingcoming

Versions

/v1/ always holds the latest 1.x release. For a version that never changes, use its own folder, for example /v0.1.0-beta/. Files are served with open CORS and can be loaded from any site.

License

Free to use, including in commercial work, with no key for now. The code is not open source: you may not copy or resell it. Read LICENSE.md in each package. Plans with an SDK key are planned; they will not break the versions you use today.