@gamelearn/arcade-components 0.25.19 → 0.25.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -64,6 +64,7 @@ var AnimationComponent = function AnimationComponent(_ref) {
64
64
  var currentAction = mixer.clipAction(gltf.animations[0], object);
65
65
  var oldAction = mixer.clipAction(defaultAnim, object);
66
66
  currentAction.setLoop(_three.LoopRepeat, loopTimes);
67
+ mixer.stopAllAction();
67
68
  (0, _helpers.executeCrossFade)(oldAction, currentAction, 0.5);
68
69
 
69
70
  var finishCallback = function finishCallback() {
@@ -87,14 +87,18 @@ var getObjectPosition = function getObjectPosition(object, camera, canvas) {
87
87
 
88
88
  exports.getObjectPosition = getObjectPosition;
89
89
 
90
- var executeCrossFade = function executeCrossFade(startAction, endAction, duration) {
91
- startAction.reset(); // const ratio = endAction.getClip().duration / startAction.getClip().duration;
90
+ var setWeight = function setWeight(action, weight) {
91
+ action.enabled = true;
92
+ action.setEffectiveTimeScale(1);
93
+ action.setEffectiveWeight(weight);
94
+ };
92
95
 
93
- endAction.time = 1.0;
94
- endAction.enabled = true;
96
+ var executeCrossFade = function executeCrossFade(startAction, endAction, duration) {
97
+ startAction.play();
98
+ startAction.reset();
95
99
  endAction.reset();
96
- endAction.setEffectiveTimeScale(1.0);
97
- endAction.setEffectiveWeight(1.0);
100
+ endAction.time = 0;
101
+ setWeight(endAction, 1);
98
102
  endAction.crossFadeFrom(startAction, duration, true);
99
103
  endAction.play();
100
104
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gamelearn/arcade-components",
3
3
  "license": "Gamelearn",
4
- "version": "0.25.19",
4
+ "version": "0.25.20",
5
5
  "main": "dist/index.js",
6
6
  "files": [
7
7
  "dist",