demos/layer-effects/index.js
function importLayer(file) {
  fileToCanvas(file, function(err, canvas) {
    if (err) {
      alert('Unable to load image file.');
      return;
    }
    if (canvas.width > maxSize || canvas.height > maxSize) {
      alert('Image is too large. The maximum supported size is ' +
        maxSize + ' by ' + maxSize + ' pixels.');
      return;
    }

    // Create layer.
    var asset = new Marzipano.DynamicAsset(canvas);
    var source = new Marzipano.SingleAssetSource(asset);
    var geometry = new Marzipano.EquirectGeometry([{ width: canvas.width }]);
    var layer = scene.createLayer({
      source: source,
      geometry: geometry
    });

    // Create a new effects object for the layer.
    var effects = layerEffects(layer);

    // Add layer into the view model.
    layers.unshift({
      name: file.name,
      layer: layer,
      effects: effects,
      canvas: canvas
    });
  });
}
function importLayer(file) {
  fileToCanvas(file, function(err, canvas) {
    if (err) {
      alert('Unable to load image file.');
      return;
    }
    if (canvas.width > maxSize || canvas.height > maxSize) {
      alert('Image is too large. The maximum supported size is ' +
        maxSize + ' by ' + maxSize + ' pixels.');
      return;
    }

    // Create layer.
    var asset = new Marzipano.DynamicAsset(canvas);
    var source = new Marzipano.SingleAssetSource(asset);
    var geometry = new Marzipano.EquirectGeometry([{ width: canvas.width }]);
    var layer = scene.createLayer({
      source: source,
      geometry: geometry
    });

    // Create a new effects object for the layer.
    var effects = layerEffects(layer);

    // Add layer into the view model.
    layers.unshift({
      name: file.name,
      layer: layer,
      effects: effects,
      canvas: canvas
    });
  });
}
function importLayer ( file ) { fileToCanvas ( file , function ( err , canvas ) { if ( err ) { alert ( 'Unable to load image file.' ) ; return ; } if ( canvas . width > maxSize || canvas . height > maxSize ) { alert ( 'Image is too large. The maximum supported size is ' + maxSize + ' by ' + maxSize + ' pixels.' ) ; return ; } // Create layer. var asset = new Marzipano . DynamicAsset ( canvas ) ; var source = new Marzipano . SingleAssetSource ( asset ) ; var geometry = new Marzipano . EquirectGeometry ( [ { width : canvas . width } ] ) ; var layer = scene . createLayer ( { source : source , geometry : geometry } ) ; // Create a new effects object for the layer. var effects = layerEffects ( layer ) ; // Add layer into the view model. layers . unshift ( { name : file . name , layer : layer , effects : effects , canvas : canvas } ) ; } ) ; }
Import a canvas into a layer.
Import a canvas into a layer .