- Load CreateJS library via custom code.
- use
createjs.Tween.get()
to operate material opacity:
// this function will work cross-browser for loading scripts asynchronously
const loadScript = (_name, src, callback) => {
let s;
let r;
let t;
r = false;
s = document.createElement('script');
s.type = 'text/javascript';
s.src = src;
s.onload = s.onreadystatechange = () => {
if (!r && (!this.readyState || this.readyState == 'complete')) {
r = true;
callback(_name);
}
};
t = document.getElementsByTagName('script')[ 0 ];
t.parentNode.insertBefore(s, t);
}
// After all necessary scripts loaded
const onLoadScript = () => {
const popup3d = this.activeSceneModel.getObjectByName('your_object_name');
if (popup3d.visible) return;
popup3d.visible = true;
popup3d.material.opacity = 0;
createjs.Tween.get(popup3d.material).to({ opacity:1 }, 200)
}
loadScript('createjs', '<https://code.createjs.com/1.0.0/tweenjs.min.js>', onLoadScript);