@zcomponent/core 0.0.30-beta → 0.0.31-beta

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.
@@ -57,6 +57,7 @@ export declare class Animation {
57
57
  private _emitPendingEvents;
58
58
  private _resolvePath;
59
59
  private _evaluatePath;
60
+ start(): void;
60
61
  }
61
62
  export interface EntityPath {
62
63
  entity: any;
@@ -186,4 +186,12 @@ export class Animation {
186
186
  }
187
187
  resolved[0][resolved[1]] = val;
188
188
  }
189
+ start() {
190
+ for (const layer of this._layers) {
191
+ for (const clip of Object.values(layer.clips)) {
192
+ if (clip.playAtStart)
193
+ clip.play();
194
+ }
195
+ }
196
+ }
189
197
  }
@@ -11,6 +11,7 @@ export declare class LayerClip implements Stream {
11
11
  readonly id?: string | undefined;
12
12
  defaultLoop: boolean;
13
13
  defaultPlaySpeed: number;
14
+ playAtStart: boolean;
14
15
  timeSource: (() => number) | undefined;
15
16
  readonly animation: Animation;
16
17
  private _t0;
@@ -8,6 +8,7 @@ export class LayerClip {
8
8
  this.id = id;
9
9
  this.defaultLoop = false;
10
10
  this.defaultPlaySpeed = 1;
11
+ this.playAtStart = false;
11
12
  this._t0 = 0;
12
13
  this._pauseTime = 0;
13
14
  // private _s0: number = 0;
@@ -36,6 +36,7 @@ export interface LayerClip {
36
36
  reverse?: boolean;
37
37
  playbackSpeed?: number;
38
38
  scriptName?: string;
39
+ playAtStart?: boolean;
39
40
  }
40
41
  export type ActiveLayerClips = ByID<string | undefined>;
41
42
  export declare enum ClipType {
package/lib/inflate.js CHANGED
@@ -135,6 +135,7 @@ export function createLayerClipFromData(zcomp, layer, data) {
135
135
  if (data.reverse)
136
136
  ret.defaultPlaySpeed *= -1;
137
137
  ret.defaultLoop = data.loop ?? false;
138
+ ret.playAtStart = data.playAtStart ?? false;
138
139
  return ret;
139
140
  }
140
141
  export function createLayerFromData(zcomp, anim, data) {
package/lib/zcomponent.js CHANGED
@@ -62,7 +62,11 @@ export class ZComponent extends Component {
62
62
  this.animation.initialize();
63
63
  this.isConstructed = true;
64
64
  this._constructedResolve();
65
- started(contextManager).then(this._updateAnimationRegistrations);
65
+ started(contextManager).then(() => {
66
+ this._updateAnimationRegistrations();
67
+ if (!isDesignTime(contextManager))
68
+ this.animation.start();
69
+ });
66
70
  this.register(this.animation.hasLayers, this._updateAnimationRegistrations, { bindWhenDisabled: true });
67
71
  }
68
72
  _constructorForNode(nodeId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zcomponent/core",
3
- "version": "0.0.30-beta",
3
+ "version": "0.0.31-beta",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",