@galacean/effects-core 2.0.2 → 2.1.0-alpha.0

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/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime core for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.0.2
6
+ * Version: v2.1.0-alpha.0
7
7
  */
8
8
 
9
9
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
@@ -4565,7 +4565,6 @@ function getDirectStore(target) {
4565
4565
 
4566
4566
  /**
4567
4567
  * @since 2.0.0
4568
- * @internal
4569
4568
  */ var EffectsObject = /*#__PURE__*/ function() {
4570
4569
  function EffectsObject(engine) {
4571
4570
  this.engine = engine;
@@ -4601,92 +4600,112 @@ function getDirectStore(target) {
4601
4600
 
4602
4601
  /**
4603
4602
  * @since 2.0.0
4604
- * @internal
4605
4603
  */ var Component = /*#__PURE__*/ function(EffectsObject) {
4606
4604
  _inherits(Component, EffectsObject);
4607
4605
  function Component() {
4608
- return EffectsObject.apply(this, arguments);
4609
- }
4610
- var _proto = Component.prototype;
4611
- _proto.onAttached = function onAttached() {};
4612
- _proto.onDestroy = function onDestroy() {};
4613
- _proto.fromData = function fromData(data) {
4614
- EffectsObject.prototype.fromData.call(this, data);
4615
- if (data.item) {
4616
- this.item = data.item;
4617
- }
4618
- };
4619
- _proto.dispose = function dispose() {
4620
- this.onDestroy();
4621
- if (this.item) {
4622
- removeItem(this.item.components, this);
4623
- }
4624
- };
4625
- _create_class(Component, [
4626
- {
4627
- key: "transform",
4628
- get: /**
4629
- * 附加到的 VFXItem 对象 Transform 组件
4630
- */ function get() {
4631
- return this.item.transform;
4632
- }
4633
- }
4634
- ]);
4635
- return Component;
4636
- }(EffectsObject);
4637
- /**
4638
- * @since 2.0.0
4639
- * @internal
4640
- */ var Behaviour = /*#__PURE__*/ function(Component) {
4641
- _inherits(Behaviour, Component);
4642
- function Behaviour() {
4643
4606
  var _this;
4644
- _this = Component.apply(this, arguments) || this;
4607
+ _this = EffectsObject.apply(this, arguments) || this;
4645
4608
  _this.isAwakeCalled = false;
4646
4609
  _this.isStartCalled = false;
4610
+ _this.isEnableCalled = false;
4647
4611
  _this._enabled = true;
4648
4612
  return _this;
4649
4613
  }
4650
- var _proto = Behaviour.prototype;
4614
+ var _proto = Component.prototype;
4651
4615
  /**
4652
4616
  * 生命周期函数,初始化后调用,生命周期内只调用一次
4653
- */ _proto.awake = function awake() {
4617
+ */ _proto.onAwake = function onAwake() {
4654
4618
  // OVERRIDE
4655
4619
  };
4656
4620
  /**
4657
- * 在每次设置 enabled true 时触发
4621
+ * enabled 变为 true 时触发
4658
4622
  */ _proto.onEnable = function onEnable() {
4659
4623
  // OVERRIDE
4660
4624
  };
4661
4625
  /**
4626
+ * 在 enabled 变为 false 时触发
4627
+ */ _proto.onDisable = function onDisable() {
4628
+ // OVERRIDE
4629
+ };
4630
+ /**
4662
4631
  * 生命周期函数,在第一次 update 前调用,生命周期内只调用一次
4663
- */ _proto.start = function start() {
4632
+ */ _proto.onStart = function onStart() {
4664
4633
  // OVERRIDE
4665
4634
  };
4666
4635
  /**
4667
4636
  * 生命周期函数,每帧调用一次
4668
- */ _proto.update = function update(dt) {
4637
+ */ _proto.onUpdate = function onUpdate(dt) {
4669
4638
  // OVERRIDE
4670
4639
  };
4671
4640
  /**
4672
4641
  * 生命周期函数,每帧调用一次,在 update 之后调用
4673
- */ _proto.lateUpdate = function lateUpdate(dt) {
4642
+ */ _proto.onLateUpdate = function onLateUpdate(dt) {
4643
+ // OVERRIDE
4644
+ };
4645
+ /**
4646
+ * 生命周期函数,在组件销毁时调用
4647
+ */ _proto.onDestroy = function onDestroy() {
4674
4648
  // OVERRIDE
4675
4649
  };
4676
- _proto.onAttached = function onAttached() {
4677
- this.item.itemBehaviours.push(this);
4678
- if (!this.isAwakeCalled) {
4679
- this.awake();
4680
- this.isAwakeCalled = true;
4650
+ /**
4651
+ * @internal
4652
+ */ _proto.enable = function enable() {
4653
+ if (this.item.composition) {
4654
+ this.item.composition.sceneTicking.addComponent(this);
4655
+ this.isEnableCalled = true;
4656
+ }
4657
+ this.onEnable();
4658
+ };
4659
+ /**
4660
+ * @internal
4661
+ */ _proto.disable = function disable() {
4662
+ this.onDisable();
4663
+ if (this.item.composition) {
4664
+ this.isEnableCalled = false;
4665
+ this.item.composition.sceneTicking.removeComponent(this);
4666
+ }
4667
+ };
4668
+ _proto.setVFXItem = function setVFXItem(item) {
4669
+ this.item = item;
4670
+ if (item.isDuringPlay) {
4671
+ if (!this.isAwakeCalled) {
4672
+ this.onAwake();
4673
+ this.isAwakeCalled = true;
4674
+ }
4675
+ if (item.getVisible() && this.enabled) {
4676
+ this.start();
4677
+ this.enable();
4678
+ }
4679
+ }
4680
+ };
4681
+ _proto.fromData = function fromData(data) {
4682
+ EffectsObject.prototype.fromData.call(this, data);
4683
+ if (data.item) {
4684
+ this.item = data.item;
4681
4685
  }
4682
4686
  };
4683
4687
  _proto.dispose = function dispose() {
4688
+ this.onDestroy();
4684
4689
  if (this.item) {
4685
- removeItem(this.item.itemBehaviours, this);
4690
+ removeItem(this.item.components, this);
4686
4691
  }
4687
- Component.prototype.dispose.call(this);
4688
4692
  };
4689
- _create_class(Behaviour, [
4693
+ _proto.start = function start() {
4694
+ if (this.isStartCalled) {
4695
+ return;
4696
+ }
4697
+ this.isStartCalled = true;
4698
+ this.onStart();
4699
+ };
4700
+ _create_class(Component, [
4701
+ {
4702
+ key: "transform",
4703
+ get: /**
4704
+ * 附加到的 VFXItem 对象 Transform 组件
4705
+ */ function get() {
4706
+ return this.item.transform;
4707
+ }
4708
+ },
4690
4709
  {
4691
4710
  key: "isActiveAndEnabled",
4692
4711
  get: /**
@@ -4701,24 +4720,46 @@ function getDirectStore(target) {
4701
4720
  return this._enabled;
4702
4721
  },
4703
4722
  set: function set(value) {
4704
- this._enabled = value;
4705
- if (value) {
4706
- if (this.isActiveAndEnabled) {
4707
- this.onEnable();
4708
- }
4709
- if (!this.isStartCalled) {
4710
- this.start();
4711
- this.isStartCalled = true;
4723
+ if (this.enabled !== value) {
4724
+ this._enabled = value;
4725
+ if (value) {
4726
+ if (this.isActiveAndEnabled) {
4727
+ this.enable();
4728
+ if (!this.isStartCalled) {
4729
+ this.onStart();
4730
+ this.isStartCalled = true;
4731
+ }
4732
+ }
4733
+ } else {
4734
+ if (this.isEnableCalled) {
4735
+ this.disable();
4736
+ }
4712
4737
  }
4713
4738
  }
4714
4739
  }
4715
4740
  }
4716
4741
  ]);
4717
- return Behaviour;
4718
- }(Component);
4742
+ return Component;
4743
+ }(EffectsObject);
4719
4744
  __decorate([
4720
4745
  serialize()
4721
- ], Behaviour.prototype, "_enabled", void 0);
4746
+ ], Component.prototype, "_enabled", void 0);
4747
+ /**
4748
+ * @since 2.0.0
4749
+ */ var Behaviour = /*#__PURE__*/ function(Component) {
4750
+ _inherits(Behaviour, Component);
4751
+ function Behaviour() {
4752
+ return Component.apply(this, arguments);
4753
+ }
4754
+ var _proto = Behaviour.prototype;
4755
+ _proto.setVFXItem = function setVFXItem(item) {
4756
+ Component.prototype.setVFXItem.call(this, item);
4757
+ };
4758
+ _proto.dispose = function dispose() {
4759
+ Component.prototype.dispose.call(this);
4760
+ };
4761
+ return Behaviour;
4762
+ }(Component);
4722
4763
 
4723
4764
  /**
4724
4765
  * 所有渲染组件的基类
@@ -4728,19 +4769,14 @@ __decorate([
4728
4769
  function RendererComponent() {
4729
4770
  var _this;
4730
4771
  _this = Component.apply(this, arguments) || this;
4731
- _this.isStartCalled = false;
4732
4772
  _this.materials = [];
4733
4773
  _this._priority = 0;
4734
- _this._enabled = true;
4735
4774
  return _this;
4736
4775
  }
4737
4776
  var _proto = RendererComponent.prototype;
4738
- _proto.onEnable = function onEnable() {};
4739
- _proto.start = function start() {};
4740
- _proto.update = function update(dt) {};
4741
- _proto.lateUpdate = function lateUpdate(dt) {};
4742
4777
  _proto.render = function render(renderer) {};
4743
- _proto.onAttached = function onAttached() {
4778
+ _proto.setVFXItem = function setVFXItem(item) {
4779
+ Component.prototype.setVFXItem.call(this, item);
4744
4780
  this.item.rendererComponents.push(this);
4745
4781
  };
4746
4782
  _proto.fromData = function fromData(data) {
@@ -4765,26 +4801,6 @@ __decorate([
4765
4801
  this._priority = value;
4766
4802
  }
4767
4803
  },
4768
- {
4769
- key: "enabled",
4770
- get: function get() {
4771
- return this._enabled;
4772
- },
4773
- set: function set(value) {
4774
- this._enabled = value;
4775
- if (value) {
4776
- this.onEnable();
4777
- }
4778
- }
4779
- },
4780
- {
4781
- key: "isActiveAndEnabled",
4782
- get: /**
4783
- * 组件是否可以更新,true 更新,false 不更新
4784
- */ function get() {
4785
- return this.item.getVisible() && this.enabled;
4786
- }
4787
- },
4788
4804
  {
4789
4805
  key: "material",
4790
4806
  get: function get() {
@@ -4807,9 +4823,6 @@ __decorate([
4807
4823
  __decorate([
4808
4824
  serialize()
4809
4825
  ], RendererComponent.prototype, "_priority", void 0);
4810
- __decorate([
4811
- serialize()
4812
- ], RendererComponent.prototype, "_enabled", void 0);
4813
4826
 
4814
4827
  /**
4815
4828
  * 抽象插件类
@@ -4853,7 +4866,7 @@ var CameraController = /*#__PURE__*/ function(Behaviour) {
4853
4866
  return _this;
4854
4867
  }
4855
4868
  var _proto = CameraController.prototype;
4856
- _proto.update = function update() {
4869
+ _proto.onUpdate = function onUpdate() {
4857
4870
  if (this.item.composition && this.item.transform.getValid()) {
4858
4871
  var camera = this.item.composition.camera;
4859
4872
  camera.near = this.options.near;
@@ -8085,7 +8098,7 @@ function _loadVideo() {
8085
8098
  }, true);
8086
8099
  }
8087
8100
  video.addEventListener("error", function(e) {
8088
- reject(e);
8101
+ reject("Load video fail.");
8089
8102
  });
8090
8103
  })
8091
8104
  ];
@@ -13251,7 +13264,7 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13251
13264
  return _this;
13252
13265
  }
13253
13266
  var _proto = InteractComponent.prototype;
13254
- _proto.start = function start() {
13267
+ _proto.onStart = function onStart() {
13255
13268
  var _this = this;
13256
13269
  var options = this.item.props.content.options;
13257
13270
  var env = this.item.engine.renderer.env;
@@ -13287,8 +13300,11 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
13287
13300
  }
13288
13301
  };
13289
13302
  };
13290
- _proto.update = function update(dt) {
13303
+ _proto.onUpdate = function onUpdate(dt) {
13291
13304
  var _this_previewContent;
13305
+ if (!this.isActiveAndEnabled) {
13306
+ return;
13307
+ }
13292
13308
  (_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.updateMesh();
13293
13309
  if (!this.hasBeenAddedToComposition && this.item.composition) {
13294
13310
  var options = this.item.props.content.options;
@@ -13559,7 +13575,6 @@ function _assert_this_initialized(self) {
13559
13575
  /**
13560
13576
  * 动画图,负责更新所有的动画节点
13561
13577
  * @since 2.0.0
13562
- * @internal
13563
13578
  */ var PlayableGraph = /*#__PURE__*/ function() {
13564
13579
  function PlayableGraph() {
13565
13580
  this.playableOutputs = [];
@@ -13619,7 +13634,6 @@ function _assert_this_initialized(self) {
13619
13634
  /**
13620
13635
  * 动画图可播放节点对象
13621
13636
  * @since 2.0.0
13622
- * @internal
13623
13637
  */ var Playable = /*#__PURE__*/ function() {
13624
13638
  function Playable(graph, inputCount) {
13625
13639
  if (inputCount === void 0) inputCount = 0;
@@ -13633,6 +13647,9 @@ function _assert_this_initialized(self) {
13633
13647
  this.outputs = [];
13634
13648
  this.playState = 0;
13635
13649
  this.traversalMode = 0;
13650
+ /**
13651
+ * 当前本地播放的时间
13652
+ */ this.time = 0;
13636
13653
  graph.addPlayable(this);
13637
13654
  this.inputs = new Array(inputCount);
13638
13655
  this.inputOuputPorts = new Array(inputCount);
@@ -13817,7 +13834,6 @@ function _assert_this_initialized(self) {
13817
13834
  /**
13818
13835
  * 动画图输出节点对象,将动画数据采样到绑定的元素属性上
13819
13836
  * @since 2.0.0
13820
- * @internal
13821
13837
  */ var PlayableOutput = /*#__PURE__*/ function() {
13822
13838
  function PlayableOutput() {
13823
13839
  this.sourceOutputPort = 0;
@@ -13900,13 +13916,17 @@ var SpriteColorPlayable = /*#__PURE__*/ function(Playable) {
13900
13916
  if (!_instanceof1(boundObject, VFXItem)) {
13901
13917
  return;
13902
13918
  }
13919
+ if (!this.spriteComponent) {
13920
+ this.spriteComponent = boundObject.getComponent(SpriteComponent);
13921
+ }
13903
13922
  if (!this.spriteMaterial) {
13904
- this.spriteMaterial = boundObject.getComponent(SpriteComponent).material;
13923
+ this.spriteMaterial = this.spriteComponent.material;
13905
13924
  var startColor = this.spriteMaterial.getVector4("_Color");
13906
13925
  if (startColor) {
13907
13926
  this.startColor = startColor.toArray();
13908
13927
  }
13909
13928
  }
13929
+ this.spriteComponent.setAnimationTime(this.time);
13910
13930
  var colorInc = vecFill(tempColor, 1);
13911
13931
  var colorChanged;
13912
13932
  var life = this.time / boundObject.duration;
@@ -13966,7 +13986,6 @@ var SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
13966
13986
  _this = RendererComponent.call(this, engine) || this;
13967
13987
  _this.cachePrefix = "-";
13968
13988
  _this.frameAnimationLoop = false;
13969
- _this.frameAnimationTime = 0;
13970
13989
  _this.color = [
13971
13990
  1,
13972
13991
  1,
@@ -13974,6 +13993,8 @@ var SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
13974
13993
  1
13975
13994
  ];
13976
13995
  _this.visible = true;
13996
+ _this.isManualTimeSet = false;
13997
+ _this.frameAnimationTime = 0;
13977
13998
  _this.getHitTestParams = function(force) {
13978
13999
  var ui = _this.interaction;
13979
14000
  if (force || ui) {
@@ -14056,6 +14077,12 @@ var SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
14056
14077
  this.renderer.texture = texture;
14057
14078
  this.material.setTexture("uSampler0", texture);
14058
14079
  };
14080
+ /**
14081
+ * @internal
14082
+ */ _proto.setAnimationTime = function setAnimationTime(time) {
14083
+ this.frameAnimationTime = time;
14084
+ this.isManualTimeSet = true;
14085
+ };
14059
14086
  _proto.render = function render(renderer) {
14060
14087
  if (!this.getVisible()) {
14061
14088
  return;
@@ -14068,14 +14095,14 @@ var SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
14068
14095
  this.material.setVector2("_Size", this.transform.size);
14069
14096
  renderer.drawGeometry(geo, material);
14070
14097
  };
14071
- _proto.start = function start() {
14098
+ _proto.onStart = function onStart() {
14072
14099
  this.item.getHitTestParams = this.getHitTestParams;
14073
- if (this.item.endBehavior === EndBehavior.restart) {
14074
- this.frameAnimationLoop = true;
14075
- }
14076
14100
  };
14077
- _proto.update = function update(dt) {
14078
- this.frameAnimationTime += dt / 1000;
14101
+ _proto.onUpdate = function onUpdate(dt) {
14102
+ if (!this.isManualTimeSet) {
14103
+ this.frameAnimationTime += dt / 1000;
14104
+ this.isManualTimeSet = false;
14105
+ }
14079
14106
  var time = this.frameAnimationTime;
14080
14107
  var duration = this.item.duration;
14081
14108
  if (time > duration && this.frameAnimationLoop) {
@@ -16470,7 +16497,6 @@ function getTrailMeshShader(trails, particleMaxCount, name, gpuCapability, env)
16470
16497
 
16471
16498
  /**
16472
16499
  * @since 2.0.0
16473
- * @internal
16474
16500
  */ var ParticleSystemRenderer = /*#__PURE__*/ function(RendererComponent) {
16475
16501
  _inherits(ParticleSystemRenderer, RendererComponent);
16476
16502
  function ParticleSystemRenderer(engine, particleMeshProps, trailMeshProps) {
@@ -16495,15 +16521,15 @@ function getTrailMeshShader(trails, particleMaxCount, name, gpuCapability, env)
16495
16521
  return _this;
16496
16522
  }
16497
16523
  var _proto = ParticleSystemRenderer.prototype;
16498
- _proto.start = function start() {
16524
+ _proto.onStart = function onStart() {
16499
16525
  this._priority = this.item.renderOrder;
16500
16526
  this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);
16501
16527
  for(var _iterator = _create_for_of_iterator_helper_loose(this.meshes), _step; !(_step = _iterator()).done;){
16502
16528
  var mesh = _step.value;
16503
- mesh.start();
16529
+ mesh.onStart();
16504
16530
  }
16505
16531
  };
16506
- _proto.update = function update(dt) {
16532
+ _proto.onUpdate = function onUpdate(dt) {
16507
16533
  var time = this.particleMesh.time;
16508
16534
  this.particleMesh.mesh.material.setVector4("uParams", new Vector4(time, this.item.duration, 0, 0));
16509
16535
  };
@@ -16727,7 +16753,7 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
16727
16753
  _proto.getTextures = function getTextures() {
16728
16754
  return this.renderer.getTextures();
16729
16755
  };
16730
- _proto.start = function start() {
16756
+ _proto.startEmit = function startEmit() {
16731
16757
  if (!this.started || this.ended) {
16732
16758
  this.reset();
16733
16759
  this.started = true;
@@ -16753,7 +16779,7 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
16753
16779
  this.frozen = false;
16754
16780
  this.ended = false;
16755
16781
  };
16756
- _proto.onUpdate = function onUpdate(delta) {
16782
+ _proto.update = function update(delta) {
16757
16783
  var _this = this;
16758
16784
  if (this.started && !this.frozen) {
16759
16785
  var now = this.lastUpdate + delta / 1000;
@@ -17536,7 +17562,6 @@ function randomArrItem(arr, keepArr) {
17536
17562
 
17537
17563
  /**
17538
17564
  * @since 2.0.0
17539
- * @internal
17540
17565
  */ var ParticleBehaviourPlayable = /*#__PURE__*/ function(Playable) {
17541
17566
  _inherits(ParticleBehaviourPlayable, Playable);
17542
17567
  function ParticleBehaviourPlayable() {
@@ -17554,7 +17579,7 @@ function randomArrItem(arr, keepArr) {
17554
17579
  this.particleSystem = boundObject.getComponent(ParticleSystem);
17555
17580
  if (this.particleSystem) {
17556
17581
  this.particleSystem.name = boundObject.name;
17557
- this.particleSystem.start();
17582
+ this.particleSystem.startEmit();
17558
17583
  this.particleSystem.initEmitterTransform();
17559
17584
  }
17560
17585
  };
@@ -17574,7 +17599,7 @@ function randomArrItem(arr, keepArr) {
17574
17599
  if (Math.abs(this.time - this.lastTime) < 0.001) {
17575
17600
  deltaTime = 0;
17576
17601
  }
17577
- particleSystem.onUpdate(deltaTime);
17602
+ particleSystem.update(deltaTime);
17578
17603
  }
17579
17604
  this.lastTime = this.time;
17580
17605
  };
@@ -18596,7 +18621,6 @@ var tempSize = new Vector3(1, 1, 1);
18596
18621
  var tempPos = new Vector3();
18597
18622
  /**
18598
18623
  * @since 2.0.0
18599
- * @internal
18600
18624
  */ var TransformAnimationPlayable = /*#__PURE__*/ function(AnimationPlayable) {
18601
18625
  _inherits(TransformAnimationPlayable, AnimationPlayable);
18602
18626
  function TransformAnimationPlayable() {
@@ -18758,7 +18782,6 @@ TransformPlayableAsset = __decorate([
18758
18782
  ], TransformPlayableAsset);
18759
18783
  /**
18760
18784
  * @since 2.0.0
18761
- * @internal
18762
18785
  */ var ActivationPlayable = /*#__PURE__*/ function(Playable) {
18763
18786
  _inherits(ActivationPlayable, Playable);
18764
18787
  function ActivationPlayable() {
@@ -18909,7 +18932,6 @@ var AnimationClipPlayable = /*#__PURE__*/ function(Playable) {
18909
18932
 
18910
18933
  /**
18911
18934
  * @since 2.0.0
18912
- * @internal
18913
18935
  */ var TimelineClip = /*#__PURE__*/ function() {
18914
18936
  function TimelineClip() {
18915
18937
  this.start = 0;
@@ -19307,25 +19329,15 @@ var TrackSortWrapper = function TrackSortWrapper(track, originalIndex) {
19307
19329
  this.track = track;
19308
19330
  this.originalIndex = originalIndex;
19309
19331
  };
19310
- function isAncestor(ancestorCandidate, descendantCandidate) {
19311
- var current = descendantCandidate.parent;
19312
- while(current){
19313
- if (current === ancestorCandidate) {
19314
- return true;
19315
- }
19316
- current = current.parent;
19317
- }
19318
- return false;
19319
- }
19320
19332
  function compareTracks(a, b) {
19321
19333
  var bindingA = a.track.binding;
19322
19334
  var bindingB = b.track.binding;
19323
19335
  if (!_instanceof1(bindingA, VFXItem) || !_instanceof1(bindingB, VFXItem)) {
19324
19336
  return a.originalIndex - b.originalIndex;
19325
19337
  }
19326
- if (isAncestor(bindingA, bindingB)) {
19338
+ if (VFXItem.isAncestor(bindingA, bindingB)) {
19327
19339
  return -1;
19328
- } else if (isAncestor(bindingB, bindingA)) {
19340
+ } else if (VFXItem.isAncestor(bindingB, bindingA)) {
19329
19341
  return 1;
19330
19342
  } else {
19331
19343
  return a.originalIndex - b.originalIndex; // 非父子关系的元素保持原始顺序
@@ -19334,7 +19346,6 @@ function compareTracks(a, b) {
19334
19346
 
19335
19347
  /**
19336
19348
  * @since 2.0.0
19337
- * @internal
19338
19349
  */ var CompositionComponent = /*#__PURE__*/ function(Behaviour) {
19339
19350
  _inherits(CompositionComponent, Behaviour);
19340
19351
  function CompositionComponent() {
@@ -19350,7 +19361,7 @@ function compareTracks(a, b) {
19350
19361
  return _this;
19351
19362
  }
19352
19363
  var _proto = CompositionComponent.prototype;
19353
- _proto.start = function start() {
19364
+ _proto.onStart = function onStart() {
19354
19365
  var _this_item_props = this.item.props, _this_item_props_startTime = _this_item_props.startTime, startTime = _this_item_props_startTime === void 0 ? 0 : _this_item_props_startTime;
19355
19366
  this.startTime = startTime;
19356
19367
  this.resolveBindings();
@@ -19378,7 +19389,7 @@ function compareTracks(a, b) {
19378
19389
  _proto.getReusable = function getReusable() {
19379
19390
  return this.reusable;
19380
19391
  };
19381
- _proto.update = function update(dt) {
19392
+ _proto.onUpdate = function onUpdate(dt) {
19382
19393
  var time = this.time;
19383
19394
  this.timelinePlayable.setTime(time);
19384
19395
  this.graph.evaluate(dt);
@@ -19414,7 +19425,9 @@ function compareTracks(a, b) {
19414
19425
  props.content = itemData.content;
19415
19426
  item = assetLoader.loadGUID(itemData.id);
19416
19427
  item.composition = this.item.composition;
19417
- var compositionComponent = item.addComponent(CompositionComponent);
19428
+ var compositionComponent = new CompositionComponent(this.engine);
19429
+ compositionComponent.item = item;
19430
+ item.components.push(compositionComponent);
19418
19431
  compositionComponent.data = props;
19419
19432
  compositionComponent.refId = refId;
19420
19433
  item.transform.parentTransform = this.transform;
@@ -19825,8 +19838,8 @@ var TextComponent = /*#__PURE__*/ function(SpriteComponent) {
19825
19838
  return _this;
19826
19839
  }
19827
19840
  var _proto = TextComponent.prototype;
19828
- _proto.update = function update(dt) {
19829
- SpriteComponent.prototype.update.call(this, dt);
19841
+ _proto.onUpdate = function onUpdate(dt) {
19842
+ SpriteComponent.prototype.onUpdate.call(this, dt);
19830
19843
  this.updateTexture();
19831
19844
  };
19832
19845
  _proto.fromData = function fromData(data) {
@@ -20241,7 +20254,7 @@ var EffectComponent = /*#__PURE__*/ function(RendererComponent) {
20241
20254
  return _this;
20242
20255
  }
20243
20256
  var _proto = EffectComponent.prototype;
20244
- _proto.start = function start() {
20257
+ _proto.onStart = function onStart() {
20245
20258
  this.item.getHitTestParams = this.getHitTestParams;
20246
20259
  };
20247
20260
  _proto.render = function render(renderer) {
@@ -20368,7 +20381,7 @@ var PostProcessVolume = /*#__PURE__*/ function(Behaviour) {
20368
20381
  return _this;
20369
20382
  }
20370
20383
  var _proto = PostProcessVolume.prototype;
20371
- _proto.start = function start() {
20384
+ _proto.onStart = function onStart() {
20372
20385
  var composition = this.item.composition;
20373
20386
  if (composition) {
20374
20387
  composition.globalVolume = this;
@@ -20510,8 +20523,8 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
20510
20523
  */ _this.ended = false;
20511
20524
  _this.reusable = false;
20512
20525
  _this.type = ItemType.base;
20526
+ _this.isDuringPlay = false;
20513
20527
  _this.components = [];
20514
- _this.itemBehaviours = [];
20515
20528
  _this.rendererComponents = [];
20516
20529
  /**
20517
20530
  * 元素可见性,该值的改变会触发 `handleVisibleChanged` 回调
@@ -20521,6 +20534,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
20521
20534
  * 元素动画的速度
20522
20535
  */ _this.speed = 1;
20523
20536
  _this.listIndex = 0;
20537
+ _this.isEnabled = false;
20524
20538
  _this.eventProcessor = new EventEmitter();
20525
20539
  _this.name = "VFXItem";
20526
20540
  _this.transform.name = _this.name;
@@ -20593,8 +20607,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
20593
20607
  */ _proto.addComponent = function addComponent(classConstructor) {
20594
20608
  var newComponent = new classConstructor(this.engine);
20595
20609
  this.components.push(newComponent);
20596
- newComponent.item = this;
20597
- newComponent.onAttached();
20610
+ newComponent.setVFXItem(this);
20598
20611
  return newComponent;
20599
20612
  };
20600
20613
  /**
@@ -20627,21 +20640,22 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
20627
20640
  return res;
20628
20641
  };
20629
20642
  _proto.setParent = function setParent(vfxItem) {
20630
- if (vfxItem === this) {
20643
+ if (vfxItem === this && !vfxItem) {
20631
20644
  return;
20632
20645
  }
20633
20646
  if (this.parent) {
20634
20647
  removeItem(this.parent.children, this);
20635
20648
  }
20636
20649
  this.parent = vfxItem;
20637
- if (vfxItem) {
20638
- if (!VFXItem.isCamera(this)) {
20639
- this.transform.parentTransform = vfxItem.transform;
20640
- }
20641
- vfxItem.children.push(this);
20642
- if (!this.composition) {
20643
- this.composition = vfxItem.composition;
20644
- }
20650
+ if (!VFXItem.isCamera(this)) {
20651
+ this.transform.parentTransform = vfxItem.transform;
20652
+ }
20653
+ vfxItem.children.push(this);
20654
+ if (!this.composition) {
20655
+ this.composition = vfxItem.composition;
20656
+ }
20657
+ if (!this.isDuringPlay && vfxItem.isDuringPlay) {
20658
+ this.beginPlay();
20645
20659
  }
20646
20660
  };
20647
20661
  /**
@@ -20672,6 +20686,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
20672
20686
  */ _proto.setVisible = function setVisible(visible) {
20673
20687
  if (this.visible !== visible) {
20674
20688
  this.visible = !!visible;
20689
+ this.onActiveChanged();
20675
20690
  }
20676
20691
  };
20677
20692
  /**
@@ -20796,6 +20811,57 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
20796
20811
  }
20797
20812
  return undefined;
20798
20813
  };
20814
+ /**
20815
+ * @internal
20816
+ */ _proto.beginPlay = function beginPlay() {
20817
+ this.isDuringPlay = true;
20818
+ if (this.composition && this.visible && !this.isEnabled) {
20819
+ this.onEnable();
20820
+ }
20821
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
20822
+ var child = _step.value;
20823
+ if (!child.isDuringPlay) {
20824
+ child.beginPlay();
20825
+ }
20826
+ }
20827
+ };
20828
+ /**
20829
+ * @internal
20830
+ */ _proto.onActiveChanged = function onActiveChanged() {
20831
+ if (!this.isEnabled) {
20832
+ this.onEnable();
20833
+ } else {
20834
+ this.onDisable();
20835
+ }
20836
+ };
20837
+ /**
20838
+ * @internal
20839
+ */ _proto.onEnable = function onEnable() {
20840
+ this.isEnabled = true;
20841
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
20842
+ var component = _step.value;
20843
+ if (component.enabled && !component.isStartCalled) {
20844
+ component.onStart();
20845
+ }
20846
+ }
20847
+ for(var _iterator1 = _create_for_of_iterator_helper_loose(this.components), _step1; !(_step1 = _iterator1()).done;){
20848
+ var component1 = _step1.value;
20849
+ if (component1.enabled && !component1.isEnableCalled) {
20850
+ component1.enable();
20851
+ }
20852
+ }
20853
+ };
20854
+ /**
20855
+ * @internal
20856
+ */ _proto.onDisable = function onDisable() {
20857
+ this.isEnabled = false;
20858
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
20859
+ var component = _step.value;
20860
+ if (component.enabled && component.isEnableCalled) {
20861
+ component.disable();
20862
+ }
20863
+ }
20864
+ };
20799
20865
  _proto.fromData = function fromData(data) {
20800
20866
  EffectsObject.prototype.fromData.call(this, data);
20801
20867
  var id = data.id, name = data.name, delay = data.delay, parentId = data.parentId, endBehavior = data.endBehavior, transform = data.transform, _data_listIndex = data.listIndex, listIndex = _data_listIndex === void 0 ? 0 : _data_listIndex, _data_duration = data.duration, duration = _data_duration === void 0 ? 0 : _data_duration;
@@ -20845,14 +20911,10 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
20845
20911
  if (duration <= 0) {
20846
20912
  throw new Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"] + ".");
20847
20913
  }
20848
- this.itemBehaviours.length = 0;
20849
20914
  this.rendererComponents.length = 0;
20850
20915
  for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
20851
20916
  var component = _step.value;
20852
20917
  component.item = this;
20853
- if (_instanceof1(component, Behaviour)) {
20854
- this.itemBehaviours.push(component);
20855
- }
20856
20918
  if (_instanceof1(component, RendererComponent)) {
20857
20919
  this.rendererComponents.push(component);
20858
20920
  }
@@ -20957,6 +21019,16 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
20957
21019
  VFXItem.isExtraCamera = function isExtraCamera(item) {
20958
21020
  return item.id === "extra-camera" && item.name === "extra-camera";
20959
21021
  };
21022
+ VFXItem.isAncestor = function isAncestor(ancestorCandidate, descendantCandidate) {
21023
+ var current = descendantCandidate.parent;
21024
+ while(current){
21025
+ if (current === ancestorCandidate) {
21026
+ return true;
21027
+ }
21028
+ current = current.parent;
21029
+ }
21030
+ return false;
21031
+ };
20960
21032
  _create_class(VFXItem, [
20961
21033
  {
20962
21034
  key: "content",
@@ -21623,7 +21695,6 @@ var SerializationHelper = /*#__PURE__*/ function() {
21623
21695
 
21624
21696
  /**
21625
21697
  * @since 2.0.0
21626
- * @internal
21627
21698
  */ var AssetLoader = /*#__PURE__*/ function() {
21628
21699
  function AssetLoader(engine) {
21629
21700
  this.engine = engine;
@@ -24095,7 +24166,7 @@ var seed = 1;
24095
24166
  ];
24096
24167
  case 6:
24097
24168
  e = _state.sent();
24098
- throw new Error("Failed to load. Check the template or if the URL is " + (isVideo ? "video" : "image") + " type, URL: " + url + ", Error: " + e.message + ".");
24169
+ throw new Error("Failed to load. Check the template or if the URL is " + (isVideo ? "video" : "image") + " type, URL: " + url + ", Error: " + (e.message || e) + ".");
24099
24170
  case 7:
24100
24171
  return [
24101
24172
  3,
@@ -24830,6 +24901,109 @@ var listOrder = 0;
24830
24901
  return CompositionSourceManager;
24831
24902
  }();
24832
24903
 
24904
+ var SceneTicking = /*#__PURE__*/ function() {
24905
+ function SceneTicking() {
24906
+ this.update = new UpdateTickData();
24907
+ this.lateUpdate = new LateUpdateTickData();
24908
+ }
24909
+ var _proto = SceneTicking.prototype;
24910
+ _proto.addComponent = function addComponent(obj) {
24911
+ if (obj.onUpdate !== Component.prototype.onUpdate) {
24912
+ this.update.addComponent(obj);
24913
+ }
24914
+ if (obj.onLateUpdate !== Component.prototype.onLateUpdate) {
24915
+ this.lateUpdate.addComponent(obj);
24916
+ }
24917
+ };
24918
+ _proto.removeComponent = function removeComponent(obj) {
24919
+ if (obj.onUpdate !== Component.prototype.onUpdate) {
24920
+ this.update.removeComponent(obj);
24921
+ }
24922
+ if (obj.onLateUpdate !== Component.prototype.onLateUpdate) {
24923
+ this.lateUpdate.removeComponent(obj);
24924
+ }
24925
+ };
24926
+ _proto.clear = function clear() {
24927
+ this.update.clear();
24928
+ this.lateUpdate.clear();
24929
+ };
24930
+ return SceneTicking;
24931
+ }();
24932
+ var TickData = /*#__PURE__*/ function() {
24933
+ function TickData() {
24934
+ this.components = [];
24935
+ this.ticks = [];
24936
+ }
24937
+ var _proto = TickData.prototype;
24938
+ _proto.tick = function tick(dt) {
24939
+ this.tickComponents(this.components, dt);
24940
+ for(var i = 0; i < this.ticks.length; i++){
24941
+ this.ticks[i](dt);
24942
+ }
24943
+ };
24944
+ _proto.tickComponents = function tickComponents(components, dt) {
24945
+ // To be implemented in derived classes
24946
+ };
24947
+ _proto.addComponent = function addComponent(component) {
24948
+ if (!this.components.includes(component)) {
24949
+ this.components.push(component);
24950
+ }
24951
+ };
24952
+ _proto.removeComponent = function removeComponent(component) {
24953
+ var index = this.components.indexOf(component);
24954
+ if (index > -1) {
24955
+ this.components.splice(index, 1);
24956
+ }
24957
+ };
24958
+ _proto.addTick = function addTick(method, callee) {
24959
+ var tick = method.bind(callee);
24960
+ if (!this.ticks.includes(tick)) {
24961
+ this.ticks.push(tick);
24962
+ }
24963
+ };
24964
+ _proto.clear = function clear() {
24965
+ this.components = [];
24966
+ };
24967
+ return TickData;
24968
+ }();
24969
+ var UpdateTickData = /*#__PURE__*/ function(TickData) {
24970
+ _inherits(UpdateTickData, TickData);
24971
+ function UpdateTickData() {
24972
+ return TickData.apply(this, arguments);
24973
+ }
24974
+ var _proto = UpdateTickData.prototype;
24975
+ _proto.tickComponents = function tickComponents(components, dt) {
24976
+ for(var _iterator = _create_for_of_iterator_helper_loose(components), _step; !(_step = _iterator()).done;){
24977
+ var component = _step.value;
24978
+ component.onUpdate(dt);
24979
+ }
24980
+ };
24981
+ return UpdateTickData;
24982
+ }(TickData);
24983
+ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
24984
+ _inherits(LateUpdateTickData, TickData);
24985
+ function LateUpdateTickData() {
24986
+ return TickData.apply(this, arguments);
24987
+ }
24988
+ var _proto = LateUpdateTickData.prototype;
24989
+ _proto.tickComponents = function tickComponents(components, dt) {
24990
+ for(var _iterator = _create_for_of_iterator_helper_loose(components), _step; !(_step = _iterator()).done;){
24991
+ var component = _step.value;
24992
+ component.onLateUpdate(dt);
24993
+ }
24994
+ };
24995
+ return LateUpdateTickData;
24996
+ } // function compareComponents (a: Component, b: Component): number {
24997
+ // const itemA = a.item;
24998
+ // const itemB = b.item;
24999
+ // if (VFXItem.isAncestor(itemA, itemB)) {
25000
+ // return -1;
25001
+ // } else {
25002
+ // return 1;
25003
+ // }
25004
+ // }
25005
+ (TickData);
25006
+
24833
25007
  /**
24834
25008
  * 合成抽象类:核心对象,通常一个场景只包含一个合成,可能会有多个合成。
24835
25009
  * 合成中包含了相关的 Item 元素,支持对 Item 元素的创建、更新和销毁。
@@ -24839,6 +25013,7 @@ var listOrder = 0;
24839
25013
  function Composition(props, scene) {
24840
25014
  var _this;
24841
25015
  _this = EventEmitter.call(this) || this;
25016
+ _this.sceneTicking = new SceneTicking();
24842
25017
  /**
24843
25018
  * 动画播放速度
24844
25019
  */ _this.speed = 1;
@@ -24876,9 +25051,12 @@ var listOrder = 0;
24876
25051
  _this.rootItem = new VFXItem(_this.getEngine(), sourceContent);
24877
25052
  _this.rootItem.name = "rootItem";
24878
25053
  _this.rootItem.composition = _assert_this_initialized(_this);
24879
- _this.rootComposition = _this.rootItem.addComponent(CompositionComponent);
25054
+ // Spawn rootCompositionComponent
25055
+ _this.rootComposition = new CompositionComponent(_this.getEngine());
24880
25056
  _this.rootComposition.startTime = sourceContent.startTime;
24881
25057
  _this.rootComposition.data = sourceContent;
25058
+ _this.rootComposition.item = _this.rootItem;
25059
+ _this.rootItem.components.push(_this.rootComposition);
24882
25060
  var imageUsage = !reusable && imgUsage;
24883
25061
  _this.width = width;
24884
25062
  _this.height = height;
@@ -24912,7 +25090,6 @@ var listOrder = 0;
24912
25090
  _this.rendererOptions = null;
24913
25091
  _this.rootComposition.createContent();
24914
25092
  _this.buildItemTree(_this.rootItem);
24915
- _this.callAwake(_this.rootItem);
24916
25093
  _this.rootItem.onEnd = function() {
24917
25094
  window.setTimeout(function() {
24918
25095
  _this.emit("end", {
@@ -24924,6 +25101,16 @@ var listOrder = 0;
24924
25101
  return _this;
24925
25102
  }
24926
25103
  var _proto = Composition.prototype;
25104
+ _proto.initializeSceneTicking = function initializeSceneTicking(item) {
25105
+ for(var _iterator = _create_for_of_iterator_helper_loose(item.components), _step; !(_step = _iterator()).done;){
25106
+ var component = _step.value;
25107
+ this.sceneTicking.addComponent(component);
25108
+ }
25109
+ for(var _iterator1 = _create_for_of_iterator_helper_loose(item.children), _step1; !(_step1 = _iterator1()).done;){
25110
+ var child = _step1.value;
25111
+ this.initializeSceneTicking(child);
25112
+ }
25113
+ };
24927
25114
  /**
24928
25115
  * 获取合成的时长
24929
25116
  */ _proto.getDuration = function getDuration() {
@@ -25026,7 +25213,7 @@ var listOrder = 0;
25026
25213
  this.resume();
25027
25214
  }
25028
25215
  if (!this.rootComposition.isStartCalled) {
25029
- this.rootComposition.start();
25216
+ this.rootComposition.onStart();
25030
25217
  this.rootComposition.isStartCalled = true;
25031
25218
  }
25032
25219
  this.forwardTime(time + this.startTime);
@@ -25103,9 +25290,12 @@ var listOrder = 0;
25103
25290
  // 更新 model-tree-plugin
25104
25291
  this.updatePluginLoaders(deltaTime);
25105
25292
  // scene VFXItem components lifetime function.
25106
- this.callStart(this.rootItem);
25107
- this.callUpdate(this.rootItem, time);
25108
- this.callLateUpdate(this.rootItem, time);
25293
+ if (!this.rootItem.isDuringPlay) {
25294
+ this.callAwake(this.rootItem);
25295
+ this.rootItem.beginPlay();
25296
+ }
25297
+ this.sceneTicking.update.tick(time);
25298
+ this.sceneTicking.lateUpdate.tick(time);
25109
25299
  this.updateCamera();
25110
25300
  this.prepareRender();
25111
25301
  if (this.shouldDispose()) {
@@ -25158,11 +25348,11 @@ var listOrder = 0;
25158
25348
  return t;
25159
25349
  };
25160
25350
  _proto.callAwake = function callAwake(item) {
25161
- for(var _iterator = _create_for_of_iterator_helper_loose(item.itemBehaviours), _step; !(_step = _iterator()).done;){
25162
- var itemBehaviour = _step.value;
25163
- if (!itemBehaviour.isAwakeCalled) {
25164
- itemBehaviour.awake();
25165
- itemBehaviour.isAwakeCalled = true;
25351
+ for(var _iterator = _create_for_of_iterator_helper_loose(item.components), _step; !(_step = _iterator()).done;){
25352
+ var component = _step.value;
25353
+ if (!component.isAwakeCalled) {
25354
+ component.onAwake();
25355
+ component.isAwakeCalled = true;
25166
25356
  }
25167
25357
  }
25168
25358
  for(var _iterator1 = _create_for_of_iterator_helper_loose(item.children), _step1; !(_step1 = _iterator1()).done;){
@@ -25170,72 +25360,6 @@ var listOrder = 0;
25170
25360
  this.callAwake(child);
25171
25361
  }
25172
25362
  };
25173
- _proto.callStart = function callStart(item) {
25174
- for(var _iterator = _create_for_of_iterator_helper_loose(item.itemBehaviours), _step; !(_step = _iterator()).done;){
25175
- var itemBehaviour = _step.value;
25176
- if (itemBehaviour.isActiveAndEnabled && !itemBehaviour.isStartCalled) {
25177
- itemBehaviour.start();
25178
- itemBehaviour.isStartCalled = true;
25179
- }
25180
- }
25181
- for(var _iterator1 = _create_for_of_iterator_helper_loose(item.rendererComponents), _step1; !(_step1 = _iterator1()).done;){
25182
- var rendererComponent = _step1.value;
25183
- if (rendererComponent.isActiveAndEnabled && !rendererComponent.isStartCalled) {
25184
- rendererComponent.start();
25185
- rendererComponent.isStartCalled = true;
25186
- }
25187
- }
25188
- for(var _iterator2 = _create_for_of_iterator_helper_loose(item.children), _step2; !(_step2 = _iterator2()).done;){
25189
- var child = _step2.value;
25190
- this.callStart(child);
25191
- }
25192
- };
25193
- _proto.callUpdate = function callUpdate(item, dt) {
25194
- for(var _iterator = _create_for_of_iterator_helper_loose(item.itemBehaviours), _step; !(_step = _iterator()).done;){
25195
- var itemBehaviour = _step.value;
25196
- if (itemBehaviour.isActiveAndEnabled && itemBehaviour.isStartCalled) {
25197
- itemBehaviour.update(dt);
25198
- }
25199
- }
25200
- for(var _iterator1 = _create_for_of_iterator_helper_loose(item.rendererComponents), _step1; !(_step1 = _iterator1()).done;){
25201
- var rendererComponent = _step1.value;
25202
- if (rendererComponent.isActiveAndEnabled && rendererComponent.isStartCalled) {
25203
- rendererComponent.update(dt);
25204
- }
25205
- }
25206
- for(var _iterator2 = _create_for_of_iterator_helper_loose(item.children), _step2; !(_step2 = _iterator2()).done;){
25207
- var child = _step2.value;
25208
- if (VFXItem.isComposition(child)) {
25209
- if (child.ended && child.endBehavior === EndBehavior.restart) {
25210
- child.ended = false;
25211
- // TODO K帧动画在元素重建后需要 tick ,否则会导致元素位置和 k 帧第一帧位置不一致
25212
- this.callUpdate(child, 0);
25213
- } else {
25214
- this.callUpdate(child, dt);
25215
- }
25216
- } else {
25217
- this.callUpdate(child, dt);
25218
- }
25219
- }
25220
- };
25221
- _proto.callLateUpdate = function callLateUpdate(item, dt) {
25222
- for(var _iterator = _create_for_of_iterator_helper_loose(item.itemBehaviours), _step; !(_step = _iterator()).done;){
25223
- var itemBehaviour = _step.value;
25224
- if (itemBehaviour.isActiveAndEnabled && itemBehaviour.isStartCalled) {
25225
- itemBehaviour.lateUpdate(dt);
25226
- }
25227
- }
25228
- for(var _iterator1 = _create_for_of_iterator_helper_loose(item.rendererComponents), _step1; !(_step1 = _iterator1()).done;){
25229
- var rendererComponent = _step1.value;
25230
- if (rendererComponent.isActiveAndEnabled && rendererComponent.isStartCalled) {
25231
- rendererComponent.lateUpdate(dt);
25232
- }
25233
- }
25234
- for(var _iterator2 = _create_for_of_iterator_helper_loose(item.children), _step2; !(_step2 = _iterator2()).done;){
25235
- var child = _step2.value;
25236
- this.callLateUpdate(child, dt);
25237
- }
25238
- };
25239
25363
  /**
25240
25364
  * 构建父子树,同时保存到 itemCacheMap 中便于查找
25241
25365
  */ _proto.buildItemTree = function buildItemTree(compVFXItem) {
@@ -27109,7 +27233,6 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
27109
27233
 
27110
27234
  /**
27111
27235
  * @since 2.0.0
27112
- * @internal
27113
27236
  */ var EffectsPackage = /*#__PURE__*/ function() {
27114
27237
  function EffectsPackage() {
27115
27238
  this.exportObjectDatas = [];
@@ -27518,11 +27641,12 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
27518
27641
  return Engine;
27519
27642
  }();
27520
27643
 
27644
+ var DEFAULT_FPS = 60;
27521
27645
  /**
27522
27646
  * 定时器类
27523
27647
  */ var Ticker = /*#__PURE__*/ function() {
27524
27648
  function Ticker(fps) {
27525
- if (fps === void 0) fps = 60;
27649
+ if (fps === void 0) fps = DEFAULT_FPS;
27526
27650
  this.paused = true;
27527
27651
  this.lastTime = 0;
27528
27652
  // deltaTime
@@ -27657,8 +27781,8 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
27657
27781
  registerPlugin("particle", ParticleLoader, VFXItem, true);
27658
27782
  registerPlugin("cal", CalculateLoader, VFXItem, true);
27659
27783
  registerPlugin("interact", InteractLoader, VFXItem, true);
27660
- var version = "2.0.2";
27784
+ var version = "2.1.0-alpha.0";
27661
27785
  logger.info("Core version: " + version + ".");
27662
27786
 
27663
- export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Engine, EventEmitter, EventSystem, FilterMode, Float16ArrayWrapper, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, PostProcessVolume, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, SpriteColorPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, decimalEqual, defaultGlobalVolume, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isSceneJSON, isSceneURL, isSceneWithOptions, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemFrameFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
27787
+ export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, DEFAULT_FPS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Engine, EventEmitter, EventSystem, FilterMode, Float16ArrayWrapper, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, PostProcessVolume, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, SpriteColorPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, decimalEqual, defaultGlobalVolume, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isSceneJSON, isSceneURL, isSceneWithOptions, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemFrameFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
27664
27788
  //# sourceMappingURL=index.mjs.map