repo: janusweb action: commit revision: path_from: revision_from: 8838757535effc7d32897a67c509f987ea973d27: path_to: revision_to:
commit 8838757535effc7d32897a67c509f987ea973d27 Author: James BaicoianuDate: Mon Oct 1 17:42:06 2018 -0700 Added player.scaleTo(size, duration) diff --git a/scripts/janusplayer.js b/scripts/janusplayer.js
--- a/scripts/janusplayer.js
+++ b/scripts/janusplayer.js
@@ -777,5 +777,25 @@ elation.require(['engine.things.player', 'janusweb.external.JanusVOIP', 'ui.butt
this.setSetting('partymode.enabled', value);
}
}
+ this.scaleTo = (function() {
+ let tmpvec = new THREE.Vector3(),
+ startscale = new THREE.Vector3(),
+ camscale = new THREE.Vector3();
+ return function(newscale, scaletime, scalecurve) {
+ if (newscale != this.scale) {
+ startscale.copy(this.properties.scale);
+ let start = performance.now();
+ let timer = setInterval(() => {
+ let n = (performance.now() - start) / scaletime;
+
+ this.scale = tmpvec.set(newscale, newscale, newscale).sub(startscale).multiplyScalar(n).add(startscale);
+ this.camera.scale = camscale.set(1 / this.scale.x, 1 / this.scale.y, 1 / this.scale.z);
+ if (n >= 1) {
+ clearInterval(timer);
+ }
+ }, 16);
+ }
+ };
+ })();
}, elation.engine.things.player);
});
-----END OF PAGE-----