@zcomponent/core 1.29.0 → 2.0.0-alpha.2
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 +1 -0
- package/css/zcomponent.css +121 -122
- package/index.js +0 -3
- package/lib/actionbehavior.d.ts +3 -3
- package/lib/actionbehavior.js +20 -19
- package/lib/animation/animation.d.ts +13 -6
- package/lib/animation/animation.js +56 -43
- package/lib/animation/bezier.d.ts +6 -0
- package/lib/animation/bezier.js +8 -2
- package/lib/animation/clips/clip.d.ts +13 -1
- package/lib/animation/clips/clip.js +34 -14
- package/lib/animation/index.d.ts +4 -4
- package/lib/animation/index.js +4 -4
- package/lib/animation/layer.d.ts +9 -0
- package/lib/animation/layer.js +28 -12
- package/lib/animation/layerclip.d.ts +21 -0
- package/lib/animation/layerclip.js +82 -45
- package/lib/animation/tracks/cliptrack.d.ts +18 -0
- package/lib/animation/tracks/cliptrack.js +27 -6
- package/lib/animation/tracks/functiontrack.d.ts +9 -0
- package/lib/animation/tracks/functiontrack.js +16 -3
- package/lib/animation/tracks/propertytrack.d.ts +20 -1
- package/lib/animation/tracks/propertytrack.js +48 -11
- package/lib/animation/tracks/streamtrack.d.ts +18 -0
- package/lib/animation/tracks/streamtrack.js +32 -6
- package/lib/animation/tracks/track.d.ts +8 -2
- package/lib/animation/tracks/track.js +3 -2
- package/lib/behavior.js +13 -10
- package/lib/behaviors/ActivateState.d.ts +22 -24
- package/lib/behaviors/ActivateState.js +145 -35
- package/lib/behaviors/CallFunction.d.ts +2 -4
- package/lib/behaviors/CallFunction.js +69 -11
- package/lib/behaviors/ChangeRootScene.d.ts +35 -0
- package/lib/behaviors/ChangeRootScene.js +123 -0
- package/lib/behaviors/ConsoleLog.d.ts +6 -5
- package/lib/behaviors/ConsoleLog.js +95 -12
- package/lib/behaviors/DownloadSnapshot.d.ts +7 -12
- package/lib/behaviors/DownloadSnapshot.js +70 -19
- package/lib/behaviors/EmitComponentPropEvent.d.ts +1 -3
- package/lib/behaviors/EmitComponentPropEvent.js +80 -12
- package/lib/behaviors/LaunchURL.d.ts +5 -5
- package/lib/behaviors/LaunchURL.js +92 -10
- package/lib/behaviors/LogAnalyticsEvent.d.ts +10 -4
- package/lib/behaviors/LogAnalyticsEvent.js +88 -7
- package/lib/behaviors/PauseLayerClip.d.ts +7 -9
- package/lib/behaviors/PauseLayerClip.js +89 -21
- package/lib/behaviors/PlayLayerClip.d.ts +35 -32
- package/lib/behaviors/PlayLayerClip.js +202 -48
- package/lib/behaviors/PlaySound.d.ts +19 -25
- package/lib/behaviors/PlaySound.js +122 -28
- package/lib/behaviors/SetLayerOff.d.ts +7 -9
- package/lib/behaviors/SetLayerOff.js +88 -21
- package/lib/behaviors/ShareSnapshot.d.ts +5 -9
- package/lib/behaviors/ShareSnapshot.js +70 -17
- package/lib/behaviors/ShowTextAlert.d.ts +16 -29
- package/lib/behaviors/ShowTextAlert.js +116 -48
- package/lib/behaviors/TakeSnapshot.d.ts +22 -26
- package/lib/behaviors/TakeSnapshot.js +131 -56
- package/lib/behaviors/ToggleLayerClips.d.ts +45 -62
- package/lib/behaviors/ToggleLayerClips.js +233 -64
- package/lib/behaviors/stream/PauseStream.d.ts +5 -16
- package/lib/behaviors/stream/PauseStream.js +94 -34
- package/lib/behaviors/stream/PlayStream.d.ts +14 -27
- package/lib/behaviors/stream/PlayStream.js +123 -34
- package/lib/behaviors/stream/SeekStream.d.ts +8 -18
- package/lib/behaviors/stream/SeekStream.js +97 -31
- package/lib/behaviors/stream/StopStream.d.ts +6 -15
- package/lib/behaviors/stream/StopStream.js +89 -27
- package/lib/component.d.ts +36 -13
- package/lib/component.js +237 -151
- package/lib/components/AnimatedLoader.d.ts +51 -0
- package/lib/components/AnimatedLoader.js +159 -0
- package/lib/components/Audio.d.ts +35 -37
- package/lib/components/Audio.js +264 -151
- package/lib/components/AudioLayerSettings.d.ts +13 -11
- package/lib/components/AudioLayerSettings.js +76 -18
- package/lib/components/Children.d.ts +2 -1
- package/lib/components/Children.js +66 -13
- package/lib/components/ConditionalConstruct.d.ts +44 -0
- package/lib/components/ConditionalConstruct.js +142 -0
- package/lib/components/DefaultCookieConsent.d.ts +53 -73
- package/lib/components/DefaultCookieConsent.js +382 -264
- package/lib/components/DefaultLoader.d.ts +40 -28
- package/lib/components/DefaultLoader.js +198 -46
- package/lib/components/Gamepad.d.ts +5 -26
- package/lib/components/Gamepad.js +201 -65
- package/lib/components/LoaderScope.d.ts +15 -0
- package/lib/components/LoaderScope.js +71 -0
- package/lib/components/LongLoad.d.ts +11 -15
- package/lib/components/LongLoad.js +89 -34
- package/lib/components/SnapshotUI.d.ts +19 -24
- package/lib/components/SnapshotUI.js +202 -105
- package/lib/context.d.ts +23 -5
- package/lib/context.js +12 -6
- package/lib/contexts/analyticscontext.d.ts +12 -2
- package/lib/contexts/analyticscontext.js +68 -10
- package/lib/contexts/audiocontextcontext.d.ts +1 -1
- package/lib/contexts/audiocontextcontext.js +9 -8
- package/lib/contexts/canvascontext.d.ts +32 -18
- package/lib/contexts/canvascontext.js +195 -120
- package/lib/contexts/cookieconsentcontext.d.ts +38 -28
- package/lib/contexts/cookieconsentcontext.js +35 -32
- package/lib/contexts/documentflagmanager.js +15 -11
- package/lib/contexts/environmentcontext.d.ts +22 -6
- package/lib/contexts/environmentcontext.js +135 -21
- package/lib/contexts/gamepadcontext.d.ts +29 -26
- package/lib/contexts/gamepadcontext.js +46 -46
- package/lib/contexts/gesturecontext.d.ts +31 -6
- package/lib/contexts/gesturecontext.js +110 -85
- package/lib/contexts/globaltagcontext.d.ts +1 -1
- package/lib/contexts/globaltagcontext.js +8 -11
- package/lib/contexts/loadcontext.d.ts +45 -8
- package/lib/contexts/loadcontext.js +232 -82
- package/lib/contexts/orientationcontext.d.ts +13 -15
- package/lib/contexts/orientationcontext.js +150 -67
- package/lib/contexts/rootcomponentscontext.d.ts +16 -0
- package/lib/contexts/rootcomponentscontext.js +65 -0
- package/lib/contexts/snapshotContext.d.ts +0 -3
- package/lib/contexts/snapshotContext.js +78 -23
- package/lib/contexts/tagcontext.d.ts +5 -5
- package/lib/contexts/tagcontext.js +16 -16
- package/lib/contexts/textalertcontext.d.ts +1 -5
- package/lib/contexts/textalertcontext.js +1 -5
- package/lib/contexts/usereventcontext.d.ts +1 -1
- package/lib/contexts/usereventcontext.js +12 -12
- package/lib/data/animation.d.ts +10 -2
- package/lib/data/change.d.ts +1 -1
- package/lib/data/change.js +7 -0
- package/lib/data/core.d.ts +9 -1
- package/lib/data/index.d.ts +1 -1
- package/lib/data/index.js +1 -1
- package/lib/decorators.d.ts +348 -0
- package/lib/decorators.js +239 -0
- package/lib/decoratorutils.d.ts +3 -0
- package/lib/decoratorutils.js +8 -0
- package/lib/emitter.d.ts +15 -2
- package/lib/emitter.js +15 -6
- package/lib/entity.d.ts +43 -25
- package/lib/entity.js +104 -71
- package/lib/event.d.ts +2 -1
- package/lib/event.js +1 -4
- package/lib/groups.d.ts +18 -0
- package/lib/groups.js +19 -0
- package/lib/icons.d.ts +3372 -0
- package/lib/icons.js +1 -0
- package/lib/index.d.ts +18 -13
- package/lib/index.js +17 -13
- package/lib/inflate.d.ts +7 -7
- package/lib/inflate.js +5 -5
- package/lib/observable.d.ts +9 -2
- package/lib/observable.js +5 -4
- package/lib/observe.d.ts +18 -0
- package/lib/observe.js +177 -0
- package/lib/profile.d.ts +9 -5
- package/lib/profile.js +27 -17
- package/lib/selectors.d.ts +1 -1
- package/lib/selectors.js +5 -4
- package/lib/types.d.ts +161 -19
- package/lib/types.js +22 -1
- package/lib/values/values.d.ts +7 -8
- package/lib/values/values.js +1 -2
- package/lib/values/valuesmutator.d.ts +4 -1
- package/lib/values/valuesmutator.js +10 -8
- package/lib/zcomponent.d.ts +21 -10
- package/lib/zcomponent.js +717 -540
- package/package.json +22 -5
- package/lib/behaviors/ChangeCursor.d.ts +0 -39
- package/lib/behaviors/ChangeCursor.js +0 -44
|
@@ -14,6 +14,34 @@ import { StreamTrack } from '../tracks/streamtrack';
|
|
|
14
14
|
* @param id Optional unique identifier for the clip.
|
|
15
15
|
*/
|
|
16
16
|
export class Clip {
|
|
17
|
+
animation;
|
|
18
|
+
length;
|
|
19
|
+
scriptName;
|
|
20
|
+
id;
|
|
21
|
+
/** @internal */
|
|
22
|
+
influencedPathsDirty = new Observable(false);
|
|
23
|
+
/**
|
|
24
|
+
* Optional default parameters for fading animation properties.
|
|
25
|
+
*/
|
|
26
|
+
defaultFadeParameters;
|
|
27
|
+
/**
|
|
28
|
+
* @internal
|
|
29
|
+
* @default []
|
|
30
|
+
*/
|
|
31
|
+
_streamTracks = [];
|
|
32
|
+
/**
|
|
33
|
+
* @default []
|
|
34
|
+
*/
|
|
35
|
+
_influencedPaths = [];
|
|
36
|
+
_tracksByPath = new Map();
|
|
37
|
+
/**
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
_tracksByPathDirty = false;
|
|
41
|
+
/**
|
|
42
|
+
* @default []
|
|
43
|
+
*/
|
|
44
|
+
_tracks = [];
|
|
17
45
|
/**
|
|
18
46
|
* Creates an instance of Clip.
|
|
19
47
|
* @param animation - The associated Animation instance.
|
|
@@ -26,20 +54,6 @@ export class Clip {
|
|
|
26
54
|
this.length = length;
|
|
27
55
|
this.scriptName = scriptName;
|
|
28
56
|
this.id = id;
|
|
29
|
-
/** @internal */
|
|
30
|
-
this.influencedPathsDirty = new Observable(false);
|
|
31
|
-
/** @internal */
|
|
32
|
-
this._streamTracks = [];
|
|
33
|
-
this._influencedPaths = [];
|
|
34
|
-
this._tracksByPath = new Map();
|
|
35
|
-
this._tracksByPathDirty = false;
|
|
36
|
-
this._tracks = [];
|
|
37
|
-
this._dirty = (v) => {
|
|
38
|
-
if (v) {
|
|
39
|
-
this.influencedPathsDirty.value = true;
|
|
40
|
-
this._tracksByPathDirty = true;
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
57
|
if (scriptName)
|
|
44
58
|
this.animation.clips[scriptName] = this;
|
|
45
59
|
}
|
|
@@ -88,6 +102,12 @@ export class Clip {
|
|
|
88
102
|
this._streamTracks = [];
|
|
89
103
|
this.animation.evaluateTouchedPaths(existingPaths);
|
|
90
104
|
}
|
|
105
|
+
_dirty = (v) => {
|
|
106
|
+
if (v) {
|
|
107
|
+
this.influencedPathsDirty.value = true;
|
|
108
|
+
this._tracksByPathDirty = true;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
91
111
|
/**
|
|
92
112
|
* Getter for the mapping of tracks by path.
|
|
93
113
|
*
|
package/lib/animation/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * from './animation';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './clips/clip';
|
|
3
3
|
export * from './layer';
|
|
4
|
-
export * from './
|
|
4
|
+
export * from './layerclip';
|
|
5
|
+
export * from './stream';
|
|
5
6
|
export * from './tracks/cliptrack';
|
|
6
7
|
export * from './tracks/propertytrack';
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './stream';
|
|
8
|
+
export * from './tracks/track';
|
package/lib/animation/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * from './animation';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './clips/clip';
|
|
3
3
|
export * from './layer';
|
|
4
|
-
export * from './
|
|
4
|
+
export * from './layerclip';
|
|
5
|
+
export * from './stream';
|
|
5
6
|
export * from './tracks/cliptrack';
|
|
6
7
|
export * from './tracks/propertytrack';
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './stream';
|
|
8
|
+
export * from './tracks/track';
|
package/lib/animation/layer.d.ts
CHANGED
|
@@ -41,8 +41,17 @@ export declare class Layer {
|
|
|
41
41
|
*/
|
|
42
42
|
influencedPathsDirty: Observable<boolean, never>;
|
|
43
43
|
private _influencedPaths;
|
|
44
|
+
/**
|
|
45
|
+
* @default null
|
|
46
|
+
*/
|
|
44
47
|
private _active;
|
|
48
|
+
/**
|
|
49
|
+
* @default []
|
|
50
|
+
*/
|
|
45
51
|
private _queue;
|
|
52
|
+
/**
|
|
53
|
+
* @default []
|
|
54
|
+
*/
|
|
46
55
|
private _layerClips;
|
|
47
56
|
/**
|
|
48
57
|
* Creates an instance of Layer.
|
package/lib/animation/layer.js
CHANGED
|
@@ -8,6 +8,34 @@ import { StreamState } from './stream';
|
|
|
8
8
|
* Supports queuing of clips, computation of path properties, and handling fade parameters.
|
|
9
9
|
*/
|
|
10
10
|
export class Layer {
|
|
11
|
+
animation;
|
|
12
|
+
scriptName;
|
|
13
|
+
id;
|
|
14
|
+
/**
|
|
15
|
+
* Collection of LayerClips indexed by ID.
|
|
16
|
+
*/
|
|
17
|
+
clips = Object.create(null);
|
|
18
|
+
/**
|
|
19
|
+
* Optional default fade parameters for the layer.
|
|
20
|
+
*/
|
|
21
|
+
defaultFadeParameters;
|
|
22
|
+
/**
|
|
23
|
+
* Observable indicating if the influenced paths are dirty.
|
|
24
|
+
*/
|
|
25
|
+
influencedPathsDirty = new Observable(false);
|
|
26
|
+
_influencedPaths = new Set();
|
|
27
|
+
/**
|
|
28
|
+
* @default null
|
|
29
|
+
*/
|
|
30
|
+
_active = null;
|
|
31
|
+
/**
|
|
32
|
+
* @default []
|
|
33
|
+
*/
|
|
34
|
+
_queue = [];
|
|
35
|
+
/**
|
|
36
|
+
* @default []
|
|
37
|
+
*/
|
|
38
|
+
_layerClips = [];
|
|
11
39
|
/**
|
|
12
40
|
* Creates an instance of Layer.
|
|
13
41
|
* @param animation - The animation that the layer belongs to.
|
|
@@ -18,18 +46,6 @@ export class Layer {
|
|
|
18
46
|
this.animation = animation;
|
|
19
47
|
this.scriptName = scriptName;
|
|
20
48
|
this.id = id;
|
|
21
|
-
/**
|
|
22
|
-
* Collection of LayerClips indexed by ID.
|
|
23
|
-
*/
|
|
24
|
-
this.clips = Object.create(null);
|
|
25
|
-
/**
|
|
26
|
-
* Observable indicating if the influenced paths are dirty.
|
|
27
|
-
*/
|
|
28
|
-
this.influencedPathsDirty = new Observable(false);
|
|
29
|
-
this._influencedPaths = new Set();
|
|
30
|
-
this._active = null;
|
|
31
|
-
this._queue = [];
|
|
32
|
-
this._layerClips = [];
|
|
33
49
|
}
|
|
34
50
|
/**
|
|
35
51
|
* Computes the property value for a given path at a specified time.
|
|
@@ -18,14 +18,17 @@ export declare class LayerClip implements Stream {
|
|
|
18
18
|
readonly id?: string | undefined;
|
|
19
19
|
/**
|
|
20
20
|
* Default behavior for whether the clip loops when it reaches the end.
|
|
21
|
+
* @default false
|
|
21
22
|
*/
|
|
22
23
|
defaultLoop: boolean;
|
|
23
24
|
/**
|
|
24
25
|
* Default speed at which the clip plays.
|
|
26
|
+
* @default 1
|
|
25
27
|
*/
|
|
26
28
|
defaultPlaySpeed: number;
|
|
27
29
|
/**
|
|
28
30
|
* Indicates if the clip should automatically start playing at the beginning of the animation.
|
|
31
|
+
* @default false
|
|
29
32
|
*/
|
|
30
33
|
playAtStart: boolean;
|
|
31
34
|
/**
|
|
@@ -36,16 +39,34 @@ export declare class LayerClip implements Stream {
|
|
|
36
39
|
* Reference to the animation that this layer clip is a part of.
|
|
37
40
|
*/
|
|
38
41
|
readonly animation: Animation;
|
|
42
|
+
/**
|
|
43
|
+
* @default 0
|
|
44
|
+
*/
|
|
39
45
|
private _t0;
|
|
46
|
+
/**
|
|
47
|
+
* @default 0
|
|
48
|
+
*/
|
|
40
49
|
private _pauseTime;
|
|
41
50
|
private _stallStartTime;
|
|
42
51
|
private _t1;
|
|
52
|
+
/**
|
|
53
|
+
* @default 1
|
|
54
|
+
*/
|
|
43
55
|
private _rate;
|
|
56
|
+
/**
|
|
57
|
+
* @default false
|
|
58
|
+
*/
|
|
44
59
|
private _loop;
|
|
45
60
|
private _lastTickTime;
|
|
46
61
|
private _lastClipTime;
|
|
47
62
|
private _lastLoop;
|
|
63
|
+
/**
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
48
66
|
private _stopped;
|
|
67
|
+
/**
|
|
68
|
+
* @default "Paused"
|
|
69
|
+
*/
|
|
49
70
|
private _state;
|
|
50
71
|
state: Observable<StreamState, never>;
|
|
51
72
|
playing: Observable<boolean, never>;
|
|
@@ -9,6 +9,70 @@ import { resolveClipTimeLoops } from './tracks/track';
|
|
|
9
9
|
*
|
|
10
10
|
*/
|
|
11
11
|
export class LayerClip {
|
|
12
|
+
layer;
|
|
13
|
+
clip;
|
|
14
|
+
scriptName;
|
|
15
|
+
id;
|
|
16
|
+
/**
|
|
17
|
+
* Default behavior for whether the clip loops when it reaches the end.
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
defaultLoop = false;
|
|
21
|
+
/**
|
|
22
|
+
* Default speed at which the clip plays.
|
|
23
|
+
* @default 1
|
|
24
|
+
*/
|
|
25
|
+
defaultPlaySpeed = 1;
|
|
26
|
+
/**
|
|
27
|
+
* Indicates if the clip should automatically start playing at the beginning of the animation.
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
playAtStart = false;
|
|
31
|
+
/**
|
|
32
|
+
* Function providing the current time, used for synchronizing the clip's playback.
|
|
33
|
+
*/
|
|
34
|
+
timeSource;
|
|
35
|
+
/**
|
|
36
|
+
* Reference to the animation that this layer clip is a part of.
|
|
37
|
+
*/
|
|
38
|
+
animation;
|
|
39
|
+
/**
|
|
40
|
+
* @default 0
|
|
41
|
+
*/
|
|
42
|
+
_t0 = 0;
|
|
43
|
+
/**
|
|
44
|
+
* @default 0
|
|
45
|
+
*/
|
|
46
|
+
_pauseTime = 0;
|
|
47
|
+
_stallStartTime;
|
|
48
|
+
_t1;
|
|
49
|
+
/**
|
|
50
|
+
* @default 1
|
|
51
|
+
*/
|
|
52
|
+
_rate = 1;
|
|
53
|
+
/**
|
|
54
|
+
* @default false
|
|
55
|
+
*/
|
|
56
|
+
_loop = false;
|
|
57
|
+
_lastTickTime;
|
|
58
|
+
_lastClipTime;
|
|
59
|
+
_lastLoop;
|
|
60
|
+
/**
|
|
61
|
+
* @default false
|
|
62
|
+
*/
|
|
63
|
+
_stopped = false;
|
|
64
|
+
/**
|
|
65
|
+
* @default "Paused"
|
|
66
|
+
*/
|
|
67
|
+
_state = StreamState.Paused;
|
|
68
|
+
state = new Observable(this._state);
|
|
69
|
+
playing = new Observable(false);
|
|
70
|
+
stalled = new Observable(false);
|
|
71
|
+
active = new Observable(false);
|
|
72
|
+
onPlaying = new Event();
|
|
73
|
+
onPaused = new Event();
|
|
74
|
+
onEnded = new Event();
|
|
75
|
+
onLoop = new Event();
|
|
12
76
|
/**
|
|
13
77
|
* Creates an instance of LayerClip.
|
|
14
78
|
* @param layer - The layer that this clip belongs to.
|
|
@@ -21,51 +85,6 @@ export class LayerClip {
|
|
|
21
85
|
this.clip = clip;
|
|
22
86
|
this.scriptName = scriptName;
|
|
23
87
|
this.id = id;
|
|
24
|
-
/**
|
|
25
|
-
* Default behavior for whether the clip loops when it reaches the end.
|
|
26
|
-
*/
|
|
27
|
-
this.defaultLoop = false;
|
|
28
|
-
/**
|
|
29
|
-
* Default speed at which the clip plays.
|
|
30
|
-
*/
|
|
31
|
-
this.defaultPlaySpeed = 1;
|
|
32
|
-
/**
|
|
33
|
-
* Indicates if the clip should automatically start playing at the beginning of the animation.
|
|
34
|
-
*/
|
|
35
|
-
this.playAtStart = false;
|
|
36
|
-
this._t0 = 0;
|
|
37
|
-
this._pauseTime = 0;
|
|
38
|
-
// private _s0: number = 0;
|
|
39
|
-
this._rate = 1;
|
|
40
|
-
this._loop = false;
|
|
41
|
-
this._stopped = false;
|
|
42
|
-
this._state = StreamState.Paused;
|
|
43
|
-
this.state = new Observable(this._state);
|
|
44
|
-
this.playing = new Observable(false);
|
|
45
|
-
this.stalled = new Observable(false);
|
|
46
|
-
this.active = new Observable(false);
|
|
47
|
-
this.onPlaying = new Event();
|
|
48
|
-
this.onPaused = new Event();
|
|
49
|
-
this.onEnded = new Event();
|
|
50
|
-
this.onLoop = new Event();
|
|
51
|
-
this._clipDirty = (v) => {
|
|
52
|
-
if (v)
|
|
53
|
-
this._lastClipTime = undefined;
|
|
54
|
-
};
|
|
55
|
-
this._stateUpdate = (s) => {
|
|
56
|
-
this.playing.value = s === StreamState.Playing;
|
|
57
|
-
switch (s) {
|
|
58
|
-
case StreamState.Ended:
|
|
59
|
-
this.onEnded.emit(this);
|
|
60
|
-
break;
|
|
61
|
-
case StreamState.Playing:
|
|
62
|
-
this.onPlaying.emit(this);
|
|
63
|
-
break;
|
|
64
|
-
case StreamState.Paused:
|
|
65
|
-
this.onPaused.emit(this);
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
88
|
this.animation = layer.animation;
|
|
70
89
|
this._t1 = clip.length;
|
|
71
90
|
layer._registerLayerClip(this);
|
|
@@ -74,6 +93,10 @@ export class LayerClip {
|
|
|
74
93
|
layer.animation.layerClipByID.set(id, this);
|
|
75
94
|
this.state.addListener(this._stateUpdate);
|
|
76
95
|
}
|
|
96
|
+
_clipDirty = (v) => {
|
|
97
|
+
if (v)
|
|
98
|
+
this._lastClipTime = undefined;
|
|
99
|
+
};
|
|
77
100
|
/** @internal */
|
|
78
101
|
tick(touchedPaths, force) {
|
|
79
102
|
const t = this._getTime();
|
|
@@ -136,6 +159,20 @@ export class LayerClip {
|
|
|
136
159
|
_getTime() {
|
|
137
160
|
return Math.floor(this.timeSource?.() ?? this.animation.timeSource?.() ?? performance.now());
|
|
138
161
|
}
|
|
162
|
+
_stateUpdate = (s) => {
|
|
163
|
+
this.playing.value = s === StreamState.Playing;
|
|
164
|
+
switch (s) {
|
|
165
|
+
case StreamState.Ended:
|
|
166
|
+
this.onEnded.emit(this);
|
|
167
|
+
break;
|
|
168
|
+
case StreamState.Playing:
|
|
169
|
+
this.onPlaying.emit(this);
|
|
170
|
+
break;
|
|
171
|
+
case StreamState.Paused:
|
|
172
|
+
this.onPaused.emit(this);
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
};
|
|
139
176
|
/**
|
|
140
177
|
* Queues the LayerClip for playback with optional play options.
|
|
141
178
|
*
|
|
@@ -12,11 +12,29 @@ import { Track } from './track';
|
|
|
12
12
|
*/
|
|
13
13
|
export declare class ClipTrack extends Track {
|
|
14
14
|
readonly clip: Clip;
|
|
15
|
+
/**
|
|
16
|
+
* @default []
|
|
17
|
+
*/
|
|
15
18
|
private _weights;
|
|
19
|
+
/**
|
|
20
|
+
* @default {}
|
|
21
|
+
*/
|
|
16
22
|
private _weightsById;
|
|
23
|
+
/**
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
17
26
|
private _weightsDirty;
|
|
27
|
+
/**
|
|
28
|
+
* @default []
|
|
29
|
+
*/
|
|
18
30
|
private _entities;
|
|
31
|
+
/**
|
|
32
|
+
* @default {}
|
|
33
|
+
*/
|
|
19
34
|
private _entitiesById;
|
|
35
|
+
/**
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
20
38
|
private _entitiesDirty;
|
|
21
39
|
private _lastTick?;
|
|
22
40
|
private _lastLoopNumber?;
|
|
@@ -6,6 +6,33 @@ import { resolveClipTimeLoops, resolveKeyframes, resolveKeyframeValue, Track } f
|
|
|
6
6
|
* @param id Optional unique identifier for the ClipTrack.
|
|
7
7
|
*/
|
|
8
8
|
export class ClipTrack extends Track {
|
|
9
|
+
clip;
|
|
10
|
+
/**
|
|
11
|
+
* @default []
|
|
12
|
+
*/
|
|
13
|
+
_weights = [];
|
|
14
|
+
/**
|
|
15
|
+
* @default {}
|
|
16
|
+
*/
|
|
17
|
+
_weightsById = {};
|
|
18
|
+
/**
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
_weightsDirty = false;
|
|
22
|
+
/**
|
|
23
|
+
* @default []
|
|
24
|
+
*/
|
|
25
|
+
_entities = [];
|
|
26
|
+
/**
|
|
27
|
+
* @default {}
|
|
28
|
+
*/
|
|
29
|
+
_entitiesById = {};
|
|
30
|
+
/**
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
_entitiesDirty = false;
|
|
34
|
+
_lastTick;
|
|
35
|
+
_lastLoopNumber;
|
|
9
36
|
/**
|
|
10
37
|
* Creates an instance of ClipTrack.
|
|
11
38
|
* @param clip - The associated Clip to embed.
|
|
@@ -14,12 +41,6 @@ export class ClipTrack extends Track {
|
|
|
14
41
|
constructor(clip, id) {
|
|
15
42
|
super(clip.animation, id);
|
|
16
43
|
this.clip = clip;
|
|
17
|
-
this._weights = [];
|
|
18
|
-
this._weightsById = {};
|
|
19
|
-
this._weightsDirty = false;
|
|
20
|
-
this._entities = [];
|
|
21
|
-
this._entitiesById = {};
|
|
22
|
-
this._entitiesDirty = false;
|
|
23
44
|
this.clip.influencedPathsDirty.addListener(v => {
|
|
24
45
|
if (v)
|
|
25
46
|
this.influencedPathsDirty.value = true;
|
|
@@ -19,8 +19,17 @@ export interface ResolvedFunctionTrackEntity {
|
|
|
19
19
|
*/
|
|
20
20
|
export declare class FunctionTrack extends Track {
|
|
21
21
|
readonly animation: Animation;
|
|
22
|
+
/**
|
|
23
|
+
* @default []
|
|
24
|
+
*/
|
|
22
25
|
private _entities;
|
|
26
|
+
/**
|
|
27
|
+
* @default {}
|
|
28
|
+
*/
|
|
23
29
|
private _entitiesById;
|
|
30
|
+
/**
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
24
33
|
private _entitiesDirty;
|
|
25
34
|
private _lastTick?;
|
|
26
35
|
/**
|
|
@@ -7,6 +7,21 @@ import { Track } from './track';
|
|
|
7
7
|
* @param animation The associated Animation instance.
|
|
8
8
|
*/
|
|
9
9
|
export class FunctionTrack extends Track {
|
|
10
|
+
animation;
|
|
11
|
+
/**
|
|
12
|
+
* @default []
|
|
13
|
+
*/
|
|
14
|
+
_entities = [];
|
|
15
|
+
/**
|
|
16
|
+
* @default {}
|
|
17
|
+
*/
|
|
18
|
+
_entitiesById = {};
|
|
19
|
+
/**
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
_entitiesDirty = false;
|
|
23
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: ignore for now
|
|
24
|
+
_lastTick;
|
|
10
25
|
/**
|
|
11
26
|
* Creates an instance of FunctionTrack.
|
|
12
27
|
* @param animation The associated Animation instance.
|
|
@@ -14,9 +29,6 @@ export class FunctionTrack extends Track {
|
|
|
14
29
|
constructor(animation) {
|
|
15
30
|
super(animation);
|
|
16
31
|
this.animation = animation;
|
|
17
|
-
this._entities = [];
|
|
18
|
-
this._entitiesById = {};
|
|
19
|
-
this._entitiesDirty = false;
|
|
20
32
|
}
|
|
21
33
|
/**
|
|
22
34
|
* Getter for the list of paths influenced by the track.
|
|
@@ -111,6 +123,7 @@ export class FunctionTrack extends Track {
|
|
|
111
123
|
* @param active The current active LayerClip, null, or undefined.
|
|
112
124
|
*/
|
|
113
125
|
streamPause(isActive, active) { }
|
|
126
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: ignore for now
|
|
114
127
|
_resolveBlocksBetween(tstart, tend, rate, clipLength) {
|
|
115
128
|
const blocks = this.sortedBlocks;
|
|
116
129
|
if (rate < 0) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlendType, FadeParameters } from '../../data';
|
|
2
2
|
import { Animation } from '../animation';
|
|
3
3
|
import { Keyframe } from '../keyframe';
|
|
4
4
|
import { Track } from './track';
|
|
@@ -23,11 +23,29 @@ export declare class PropertyTrack extends Track {
|
|
|
23
23
|
path: string;
|
|
24
24
|
private _property;
|
|
25
25
|
private _path;
|
|
26
|
+
/**
|
|
27
|
+
* @default []
|
|
28
|
+
*/
|
|
26
29
|
private _keyframes;
|
|
30
|
+
/**
|
|
31
|
+
* @default {}
|
|
32
|
+
*/
|
|
27
33
|
private _keyframesById;
|
|
34
|
+
/**
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
28
37
|
private _keyframesDirty;
|
|
38
|
+
/**
|
|
39
|
+
* @default []
|
|
40
|
+
*/
|
|
29
41
|
private _weights;
|
|
42
|
+
/**
|
|
43
|
+
* @default {}
|
|
44
|
+
*/
|
|
30
45
|
private _weightsById;
|
|
46
|
+
/**
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
31
49
|
private _weightsDirty;
|
|
32
50
|
/**
|
|
33
51
|
* Optional parameters for fading animation properties.
|
|
@@ -35,6 +53,7 @@ export declare class PropertyTrack extends Track {
|
|
|
35
53
|
fadeParameters?: Partial<FadeParameters>;
|
|
36
54
|
/**
|
|
37
55
|
* Blend type for interpolating values.
|
|
56
|
+
* @default "overlay"
|
|
38
57
|
*/
|
|
39
58
|
blend: BlendType;
|
|
40
59
|
/**
|
|
@@ -15,6 +15,51 @@ const _scratch = new Observable(undefined);
|
|
|
15
15
|
* @param id Optional unique identifier for the PropertyTrack.
|
|
16
16
|
*/
|
|
17
17
|
export class PropertyTrack extends Track {
|
|
18
|
+
_entityID;
|
|
19
|
+
_entity;
|
|
20
|
+
/**
|
|
21
|
+
* Path representing the property being animated.
|
|
22
|
+
*/
|
|
23
|
+
path;
|
|
24
|
+
_property;
|
|
25
|
+
_path;
|
|
26
|
+
/**
|
|
27
|
+
* @default []
|
|
28
|
+
*/
|
|
29
|
+
_keyframes = [];
|
|
30
|
+
/**
|
|
31
|
+
* @default {}
|
|
32
|
+
*/
|
|
33
|
+
_keyframesById = {};
|
|
34
|
+
/**
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
_keyframesDirty = false;
|
|
38
|
+
/**
|
|
39
|
+
* @default []
|
|
40
|
+
*/
|
|
41
|
+
_weights = [];
|
|
42
|
+
/**
|
|
43
|
+
* @default {}
|
|
44
|
+
*/
|
|
45
|
+
_weightsById = {};
|
|
46
|
+
/**
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
49
|
+
_weightsDirty = false;
|
|
50
|
+
/**
|
|
51
|
+
* Optional parameters for fading animation properties.
|
|
52
|
+
*/
|
|
53
|
+
fadeParameters;
|
|
54
|
+
/**
|
|
55
|
+
* Blend type for interpolating values.
|
|
56
|
+
* @default "overlay"
|
|
57
|
+
*/
|
|
58
|
+
blend = 'overlay';
|
|
59
|
+
/**
|
|
60
|
+
* Paths influenced by this track.
|
|
61
|
+
*/
|
|
62
|
+
influencedPaths;
|
|
18
63
|
/**
|
|
19
64
|
* Creates an instance of PropertyTrack.
|
|
20
65
|
* @param anim - The associated Animation instance.
|
|
@@ -23,20 +68,12 @@ export class PropertyTrack extends Track {
|
|
|
23
68
|
* @param property - The property or array of properties to be animated.
|
|
24
69
|
* @param id - Optional unique identifier for the PropertyTrack.
|
|
25
70
|
*/
|
|
26
|
-
constructor(anim, _entityID,
|
|
71
|
+
constructor(anim, _entityID,
|
|
72
|
+
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: avoiding changing constructor signature
|
|
73
|
+
_entity, property, id) {
|
|
27
74
|
super(anim, id);
|
|
28
75
|
this._entityID = _entityID;
|
|
29
76
|
this._entity = _entity;
|
|
30
|
-
this._keyframes = [];
|
|
31
|
-
this._keyframesById = {};
|
|
32
|
-
this._keyframesDirty = false;
|
|
33
|
-
this._weights = [];
|
|
34
|
-
this._weightsById = {};
|
|
35
|
-
this._weightsDirty = false;
|
|
36
|
-
/**
|
|
37
|
-
* Blend type for interpolating values.
|
|
38
|
-
*/
|
|
39
|
-
this.blend = 'overlay';
|
|
40
77
|
if (Array.isArray(property)) {
|
|
41
78
|
this._property = property[0];
|
|
42
79
|
this._path = property.slice(1);
|
|
@@ -16,11 +16,29 @@ export declare class StreamTrack extends Track {
|
|
|
16
16
|
private _entity;
|
|
17
17
|
private _property;
|
|
18
18
|
private _stream;
|
|
19
|
+
/**
|
|
20
|
+
* @default []
|
|
21
|
+
*/
|
|
19
22
|
private _entities;
|
|
23
|
+
/**
|
|
24
|
+
* @default {}
|
|
25
|
+
*/
|
|
20
26
|
private _entitiesById;
|
|
27
|
+
/**
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
21
30
|
private _entitiesDirty;
|
|
31
|
+
/**
|
|
32
|
+
* @default []
|
|
33
|
+
*/
|
|
22
34
|
private _weights;
|
|
35
|
+
/**
|
|
36
|
+
* @default {}
|
|
37
|
+
*/
|
|
23
38
|
private _weightsById;
|
|
39
|
+
/**
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
24
42
|
private _weightsDirty;
|
|
25
43
|
private _lastTick?;
|
|
26
44
|
private _lastLoopNumber?;
|