@gamelearn/arcade-components 0.25.18 → 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() {
@@ -32,7 +32,7 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
32
32
  var defaultCamPos = [0, 14.63, 16];
33
33
 
34
34
  function Panel(_ref) {
35
- var _character$resource4;
35
+ var _character$resource4, _character$resource5;
36
36
 
37
37
  var character = _ref.character,
38
38
  active = _ref.active,
@@ -109,7 +109,7 @@ function Panel(_ref) {
109
109
  ref: sceneRef
110
110
  }, /*#__PURE__*/_react.default.createElement(_react.Suspense, {
111
111
  fallback: null
112
- }, character.resource.url ? /*#__PURE__*/_react.default.createElement(_element.default, {
112
+ }, (_character$resource5 = character.resource) !== null && _character$resource5 !== void 0 && _character$resource5.url ? /*#__PURE__*/_react.default.createElement(_element.default, {
113
113
  name: "char_".concat(character.uid),
114
114
  url: character.resource.url,
115
115
  animationUrl: emotion.url,
@@ -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.18",
4
+ "version": "0.25.20",
5
5
  "main": "dist/index.js",
6
6
  "files": [
7
7
  "dist",