Skip to content

Commit

Permalink
Merge pull request #5692 from mozilla/loop-animation-start-offset
Browse files Browse the repository at this point in the history
Add startOffset and timeScale to loop-animation
  • Loading branch information
netpro2k authored Sep 7, 2022
2 parents 6543d8e + 2526bd6 commit af1c6d8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/loop-animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ AFRAME.registerComponent("loop-animation", {
/* DEPRECATED: Use activeClipIndex instead since animation names are not unique */
clip: { type: "string", default: "" },
activeClipIndex: { type: "int", default: 0 },
startOffset: { type: "number", default: 0 },
timeScale: { type: "number", default: 1 },
activeClipIndices: { type: "array" }
},

Expand Down Expand Up @@ -75,6 +77,8 @@ AFRAME.registerComponent("loop-animation", {
for (let i = 0; i < clips.length; i++) {
const action = mixer.clipAction(clips[i], this.el.object3D);
action.enabled = true;
action.time = this.data.startOffset;
action.timeScale = this.data.timeScale;
action.setLoop(THREE.LoopRepeat, Infinity).play();
this.currentActions.push(action);
}
Expand Down

0 comments on commit af1c6d8

Please sign in to comment.