@zcomponent/core 1.24.0 → 1.25.0-beta.1
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.
|
@@ -8,6 +8,7 @@ import { Track } from './tracks/track';
|
|
|
8
8
|
import { Bezier } from './bezier';
|
|
9
9
|
/** @internal */
|
|
10
10
|
export declare enum AnimationEvents {
|
|
11
|
+
onLayerClipNotActive = "onLayerClipNotActive",
|
|
11
12
|
onLayerClipActive = "onLayerClipActive",
|
|
12
13
|
onLayerClipState = "onLayerClipState"
|
|
13
14
|
}
|
|
@@ -39,6 +40,7 @@ export declare class Animation {
|
|
|
39
40
|
[id: string]: Bezier;
|
|
40
41
|
};
|
|
41
42
|
onTick: Event<[]>;
|
|
43
|
+
onLayerClipNotActive: Event<[layerClip: LayerClip]>;
|
|
42
44
|
onLayerClipActive: Event<[layerClip: LayerClip]>;
|
|
43
45
|
onLayerClipState: Event<[layerClip: LayerClip]>;
|
|
44
46
|
/**
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Observable } from '../observable';
|
|
2
2
|
import { Event } from '../event';
|
|
3
|
+
import { LayerClip } from './layerclip';
|
|
3
4
|
/** @internal */
|
|
4
5
|
export var AnimationEvents;
|
|
5
6
|
(function (AnimationEvents) {
|
|
7
|
+
AnimationEvents["onLayerClipNotActive"] = "onLayerClipNotActive";
|
|
6
8
|
AnimationEvents["onLayerClipActive"] = "onLayerClipActive";
|
|
7
9
|
AnimationEvents["onLayerClipState"] = "onLayerClipState";
|
|
8
10
|
})(AnimationEvents || (AnimationEvents = {}));
|
|
@@ -33,6 +35,7 @@ export class Animation {
|
|
|
33
35
|
this.clips = Object.create(null);
|
|
34
36
|
this.curves = Object.create(null);
|
|
35
37
|
this.onTick = new Event();
|
|
38
|
+
this.onLayerClipNotActive = new Event();
|
|
36
39
|
this.onLayerClipActive = new Event();
|
|
37
40
|
this.onLayerClipState = new Event();
|
|
38
41
|
/**
|
|
@@ -255,6 +258,12 @@ export class Animation {
|
|
|
255
258
|
const entry = this._pendingEvents.shift();
|
|
256
259
|
if (!entry)
|
|
257
260
|
continue;
|
|
261
|
+
if (entry.evt === AnimationEvents.onLayerClipNotActive && entry.args[0] instanceof LayerClip) {
|
|
262
|
+
entry.args[0].active.value = false;
|
|
263
|
+
}
|
|
264
|
+
else if (entry.evt === AnimationEvents.onLayerClipActive && entry.args[0] instanceof LayerClip) {
|
|
265
|
+
entry.args[0].active.value = true;
|
|
266
|
+
}
|
|
258
267
|
this[entry.evt].emit(...entry.args);
|
|
259
268
|
}
|
|
260
269
|
}
|
package/lib/animation/layer.js
CHANGED
|
@@ -75,6 +75,8 @@ export class Layer {
|
|
|
75
75
|
if (entry.layerClip && entry === this._active) {
|
|
76
76
|
if (next && (entry.layerClip.state.value === StreamState.Ended || next.fadeTime >= entry.layerClip.getRemainingTimeEstimate())) {
|
|
77
77
|
next.startTime = t;
|
|
78
|
+
if (this._active?.layerClip)
|
|
79
|
+
this.animation._pendingEvents.push({ evt: AnimationEvents.onLayerClipNotActive, args: [this._active.layerClip] });
|
|
78
80
|
this._active = next;
|
|
79
81
|
this.animation._pendingEvents.push({ evt: AnimationEvents.onLayerClipActive, args: [this._active.layerClip] });
|
|
80
82
|
next.layerClip?.play();
|
|
@@ -158,6 +160,8 @@ export class Layer {
|
|
|
158
160
|
_activateLayerClip(layerClip, playOptions) {
|
|
159
161
|
if (layerClip === undefined) {
|
|
160
162
|
this._queue = [];
|
|
163
|
+
if (this._active?.layerClip)
|
|
164
|
+
this.animation._pendingEvents.push({ evt: AnimationEvents.onLayerClipNotActive, args: [this._active.layerClip] });
|
|
161
165
|
this._active = undefined;
|
|
162
166
|
this.animation._pendingEvents.push({ evt: AnimationEvents.onLayerClipActive, args: [undefined] });
|
|
163
167
|
return;
|
|
@@ -175,6 +179,8 @@ export class Layer {
|
|
|
175
179
|
...playOptions,
|
|
176
180
|
fade: playOptions?.fade !== undefined ? playOptions.fade : this._active === undefined || layerClip === undefined ? { time: 0, easing: null } : undefined,
|
|
177
181
|
});
|
|
182
|
+
if (this._active?.layerClip)
|
|
183
|
+
this.animation._pendingEvents.push({ evt: AnimationEvents.onLayerClipNotActive, args: [this._active.layerClip] });
|
|
178
184
|
this._active = entry;
|
|
179
185
|
this.animation._pendingEvents.push({ evt: AnimationEvents.onLayerClipActive, args: [this._active.layerClip] });
|
|
180
186
|
this._queue[this._queue.length - 1].startTime = this.animation.timeSource?.() ?? performance.now();
|
|
@@ -240,11 +246,15 @@ export class Layer {
|
|
|
240
246
|
this._queue.push(mqe);
|
|
241
247
|
}
|
|
242
248
|
}
|
|
249
|
+
if (this._active?.layerClip)
|
|
250
|
+
this.animation._pendingEvents.push({ evt: AnimationEvents.onLayerClipNotActive, args: [this._active.layerClip] });
|
|
243
251
|
if (typeof entry.active === 'number') {
|
|
244
252
|
this._active = this._queue[entry.active];
|
|
245
253
|
}
|
|
246
254
|
else
|
|
247
255
|
this._active = entry.active;
|
|
256
|
+
if (this._active?.layerClip)
|
|
257
|
+
this.animation._pendingEvents.push({ evt: AnimationEvents.onLayerClipActive, args: [this._active.layerClip] });
|
|
248
258
|
}
|
|
249
259
|
/**
|
|
250
260
|
* Gets the set of paths influenced by the layer.
|
|
@@ -50,6 +50,7 @@ export declare class LayerClip implements Stream {
|
|
|
50
50
|
state: Observable<StreamState, never>;
|
|
51
51
|
playing: Observable<boolean, never>;
|
|
52
52
|
stalled: Observable<boolean, never>;
|
|
53
|
+
active: Observable<boolean, never>;
|
|
53
54
|
onPlaying: Event<[LayerClip]>;
|
|
54
55
|
onPaused: Event<[LayerClip]>;
|
|
55
56
|
onEnded: Event<[LayerClip]>;
|
|
@@ -43,6 +43,7 @@ export class LayerClip {
|
|
|
43
43
|
this.state = new Observable(this._state);
|
|
44
44
|
this.playing = new Observable(false);
|
|
45
45
|
this.stalled = new Observable(false);
|
|
46
|
+
this.active = new Observable(false);
|
|
46
47
|
this.onPlaying = new Event();
|
|
47
48
|
this.onPaused = new Event();
|
|
48
49
|
this.onEnded = new Event();
|
package/lib/types.d.ts
CHANGED
|
@@ -180,6 +180,7 @@ export declare enum ValuesType {
|
|
|
180
180
|
'morphTargets' = "morphTargets",
|
|
181
181
|
'events' = "events",
|
|
182
182
|
'parentNodes' = "parentNodes",
|
|
183
|
+
'parentMaterials' = "parentMaterials",
|
|
183
184
|
'nodelabels' = "nodelabels",
|
|
184
185
|
'nodeids' = "nodeids",
|
|
185
186
|
'layerclipids' = "layerclipids",
|
package/lib/types.js
CHANGED
|
@@ -61,6 +61,7 @@ export var ValuesType;
|
|
|
61
61
|
ValuesType["morphTargets"] = "morphTargets";
|
|
62
62
|
ValuesType["events"] = "events";
|
|
63
63
|
ValuesType["parentNodes"] = "parentNodes";
|
|
64
|
+
ValuesType["parentMaterials"] = "parentMaterials";
|
|
64
65
|
ValuesType["nodelabels"] = "nodelabels";
|
|
65
66
|
ValuesType["nodeids"] = "nodeids";
|
|
66
67
|
ValuesType["layerclipids"] = "layerclipids";
|