const ghostify = {
    init: function () {
      this.el.addEventListener('model-loaded', this.update.bind(this));
    },
  
    update: function () {
      var model = this.el.getObject3D('mesh');
      if (!model) return;
      model.traverse((node) => {
        if (node.isMesh) {
          node.material.transparent = true;
          node.material.opacity = 0.5;
          node.material.metallness = 0;
          node.material.roughness = 1;
          node.material.alphaTest = 0.5;
          node.material.color.set('#ffffff');
        }
      });
    } 
}

export const ghostifyComponent = {
name: 'ghostify-component', val: ghostify
}