function mixinFactory (id, obj, scene) {
  var mixinEl = document.createElement('a-mixin');
  mixinEl.setAttribute('id', id);
  Object.keys(obj).forEach(function (componentName) {
    mixinEl.setAttribute(componentName, obj[componentName]);
  });

  var assetsEl = scene ? scene.querySelector('a-assets') : document.querySelector('a-assets');
  assetsEl.appendChild(mixinEl);

  return mixinEl;
}
Creates and attaches a mixin element (and an `<a-assets>` element if necessary).

@param {string} id - ID of mixin.
@param {object} obj - Map of component names to attribute values.
@param {Element} scene - Indicate which scene to apply mixin to if necessary.
@returns {object} An attached `<a-mixin>` element.