@flighthq/animation 0.5.1-next.903.f434bc2 → 0.5.1-next.905.5fbf787
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.
- package/README.md +2 -2
- package/package.json +4 -4
- package/src/animationBlend.test.ts +7 -1
- package/src/animationBlendTree.test.ts +14 -1
- package/src/animationClip.test.ts +21 -1
- package/src/animationCrossfade.test.ts +7 -1
- package/src/animationLayerStack.test.ts +7 -1
- package/src/animationPlayer.test.ts +7 -1
- package/src/animationRootMotion.test.ts +10 -1
- package/src/animationStateMachine.test.ts +14 -1
- package/src/animationTrack.test.ts +7 -1
package/README.md
CHANGED
|
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/animation`. The `@fl
|
|
|
13
13
|
This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
|
|
14
14
|
|
|
15
15
|
- [Flight project](https://github.com/flighthq/flight)
|
|
16
|
-
- [Source for @flighthq/animation@0.5.1-next.
|
|
17
|
-
- [License](https://github.com/flighthq/flight/blob/
|
|
16
|
+
- [Source for @flighthq/animation@0.5.1-next.905.5fbf787](https://github.com/flighthq/flight/tree/5fbf7874064c384307542d68b4dcb6a895ff0dcf/packages/animation)
|
|
17
|
+
- [License](https://github.com/flighthq/flight/blob/5fbf7874064c384307542d68b4dcb6a895ff0dcf/LICENSE.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/animation",
|
|
3
|
-
"version": "0.5.1-next.
|
|
3
|
+
"version": "0.5.1-next.905.5fbf787",
|
|
4
4
|
"author": "Joshua Granick and other contributors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@flighthq/entity": "0.5.1-next.
|
|
42
|
-
"@flighthq/signals": "0.5.1-next.
|
|
43
|
-
"@flighthq/types": "0.5.1-next.
|
|
41
|
+
"@flighthq/entity": "0.5.1-next.905.5fbf787",
|
|
42
|
+
"@flighthq/signals": "0.5.1-next.905.5fbf787",
|
|
43
|
+
"@flighthq/types": "0.5.1-next.905.5fbf787"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"typescript": "^5.3.0"
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { EntityRuntimeKey } from '@flighthq/types/contract';
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
-
addAnimationSample,
|
|
5
4
|
accumulateAnimationSample,
|
|
5
|
+
addAnimationSample,
|
|
6
6
|
blendAnimationSamples,
|
|
7
7
|
createAnimationSampleAccumulator,
|
|
8
8
|
finishAnimationSample,
|
|
9
|
+
initializeAnimationSampleAccumulator,
|
|
9
10
|
resetAnimationSampleAccumulator,
|
|
10
11
|
} from './animationBlend';
|
|
11
12
|
|
|
@@ -99,6 +100,11 @@ describe('finishAnimationSample', () => {
|
|
|
99
100
|
});
|
|
100
101
|
});
|
|
101
102
|
|
|
103
|
+
describe('initializeAnimationSampleAccumulator', () => {
|
|
104
|
+
it('is the construction initializer of createAnimationSampleAccumulator', () => {
|
|
105
|
+
expect(typeof initializeAnimationSampleAccumulator).toBe('function');
|
|
106
|
+
});
|
|
107
|
+
});
|
|
102
108
|
describe('resetAnimationSampleAccumulator', () => {
|
|
103
109
|
it('clears state while retaining the owned buffer', () => {
|
|
104
110
|
const accumulator = createAnimationSampleAccumulator(2);
|
|
@@ -5,6 +5,8 @@ import {
|
|
|
5
5
|
advanceAnimationBlendTree,
|
|
6
6
|
createAnimationBlendTree,
|
|
7
7
|
createAnimationBlendTreeInput,
|
|
8
|
+
initializeAnimationBlendTree,
|
|
9
|
+
initializeAnimationBlendTreeInput,
|
|
8
10
|
sampleAnimationBlendTree,
|
|
9
11
|
sampleAnimationBlendTreeChannel,
|
|
10
12
|
setAnimationBlendTreeInputWeight,
|
|
@@ -88,6 +90,18 @@ describe('createAnimationBlendTreeInput', () => {
|
|
|
88
90
|
});
|
|
89
91
|
});
|
|
90
92
|
|
|
93
|
+
describe('initializeAnimationBlendTree', () => {
|
|
94
|
+
it('is the construction initializer of createAnimationBlendTree', () => {
|
|
95
|
+
expect(typeof initializeAnimationBlendTree).toBe('function');
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
describe('initializeAnimationBlendTreeInput', () => {
|
|
100
|
+
it('is the construction initializer of createAnimationBlendTreeInput', () => {
|
|
101
|
+
expect(typeof initializeAnimationBlendTreeInput).toBe('function');
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
|
|
91
105
|
describe('sampleAnimationBlendTree', () => {
|
|
92
106
|
it('normalizes an N-way weighted pose by target identity', () => {
|
|
93
107
|
const target = {};
|
|
@@ -167,7 +181,6 @@ describe('sampleAnimationBlendTree', () => {
|
|
|
167
181
|
expect(visit).not.toHaveBeenCalled();
|
|
168
182
|
});
|
|
169
183
|
});
|
|
170
|
-
|
|
171
184
|
describe('sampleAnimationBlendTreeChannel', () => {
|
|
172
185
|
it('returns false and preserves output for an absent channel', () => {
|
|
173
186
|
const out = [9];
|
|
@@ -4,6 +4,9 @@ import {
|
|
|
4
4
|
createAnimationClip,
|
|
5
5
|
createAnimationClipEvent,
|
|
6
6
|
getAnimationClipDuration,
|
|
7
|
+
initializeAnimationChannel,
|
|
8
|
+
initializeAnimationClip,
|
|
9
|
+
initializeAnimationClipEvent,
|
|
7
10
|
sampleAnimationClip,
|
|
8
11
|
} from './animationClip';
|
|
9
12
|
import { createAnimationTrack } from './animationTrack';
|
|
@@ -93,6 +96,24 @@ describe('getAnimationClipDuration', () => {
|
|
|
93
96
|
});
|
|
94
97
|
});
|
|
95
98
|
|
|
99
|
+
describe('initializeAnimationChannel', () => {
|
|
100
|
+
it('is the construction initializer of createAnimationChannel', () => {
|
|
101
|
+
expect(typeof initializeAnimationChannel).toBe('function');
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
import { EntityRuntimeKey } from '@flighthq/types/contract';
|
|
105
|
+
describe('initializeAnimationClip', () => {
|
|
106
|
+
it('is the construction initializer of createAnimationClip', () => {
|
|
107
|
+
expect(typeof initializeAnimationClip).toBe('function');
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
describe('initializeAnimationClipEvent', () => {
|
|
112
|
+
it('is the construction initializer of createAnimationClipEvent', () => {
|
|
113
|
+
expect(typeof initializeAnimationClipEvent).toBe('function');
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
|
|
96
117
|
describe('sampleAnimationClip', () => {
|
|
97
118
|
it('samples every channel at the given time and visits each with its channel and index', () => {
|
|
98
119
|
const a = createAnimationTrack({ times: [0, 1], values: [0, 10] });
|
|
@@ -120,4 +141,3 @@ describe('sampleAnimationClip', () => {
|
|
|
120
141
|
expect(calls).toBe(0);
|
|
121
142
|
});
|
|
122
143
|
});
|
|
123
|
-
import { EntityRuntimeKey } from '@flighthq/types/contract';
|
|
@@ -4,6 +4,7 @@ import { createAnimationChannel, createAnimationClip } from './animationClip';
|
|
|
4
4
|
import {
|
|
5
5
|
advanceAnimationCrossfade,
|
|
6
6
|
createAnimationCrossfade,
|
|
7
|
+
initializeAnimationCrossfade,
|
|
7
8
|
isAnimationCrossfadeComplete,
|
|
8
9
|
sampleAnimationCrossfade,
|
|
9
10
|
} from './animationCrossfade';
|
|
@@ -122,6 +123,12 @@ describe('createAnimationCrossfade', () => {
|
|
|
122
123
|
});
|
|
123
124
|
});
|
|
124
125
|
|
|
126
|
+
describe('initializeAnimationCrossfade', () => {
|
|
127
|
+
it('is the construction initializer of createAnimationCrossfade', () => {
|
|
128
|
+
expect(typeof initializeAnimationCrossfade).toBe('function');
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
|
|
125
132
|
describe('isAnimationCrossfadeComplete', () => {
|
|
126
133
|
it('uses elapsed duration as the retirement condition', () => {
|
|
127
134
|
const target = {};
|
|
@@ -143,7 +150,6 @@ describe('isAnimationCrossfadeComplete', () => {
|
|
|
143
150
|
expect(isAnimationCrossfadeComplete(state)).toBe(true);
|
|
144
151
|
});
|
|
145
152
|
});
|
|
146
|
-
|
|
147
153
|
describe('sampleAnimationCrossfade', () => {
|
|
148
154
|
it('samples both playheads and blends through a distinct output buffer', () => {
|
|
149
155
|
const target = {};
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
createAnimationBlendTreeLayer,
|
|
9
9
|
createAnimationLayerStack,
|
|
10
10
|
createAnimationStateMachineLayer,
|
|
11
|
+
initializeAnimationLayerStack,
|
|
11
12
|
sampleAnimationLayerStack,
|
|
12
13
|
sampleAnimationLayerStackChannel,
|
|
13
14
|
setAnimationLayerWeight,
|
|
@@ -107,6 +108,12 @@ describe('createAnimationStateMachineLayer', () => {
|
|
|
107
108
|
});
|
|
108
109
|
});
|
|
109
110
|
|
|
111
|
+
describe('initializeAnimationLayerStack', () => {
|
|
112
|
+
it('is the construction initializer of createAnimationLayerStack', () => {
|
|
113
|
+
expect(typeof initializeAnimationLayerStack).toBe('function');
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
|
|
110
117
|
describe('sampleAnimationLayerStack', () => {
|
|
111
118
|
it('applies an override mask and additive layer in stable target order', () => {
|
|
112
119
|
const body = {};
|
|
@@ -160,7 +167,6 @@ describe('sampleAnimationLayerStackChannel', () => {
|
|
|
160
167
|
expect(out).toEqual([2]);
|
|
161
168
|
});
|
|
162
169
|
});
|
|
163
|
-
|
|
164
170
|
describe('setAnimationLayerWeight', () => {
|
|
165
171
|
it('updates a present layer and rejects an absent index', () => {
|
|
166
172
|
const stack = createAnimationLayerStack([createAnimationBlendTreeLayer(tree(player({}, 1)))]);
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
createAnimationPlayer,
|
|
9
9
|
enableAnimationPlayerSignals,
|
|
10
10
|
getAnimationPlayerNormalizedTime,
|
|
11
|
+
initializeAnimationPlayer,
|
|
11
12
|
playAnimationPlayer,
|
|
12
13
|
seekAnimationPlayer,
|
|
13
14
|
stopAnimationPlayer,
|
|
@@ -244,6 +245,12 @@ describe('getAnimationPlayerNormalizedTime', () => {
|
|
|
244
245
|
});
|
|
245
246
|
});
|
|
246
247
|
|
|
248
|
+
describe('initializeAnimationPlayer', () => {
|
|
249
|
+
it('is the construction initializer of createAnimationPlayer', () => {
|
|
250
|
+
expect(typeof initializeAnimationPlayer).toBe('function');
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
|
|
247
254
|
describe('playAnimationPlayer', () => {
|
|
248
255
|
it('sets playing true without moving the playhead', () => {
|
|
249
256
|
const p = player(10, { playing: false, time: 3 });
|
|
@@ -264,7 +271,6 @@ describe('seekAnimationPlayer', () => {
|
|
|
264
271
|
expect(p.time).toBe(10);
|
|
265
272
|
});
|
|
266
273
|
});
|
|
267
|
-
|
|
268
274
|
describe('stopAnimationPlayer', () => {
|
|
269
275
|
it('clears playing and rewinds to 0', () => {
|
|
270
276
|
const p = player(10, { time: 5 });
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { EntityRuntimeKey } from '@flighthq/types/contract';
|
|
2
2
|
|
|
3
3
|
import { createAnimationChannel, createAnimationClip } from './animationClip';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
createAnimationRootMotionExtractor,
|
|
6
|
+
extractAnimationRootMotion,
|
|
7
|
+
initializeAnimationRootMotionExtractor,
|
|
8
|
+
} from './animationRootMotion';
|
|
5
9
|
import { createAnimationTrack } from './animationTrack';
|
|
6
10
|
|
|
7
11
|
describe('createAnimationRootMotionExtractor', () => {
|
|
@@ -109,3 +113,8 @@ describe('extractAnimationRootMotion', () => {
|
|
|
109
113
|
expect(Array.from(out)).toEqual([1, 2, 3, 4]);
|
|
110
114
|
});
|
|
111
115
|
});
|
|
116
|
+
describe('initializeAnimationRootMotionExtractor', () => {
|
|
117
|
+
it('is the construction initializer of createAnimationRootMotionExtractor', () => {
|
|
118
|
+
expect(typeof initializeAnimationRootMotionExtractor).toBe('function');
|
|
119
|
+
});
|
|
120
|
+
});
|
|
@@ -9,6 +9,8 @@ import {
|
|
|
9
9
|
createAnimationStateMachine,
|
|
10
10
|
createAnimationStateMachineState,
|
|
11
11
|
getAnimationStateMachineCurrentState,
|
|
12
|
+
initializeAnimationStateMachine,
|
|
13
|
+
initializeAnimationStateMachineState,
|
|
12
14
|
isAnimationStateMachineTransitioning,
|
|
13
15
|
sampleAnimationStateMachine,
|
|
14
16
|
sampleAnimationStateMachineChannel,
|
|
@@ -103,6 +105,18 @@ describe('getAnimationStateMachineCurrentState', () => {
|
|
|
103
105
|
});
|
|
104
106
|
});
|
|
105
107
|
|
|
108
|
+
describe('initializeAnimationStateMachine', () => {
|
|
109
|
+
it('is the construction initializer of createAnimationStateMachine', () => {
|
|
110
|
+
expect(typeof initializeAnimationStateMachine).toBe('function');
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
describe('initializeAnimationStateMachineState', () => {
|
|
115
|
+
it('is the construction initializer of createAnimationStateMachineState', () => {
|
|
116
|
+
expect(typeof initializeAnimationStateMachineState).toBe('function');
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
|
|
106
120
|
describe('isAnimationStateMachineTransitioning', () => {
|
|
107
121
|
it('tracks the active timed-transition lifecycle', () => {
|
|
108
122
|
const machine = createAnimationStateMachine([state('a', player({}, 0)), state('b', player({}, 1))]);
|
|
@@ -146,7 +160,6 @@ describe('sampleAnimationStateMachine', () => {
|
|
|
146
160
|
]);
|
|
147
161
|
});
|
|
148
162
|
});
|
|
149
|
-
|
|
150
163
|
describe('sampleAnimationStateMachineChannel', () => {
|
|
151
164
|
it('samples one global channel and preserves output for an absent index', () => {
|
|
152
165
|
const machine = createAnimationStateMachine([state('only', player({}, 7))]);
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
cloneAnimationTrack,
|
|
10
10
|
createAnimationTrack,
|
|
11
|
+
initializeAnimationTrack,
|
|
11
12
|
sampleAnimationTrack,
|
|
12
13
|
trimAnimationTrack,
|
|
13
14
|
validateAnimationTrack,
|
|
@@ -63,6 +64,12 @@ describe('createAnimationTrack', () => {
|
|
|
63
64
|
});
|
|
64
65
|
});
|
|
65
66
|
|
|
67
|
+
describe('initializeAnimationTrack', () => {
|
|
68
|
+
it('is the construction initializer of createAnimationTrack', () => {
|
|
69
|
+
expect(typeof initializeAnimationTrack).toBe('function');
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
66
73
|
describe('sampleAnimationTrack', () => {
|
|
67
74
|
it('linearly interpolates a scalar mid-segment', () => {
|
|
68
75
|
const track = createAnimationTrack({ times: [0, 1], values: [0, 10] });
|
|
@@ -236,7 +243,6 @@ describe('trimAnimationTrack', () => {
|
|
|
236
243
|
expect(sub.values.length).toBe(0);
|
|
237
244
|
});
|
|
238
245
|
});
|
|
239
|
-
|
|
240
246
|
describe('validateAnimationTrack', () => {
|
|
241
247
|
it('returns null for a well-formed track', () => {
|
|
242
248
|
const track = createAnimationTrack({ components: 3, times: [0, 1, 2], values: [0, 0, 0, 1, 1, 1, 2, 2, 2] });
|