@gamelearn/arcade-components 2.29.2 → 2.29.3
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,13 +64,18 @@ var AnimationComponent = function AnimationComponent(_ref) {
|
|
|
64
64
|
loader.load(animation.url, function (gltf) {
|
|
65
65
|
var mixer = object.userData.mixer;
|
|
66
66
|
var defaultAnim = object.userData.defaultAnim;
|
|
67
|
+
if (!object.userData.actionList) object.userData.actionList = {};
|
|
68
|
+
var actionList = object.userData.actionList;
|
|
69
|
+
if (!actionList.idle) {
|
|
70
|
+
var action = mixer.existingAction(defaultAnim, object);
|
|
71
|
+
actionList.idle = action;
|
|
72
|
+
}
|
|
67
73
|
var currentAction = mixer.clipAction(gltf.animations[0], object);
|
|
68
|
-
var oldAction = mixer.clipAction(defaultAnim, object);
|
|
69
74
|
currentAction.setLoop(_three.LoopRepeat, loopTimes);
|
|
70
|
-
|
|
71
|
-
(0, _helpers.executeCrossFade)(
|
|
75
|
+
(0, _helpers.activateAction)(currentAction, 0);
|
|
76
|
+
(0, _helpers.executeCrossFade)(actionList.idle, currentAction);
|
|
72
77
|
var finishCallback = function finishCallback() {
|
|
73
|
-
(0, _helpers.executeCrossFade)(currentAction,
|
|
78
|
+
(0, _helpers.executeCrossFade)(currentAction, actionList.idle);
|
|
74
79
|
if (canInteract) emitEvent({
|
|
75
80
|
type: 'success'
|
|
76
81
|
});
|
package/dist/helpers/index.js
CHANGED
|
@@ -159,11 +159,9 @@ function prepareCrossfade(root, startAction, endAction) {
|
|
|
159
159
|
}
|
|
160
160
|
function syncCrossfade(mixer, startAction, endAction) {
|
|
161
161
|
mixer.addEventListener('loop', onLoopFinished);
|
|
162
|
-
function onLoopFinished(
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
executeCrossFade(startAction, endAction);
|
|
166
|
-
}
|
|
162
|
+
function onLoopFinished() {
|
|
163
|
+
mixer.removeEventListener('loop', onLoopFinished);
|
|
164
|
+
executeCrossFade(startAction, endAction);
|
|
167
165
|
}
|
|
168
166
|
}
|
|
169
167
|
function resetActions(mixer, active) {
|
|
@@ -98,7 +98,6 @@ function useStateMachine(lines) {
|
|
|
98
98
|
var resetActives = function resetActives() {
|
|
99
99
|
Object.keys(active).forEach(function (uid) {
|
|
100
100
|
startAnimation(uid, 'idle');
|
|
101
|
-
setActive(uid, 'idle');
|
|
102
101
|
});
|
|
103
102
|
};
|
|
104
103
|
(0, _react.useEffect)(function () {
|
|
@@ -125,11 +124,12 @@ function useStateMachine(lines) {
|
|
|
125
124
|
mixer = _root$userData.mixer,
|
|
126
125
|
actionList = _root$userData.actionList;
|
|
127
126
|
var currentActive = active[uid];
|
|
127
|
+
if (emotion === currentActive) return;
|
|
128
128
|
var startAction = actionList[currentActive];
|
|
129
129
|
var endAction = actionList[emotion];
|
|
130
|
+
setActive(uid, emotion);
|
|
130
131
|
(0, _.resetActions)(mixer, startAction);
|
|
131
132
|
(0, _.executeCrossFade)(startAction, endAction);
|
|
132
|
-
setActive(uid, emotion);
|
|
133
133
|
}
|
|
134
134
|
}, [scene, loaded, active, setActive]);
|
|
135
135
|
var processAnimations = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
@@ -157,7 +157,6 @@ function useStateMachine(lines) {
|
|
|
157
157
|
if (!actionList.idle) {
|
|
158
158
|
defaultAction = mixer.existingAction(defaultAnim, root);
|
|
159
159
|
actionList.idle = defaultAction;
|
|
160
|
-
(0, _.activateAction)(defaultAction, 1);
|
|
161
160
|
setActive(uid, 'idle');
|
|
162
161
|
}
|
|
163
162
|
loadEmotion = /*#__PURE__*/function () {
|