Examples using the AR.js library
The goal of this collection is to provide a set of basic and instructive examples that introduce the various features in the Javascript-based Augmented Reality (AR) library, AR.js (version 2), built upon the A-Frame and three.js libraries.
Viewing the AR examples will require a device with a camera and various marker images to be detected, which are available in the markers directory in this repository. Requires the kanji marker unless otherwise specified.
A basic scene that places plain and textured shapes on markers (kanji, barcodes 0/1/2).
A cube with different images on each side, attached to a marker.
Uses the aframe-multisrc component.
Animating (rotating) a globe attached to a marker, using the built-in animation component.
Attaching text to the kanji and hiro markers.
3D text uses the aframe-text-geometry component.
Creating a particle system effect, attached to a marker.
Uses the aframe-particle system component.
Rotates a globe attached to a marker, by writing an A-Frame component and modifying the underlying Three.js object.
Using an HTML canvas as the texture for a cube; creating an animation ("bouncing block") on the canvas and updating the cube texture.
A cube is attached to a kanji marker. Red, yellow, and blue squares are attached to barcode markers 0, 1, and 2. The color of the cube changes depending on which combination of the markers is visible.
A green square is attached to a marker. If the marker is no longer visible, the square turns red and remains in the last known position of the marker. If the marker then becomes visible again, the square turns green and moves (lerps) to the new position.
Drawing a line between the centers of barcode markers 0 and 1. (Updates line geometry vertices.)
Since lines can be difficult to see, drawing spheres at the centers of barcode markers 0 and 1, and creating a cylinder between the them. (Reorients and rescales the cylinder depending on the distance between the markers.)