repo: janusweb
action: commit
revision: 
path_from: 
revision_from: 7ff76ac0d371e05eeff926f297893599b1bfe2c8:
path_to: 
revision_to: 
git.thebackupbox.net
janusweb
git clone git://git.thebackupbox.net/janusweb
commit 7ff76ac0d371e05eeff926f297893599b1bfe2c8
Author: James Baicoianu 
Date:   Tue Sep 3 17:42:01 2024 -0700

    Removed duplicate player.setAnimationSequence, fix animation transitionsy

diff --git a/scripts/janusplayer.js b/scripts/janusplayer.js
index c9850abb4c54fb96dc10f5ddbfcd40657285cb04..
index ..276d745958d9d00c338752867a55a33493bb0196 100644
--- a/scripts/janusplayer.js
+++ b/scripts/janusplayer.js
@@ -1246,20 +1246,6 @@ document.body.dispatchEvent(click);
         this.camera.orientation.setFromEuler(new THREE.Euler(0, this.cameraangle, 0));
       }
     }
-    this.setAnimationSequence = function(sequence) {
-      let t = 0;
-      let currentanimation = this.defaultanimation;
-      let body = this.ghost.body;
-      sequence.forEach(clipname => {
-        let anim = body.animations[clipname];
-        if (anim) {
-          let clip = anim.getClip();
-          setTimeout(() => { this.defaultanimation = clipname; }, t * 1000);
-          t += clip.duration;
-        }
-      });
-      setTimeout(() => { this.defaultanimation = currentanimation; }, t * 1000);
-    }
     this.hasAnimation = function(anim_id) {
       return anim_id in this.ghost.body.animations;
     }
@@ -1274,9 +1260,11 @@ document.body.dispatchEvent(click);
       for (let i = 0; i < sequence.length; i++) {
         let anim_id = sequence[i];
         let anim = this.getAnimation(anim_id);
+        anim.loop = (i == sequence.length - 1 ? THREE.LoopRepeat : THREE.LoopOnce);
+        anim.clampWhenFinished = !(i == sequence.length - 1);
         if (anim) {
           let clip = anim.getClip();
-          setTimeout(() => this.defaultanimation = anim_id, cumtime);
+          setTimeout(() => this.defaultanimation = anim_id, cumtime * 1000);
           cumtime += clip.duration;
         }
       }

-----END OF PAGE-----