brick-moon v1.1.4
Brick Moon
WebGL component to serve as navigation for front-end website: Brick Moon.
Quick Start:
Serve the /demo folder and observe one possible way of incorporating the webgl portion of the site, making calls to it's API and listening to it's events.
Usage
include the brickmoon.js script in your \<head>, then after pageload you can instantiate it and add it to the DOM:
const brickmoon = new BrickMoon();
document.body.appendChild(brickmoon.element);
or pass it the DOM element you'd like it to be rendered into.
const brickmoon = new BrickMoon(domElement);
Methods:
goto(\): call goto('moon')
to start the experience
resize(): resizes the canvas to fit it's container, only needs to be called when the container size changes.
reset(): resets the experience to the start state
Events:
listen for events on BrickMoon.element
:
const brickmoon = new BrickMoon();
brickmoon.element.addEventListener('location', locationChange);
planet: fired when user goes from the earth to the moon.
location: fired when user goes into and out of locations on the moon, null
means the user is in the planetary view.
hotspot: fired when user clicks on a hotspot.
Development
npm install
npm start
goto http://localhost:8080 in a browser
deployment
npm install
npm run build
move the files under /dist
wherever you want to include them.