repo: janusweb
action: commit
revision: 
path_from: 
revision_from: 8838757535effc7d32897a67c509f987ea973d27:
path_to: 
revision_to: 
git.thebackupbox.net
janusweb
git clone git://git.thebackupbox.net/janusweb
commit 8838757535effc7d32897a67c509f987ea973d27
Author: James Baicoianu 
Date:   Mon Oct 1 17:42:06 2018 -0700

    Added player.scaleTo(size, duration)

diff --git a/scripts/janusplayer.js b/scripts/janusplayer.js
index c1263d8f097095073ca9dd535122db49616beb8e..
index ..5035de7f866e9c9306a1d771cffb5109fa4b556c 100644
--- 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-----