Back to Demos

This demo shows how you can add nodes to a scene.

Progress: 0%


var sceneId = '4eea2f59-f806-4610-af72-a84203c3ace5';

var buttons = ['circle', 'line', 'none'];
for (var i = 0; i < buttons.length; i++) {
  document.getElementById(buttons[i]).onclick = setProgressBar(buttons[i]);
}

var progress = document.getElementById('progress');
var api = claraplayer('player');
api.on('loading', function(data) {
  progress.innerHTML = (data[0] * 100).toFixed(2) + '%';
});
loadScene();

function loadScene() {
  api.sceneIO.clearScene();
  api.sceneIO.fetchAndUse(sceneId);
}

function setProgressBar(type) {
  return function() {
    api.player.setProgressBar(type);
    loadScene();
  };
}