@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/README.md +1 -1
- package/dist/asset-loader.d.ts +0 -1
- package/dist/comp-vfx-item.d.ts +2 -3
- package/dist/components/component.d.ts +27 -20
- package/dist/components/effect-component.d.ts +1 -2
- package/dist/components/post-process-volume.d.ts +1 -1
- package/dist/components/renderer-component.d.ts +2 -13
- package/dist/composition/scene-ticking.d.ts +26 -0
- package/dist/composition.d.ts +3 -23
- package/dist/effects-object.d.ts +0 -1
- package/dist/effects-package.d.ts +0 -1
- package/dist/index.js +364 -239
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +364 -240
- package/dist/index.mjs.map +1 -1
- package/dist/plugins/cal/calculate-item.d.ts +0 -1
- package/dist/plugins/cal/calculate-vfx-item.d.ts +0 -2
- package/dist/plugins/cal/playable-graph.d.ts +0 -11
- package/dist/plugins/camera/camera-controller-node.d.ts +1 -1
- package/dist/plugins/interact/interact-item.d.ts +2 -3
- package/dist/plugins/particle/particle-system-renderer.d.ts +2 -3
- package/dist/plugins/particle/particle-system.d.ts +2 -6
- package/dist/plugins/particle/particle-vfx-item.d.ts +0 -1
- package/dist/plugins/sprite/sprite-item.d.ts +5 -3
- package/dist/plugins/text/text-item.d.ts +1 -2
- package/dist/plugins/timeline/track.d.ts +0 -3
- package/dist/ticker.d.ts +1 -0
- package/dist/vfx-item.d.ts +4 -11
- package/package.json +1 -1
package/dist/index.js
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.
|
|
6
|
+
* Version: v2.1.0-alpha.0
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -4569,7 +4569,6 @@ function getDirectStore(target) {
|
|
|
4569
4569
|
|
|
4570
4570
|
/**
|
|
4571
4571
|
* @since 2.0.0
|
|
4572
|
-
* @internal
|
|
4573
4572
|
*/ var EffectsObject = /*#__PURE__*/ function() {
|
|
4574
4573
|
function EffectsObject(engine) {
|
|
4575
4574
|
this.engine = engine;
|
|
@@ -4605,92 +4604,112 @@ function getDirectStore(target) {
|
|
|
4605
4604
|
|
|
4606
4605
|
/**
|
|
4607
4606
|
* @since 2.0.0
|
|
4608
|
-
* @internal
|
|
4609
4607
|
*/ var Component = /*#__PURE__*/ function(EffectsObject) {
|
|
4610
4608
|
_inherits(Component, EffectsObject);
|
|
4611
4609
|
function Component() {
|
|
4612
|
-
return EffectsObject.apply(this, arguments);
|
|
4613
|
-
}
|
|
4614
|
-
var _proto = Component.prototype;
|
|
4615
|
-
_proto.onAttached = function onAttached() {};
|
|
4616
|
-
_proto.onDestroy = function onDestroy() {};
|
|
4617
|
-
_proto.fromData = function fromData(data) {
|
|
4618
|
-
EffectsObject.prototype.fromData.call(this, data);
|
|
4619
|
-
if (data.item) {
|
|
4620
|
-
this.item = data.item;
|
|
4621
|
-
}
|
|
4622
|
-
};
|
|
4623
|
-
_proto.dispose = function dispose() {
|
|
4624
|
-
this.onDestroy();
|
|
4625
|
-
if (this.item) {
|
|
4626
|
-
removeItem(this.item.components, this);
|
|
4627
|
-
}
|
|
4628
|
-
};
|
|
4629
|
-
_create_class(Component, [
|
|
4630
|
-
{
|
|
4631
|
-
key: "transform",
|
|
4632
|
-
get: /**
|
|
4633
|
-
* 附加到的 VFXItem 对象 Transform 组件
|
|
4634
|
-
*/ function get() {
|
|
4635
|
-
return this.item.transform;
|
|
4636
|
-
}
|
|
4637
|
-
}
|
|
4638
|
-
]);
|
|
4639
|
-
return Component;
|
|
4640
|
-
}(EffectsObject);
|
|
4641
|
-
/**
|
|
4642
|
-
* @since 2.0.0
|
|
4643
|
-
* @internal
|
|
4644
|
-
*/ var Behaviour = /*#__PURE__*/ function(Component) {
|
|
4645
|
-
_inherits(Behaviour, Component);
|
|
4646
|
-
function Behaviour() {
|
|
4647
4610
|
var _this;
|
|
4648
|
-
_this =
|
|
4611
|
+
_this = EffectsObject.apply(this, arguments) || this;
|
|
4649
4612
|
_this.isAwakeCalled = false;
|
|
4650
4613
|
_this.isStartCalled = false;
|
|
4614
|
+
_this.isEnableCalled = false;
|
|
4651
4615
|
_this._enabled = true;
|
|
4652
4616
|
return _this;
|
|
4653
4617
|
}
|
|
4654
|
-
var _proto =
|
|
4618
|
+
var _proto = Component.prototype;
|
|
4655
4619
|
/**
|
|
4656
4620
|
* 生命周期函数,初始化后调用,生命周期内只调用一次
|
|
4657
|
-
*/ _proto.
|
|
4621
|
+
*/ _proto.onAwake = function onAwake() {
|
|
4658
4622
|
// OVERRIDE
|
|
4659
4623
|
};
|
|
4660
4624
|
/**
|
|
4661
|
-
*
|
|
4625
|
+
* 在 enabled 变为 true 时触发
|
|
4662
4626
|
*/ _proto.onEnable = function onEnable() {
|
|
4663
4627
|
// OVERRIDE
|
|
4664
4628
|
};
|
|
4665
4629
|
/**
|
|
4630
|
+
* 在 enabled 变为 false 时触发
|
|
4631
|
+
*/ _proto.onDisable = function onDisable() {
|
|
4632
|
+
// OVERRIDE
|
|
4633
|
+
};
|
|
4634
|
+
/**
|
|
4666
4635
|
* 生命周期函数,在第一次 update 前调用,生命周期内只调用一次
|
|
4667
|
-
*/ _proto.
|
|
4636
|
+
*/ _proto.onStart = function onStart() {
|
|
4668
4637
|
// OVERRIDE
|
|
4669
4638
|
};
|
|
4670
4639
|
/**
|
|
4671
4640
|
* 生命周期函数,每帧调用一次
|
|
4672
|
-
*/ _proto.
|
|
4641
|
+
*/ _proto.onUpdate = function onUpdate(dt) {
|
|
4673
4642
|
// OVERRIDE
|
|
4674
4643
|
};
|
|
4675
4644
|
/**
|
|
4676
4645
|
* 生命周期函数,每帧调用一次,在 update 之后调用
|
|
4677
|
-
*/ _proto.
|
|
4646
|
+
*/ _proto.onLateUpdate = function onLateUpdate(dt) {
|
|
4647
|
+
// OVERRIDE
|
|
4648
|
+
};
|
|
4649
|
+
/**
|
|
4650
|
+
* 生命周期函数,在组件销毁时调用
|
|
4651
|
+
*/ _proto.onDestroy = function onDestroy() {
|
|
4678
4652
|
// OVERRIDE
|
|
4679
4653
|
};
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
this.
|
|
4654
|
+
/**
|
|
4655
|
+
* @internal
|
|
4656
|
+
*/ _proto.enable = function enable() {
|
|
4657
|
+
if (this.item.composition) {
|
|
4658
|
+
this.item.composition.sceneTicking.addComponent(this);
|
|
4659
|
+
this.isEnableCalled = true;
|
|
4660
|
+
}
|
|
4661
|
+
this.onEnable();
|
|
4662
|
+
};
|
|
4663
|
+
/**
|
|
4664
|
+
* @internal
|
|
4665
|
+
*/ _proto.disable = function disable() {
|
|
4666
|
+
this.onDisable();
|
|
4667
|
+
if (this.item.composition) {
|
|
4668
|
+
this.isEnableCalled = false;
|
|
4669
|
+
this.item.composition.sceneTicking.removeComponent(this);
|
|
4670
|
+
}
|
|
4671
|
+
};
|
|
4672
|
+
_proto.setVFXItem = function setVFXItem(item) {
|
|
4673
|
+
this.item = item;
|
|
4674
|
+
if (item.isDuringPlay) {
|
|
4675
|
+
if (!this.isAwakeCalled) {
|
|
4676
|
+
this.onAwake();
|
|
4677
|
+
this.isAwakeCalled = true;
|
|
4678
|
+
}
|
|
4679
|
+
if (item.getVisible() && this.enabled) {
|
|
4680
|
+
this.start();
|
|
4681
|
+
this.enable();
|
|
4682
|
+
}
|
|
4683
|
+
}
|
|
4684
|
+
};
|
|
4685
|
+
_proto.fromData = function fromData(data) {
|
|
4686
|
+
EffectsObject.prototype.fromData.call(this, data);
|
|
4687
|
+
if (data.item) {
|
|
4688
|
+
this.item = data.item;
|
|
4685
4689
|
}
|
|
4686
4690
|
};
|
|
4687
4691
|
_proto.dispose = function dispose() {
|
|
4692
|
+
this.onDestroy();
|
|
4688
4693
|
if (this.item) {
|
|
4689
|
-
removeItem(this.item.
|
|
4694
|
+
removeItem(this.item.components, this);
|
|
4690
4695
|
}
|
|
4691
|
-
Component.prototype.dispose.call(this);
|
|
4692
4696
|
};
|
|
4693
|
-
|
|
4697
|
+
_proto.start = function start() {
|
|
4698
|
+
if (this.isStartCalled) {
|
|
4699
|
+
return;
|
|
4700
|
+
}
|
|
4701
|
+
this.isStartCalled = true;
|
|
4702
|
+
this.onStart();
|
|
4703
|
+
};
|
|
4704
|
+
_create_class(Component, [
|
|
4705
|
+
{
|
|
4706
|
+
key: "transform",
|
|
4707
|
+
get: /**
|
|
4708
|
+
* 附加到的 VFXItem 对象 Transform 组件
|
|
4709
|
+
*/ function get() {
|
|
4710
|
+
return this.item.transform;
|
|
4711
|
+
}
|
|
4712
|
+
},
|
|
4694
4713
|
{
|
|
4695
4714
|
key: "isActiveAndEnabled",
|
|
4696
4715
|
get: /**
|
|
@@ -4705,24 +4724,46 @@ function getDirectStore(target) {
|
|
|
4705
4724
|
return this._enabled;
|
|
4706
4725
|
},
|
|
4707
4726
|
set: function set(value) {
|
|
4708
|
-
this.
|
|
4709
|
-
|
|
4710
|
-
if (
|
|
4711
|
-
this.
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4727
|
+
if (this.enabled !== value) {
|
|
4728
|
+
this._enabled = value;
|
|
4729
|
+
if (value) {
|
|
4730
|
+
if (this.isActiveAndEnabled) {
|
|
4731
|
+
this.enable();
|
|
4732
|
+
if (!this.isStartCalled) {
|
|
4733
|
+
this.onStart();
|
|
4734
|
+
this.isStartCalled = true;
|
|
4735
|
+
}
|
|
4736
|
+
}
|
|
4737
|
+
} else {
|
|
4738
|
+
if (this.isEnableCalled) {
|
|
4739
|
+
this.disable();
|
|
4740
|
+
}
|
|
4716
4741
|
}
|
|
4717
4742
|
}
|
|
4718
4743
|
}
|
|
4719
4744
|
}
|
|
4720
4745
|
]);
|
|
4721
|
-
return
|
|
4722
|
-
}(
|
|
4746
|
+
return Component;
|
|
4747
|
+
}(EffectsObject);
|
|
4723
4748
|
__decorate([
|
|
4724
4749
|
serialize()
|
|
4725
|
-
],
|
|
4750
|
+
], Component.prototype, "_enabled", void 0);
|
|
4751
|
+
/**
|
|
4752
|
+
* @since 2.0.0
|
|
4753
|
+
*/ var Behaviour = /*#__PURE__*/ function(Component) {
|
|
4754
|
+
_inherits(Behaviour, Component);
|
|
4755
|
+
function Behaviour() {
|
|
4756
|
+
return Component.apply(this, arguments);
|
|
4757
|
+
}
|
|
4758
|
+
var _proto = Behaviour.prototype;
|
|
4759
|
+
_proto.setVFXItem = function setVFXItem(item) {
|
|
4760
|
+
Component.prototype.setVFXItem.call(this, item);
|
|
4761
|
+
};
|
|
4762
|
+
_proto.dispose = function dispose() {
|
|
4763
|
+
Component.prototype.dispose.call(this);
|
|
4764
|
+
};
|
|
4765
|
+
return Behaviour;
|
|
4766
|
+
}(Component);
|
|
4726
4767
|
|
|
4727
4768
|
/**
|
|
4728
4769
|
* 所有渲染组件的基类
|
|
@@ -4732,19 +4773,14 @@ __decorate([
|
|
|
4732
4773
|
function RendererComponent() {
|
|
4733
4774
|
var _this;
|
|
4734
4775
|
_this = Component.apply(this, arguments) || this;
|
|
4735
|
-
_this.isStartCalled = false;
|
|
4736
4776
|
_this.materials = [];
|
|
4737
4777
|
_this._priority = 0;
|
|
4738
|
-
_this._enabled = true;
|
|
4739
4778
|
return _this;
|
|
4740
4779
|
}
|
|
4741
4780
|
var _proto = RendererComponent.prototype;
|
|
4742
|
-
_proto.onEnable = function onEnable() {};
|
|
4743
|
-
_proto.start = function start() {};
|
|
4744
|
-
_proto.update = function update(dt) {};
|
|
4745
|
-
_proto.lateUpdate = function lateUpdate(dt) {};
|
|
4746
4781
|
_proto.render = function render(renderer) {};
|
|
4747
|
-
_proto.
|
|
4782
|
+
_proto.setVFXItem = function setVFXItem(item) {
|
|
4783
|
+
Component.prototype.setVFXItem.call(this, item);
|
|
4748
4784
|
this.item.rendererComponents.push(this);
|
|
4749
4785
|
};
|
|
4750
4786
|
_proto.fromData = function fromData(data) {
|
|
@@ -4769,26 +4805,6 @@ __decorate([
|
|
|
4769
4805
|
this._priority = value;
|
|
4770
4806
|
}
|
|
4771
4807
|
},
|
|
4772
|
-
{
|
|
4773
|
-
key: "enabled",
|
|
4774
|
-
get: function get() {
|
|
4775
|
-
return this._enabled;
|
|
4776
|
-
},
|
|
4777
|
-
set: function set(value) {
|
|
4778
|
-
this._enabled = value;
|
|
4779
|
-
if (value) {
|
|
4780
|
-
this.onEnable();
|
|
4781
|
-
}
|
|
4782
|
-
}
|
|
4783
|
-
},
|
|
4784
|
-
{
|
|
4785
|
-
key: "isActiveAndEnabled",
|
|
4786
|
-
get: /**
|
|
4787
|
-
* 组件是否可以更新,true 更新,false 不更新
|
|
4788
|
-
*/ function get() {
|
|
4789
|
-
return this.item.getVisible() && this.enabled;
|
|
4790
|
-
}
|
|
4791
|
-
},
|
|
4792
4808
|
{
|
|
4793
4809
|
key: "material",
|
|
4794
4810
|
get: function get() {
|
|
@@ -4811,9 +4827,6 @@ __decorate([
|
|
|
4811
4827
|
__decorate([
|
|
4812
4828
|
serialize()
|
|
4813
4829
|
], RendererComponent.prototype, "_priority", void 0);
|
|
4814
|
-
__decorate([
|
|
4815
|
-
serialize()
|
|
4816
|
-
], RendererComponent.prototype, "_enabled", void 0);
|
|
4817
4830
|
|
|
4818
4831
|
/**
|
|
4819
4832
|
* 抽象插件类
|
|
@@ -4857,7 +4870,7 @@ exports.CameraController = /*#__PURE__*/ function(Behaviour) {
|
|
|
4857
4870
|
return _this;
|
|
4858
4871
|
}
|
|
4859
4872
|
var _proto = CameraController.prototype;
|
|
4860
|
-
_proto.
|
|
4873
|
+
_proto.onUpdate = function onUpdate() {
|
|
4861
4874
|
if (this.item.composition && this.item.transform.getValid()) {
|
|
4862
4875
|
var camera = this.item.composition.camera;
|
|
4863
4876
|
camera.near = this.options.near;
|
|
@@ -8089,7 +8102,7 @@ function _loadVideo() {
|
|
|
8089
8102
|
}, true);
|
|
8090
8103
|
}
|
|
8091
8104
|
video.addEventListener("error", function(e) {
|
|
8092
|
-
reject(
|
|
8105
|
+
reject("Load video fail.");
|
|
8093
8106
|
});
|
|
8094
8107
|
})
|
|
8095
8108
|
];
|
|
@@ -13255,7 +13268,7 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13255
13268
|
return _this;
|
|
13256
13269
|
}
|
|
13257
13270
|
var _proto = InteractComponent.prototype;
|
|
13258
|
-
_proto.
|
|
13271
|
+
_proto.onStart = function onStart() {
|
|
13259
13272
|
var _this = this;
|
|
13260
13273
|
var options = this.item.props.content.options;
|
|
13261
13274
|
var env = this.item.engine.renderer.env;
|
|
@@ -13291,8 +13304,11 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13291
13304
|
}
|
|
13292
13305
|
};
|
|
13293
13306
|
};
|
|
13294
|
-
_proto.
|
|
13307
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
13295
13308
|
var _this_previewContent;
|
|
13309
|
+
if (!this.isActiveAndEnabled) {
|
|
13310
|
+
return;
|
|
13311
|
+
}
|
|
13296
13312
|
(_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.updateMesh();
|
|
13297
13313
|
if (!this.hasBeenAddedToComposition && this.item.composition) {
|
|
13298
13314
|
var options = this.item.props.content.options;
|
|
@@ -13563,7 +13579,6 @@ function _assert_this_initialized(self) {
|
|
|
13563
13579
|
/**
|
|
13564
13580
|
* 动画图,负责更新所有的动画节点
|
|
13565
13581
|
* @since 2.0.0
|
|
13566
|
-
* @internal
|
|
13567
13582
|
*/ var PlayableGraph = /*#__PURE__*/ function() {
|
|
13568
13583
|
function PlayableGraph() {
|
|
13569
13584
|
this.playableOutputs = [];
|
|
@@ -13623,7 +13638,6 @@ function _assert_this_initialized(self) {
|
|
|
13623
13638
|
/**
|
|
13624
13639
|
* 动画图可播放节点对象
|
|
13625
13640
|
* @since 2.0.0
|
|
13626
|
-
* @internal
|
|
13627
13641
|
*/ var Playable = /*#__PURE__*/ function() {
|
|
13628
13642
|
function Playable(graph, inputCount) {
|
|
13629
13643
|
if (inputCount === void 0) inputCount = 0;
|
|
@@ -13637,6 +13651,9 @@ function _assert_this_initialized(self) {
|
|
|
13637
13651
|
this.outputs = [];
|
|
13638
13652
|
this.playState = 0;
|
|
13639
13653
|
this.traversalMode = 0;
|
|
13654
|
+
/**
|
|
13655
|
+
* 当前本地播放的时间
|
|
13656
|
+
*/ this.time = 0;
|
|
13640
13657
|
graph.addPlayable(this);
|
|
13641
13658
|
this.inputs = new Array(inputCount);
|
|
13642
13659
|
this.inputOuputPorts = new Array(inputCount);
|
|
@@ -13821,7 +13838,6 @@ function _assert_this_initialized(self) {
|
|
|
13821
13838
|
/**
|
|
13822
13839
|
* 动画图输出节点对象,将动画数据采样到绑定的元素属性上
|
|
13823
13840
|
* @since 2.0.0
|
|
13824
|
-
* @internal
|
|
13825
13841
|
*/ var PlayableOutput = /*#__PURE__*/ function() {
|
|
13826
13842
|
function PlayableOutput() {
|
|
13827
13843
|
this.sourceOutputPort = 0;
|
|
@@ -13904,13 +13920,17 @@ var SpriteColorPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
13904
13920
|
if (!_instanceof1(boundObject, exports.VFXItem)) {
|
|
13905
13921
|
return;
|
|
13906
13922
|
}
|
|
13923
|
+
if (!this.spriteComponent) {
|
|
13924
|
+
this.spriteComponent = boundObject.getComponent(exports.SpriteComponent);
|
|
13925
|
+
}
|
|
13907
13926
|
if (!this.spriteMaterial) {
|
|
13908
|
-
this.spriteMaterial =
|
|
13927
|
+
this.spriteMaterial = this.spriteComponent.material;
|
|
13909
13928
|
var startColor = this.spriteMaterial.getVector4("_Color");
|
|
13910
13929
|
if (startColor) {
|
|
13911
13930
|
this.startColor = startColor.toArray();
|
|
13912
13931
|
}
|
|
13913
13932
|
}
|
|
13933
|
+
this.spriteComponent.setAnimationTime(this.time);
|
|
13914
13934
|
var colorInc = vecFill(tempColor, 1);
|
|
13915
13935
|
var colorChanged;
|
|
13916
13936
|
var life = this.time / boundObject.duration;
|
|
@@ -13970,7 +13990,6 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13970
13990
|
_this = RendererComponent.call(this, engine) || this;
|
|
13971
13991
|
_this.cachePrefix = "-";
|
|
13972
13992
|
_this.frameAnimationLoop = false;
|
|
13973
|
-
_this.frameAnimationTime = 0;
|
|
13974
13993
|
_this.color = [
|
|
13975
13994
|
1,
|
|
13976
13995
|
1,
|
|
@@ -13978,6 +13997,8 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13978
13997
|
1
|
|
13979
13998
|
];
|
|
13980
13999
|
_this.visible = true;
|
|
14000
|
+
_this.isManualTimeSet = false;
|
|
14001
|
+
_this.frameAnimationTime = 0;
|
|
13981
14002
|
_this.getHitTestParams = function(force) {
|
|
13982
14003
|
var ui = _this.interaction;
|
|
13983
14004
|
if (force || ui) {
|
|
@@ -14060,6 +14081,12 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
14060
14081
|
this.renderer.texture = texture;
|
|
14061
14082
|
this.material.setTexture("uSampler0", texture);
|
|
14062
14083
|
};
|
|
14084
|
+
/**
|
|
14085
|
+
* @internal
|
|
14086
|
+
*/ _proto.setAnimationTime = function setAnimationTime(time) {
|
|
14087
|
+
this.frameAnimationTime = time;
|
|
14088
|
+
this.isManualTimeSet = true;
|
|
14089
|
+
};
|
|
14063
14090
|
_proto.render = function render(renderer) {
|
|
14064
14091
|
if (!this.getVisible()) {
|
|
14065
14092
|
return;
|
|
@@ -14072,14 +14099,14 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
14072
14099
|
this.material.setVector2("_Size", this.transform.size);
|
|
14073
14100
|
renderer.drawGeometry(geo, material);
|
|
14074
14101
|
};
|
|
14075
|
-
_proto.
|
|
14102
|
+
_proto.onStart = function onStart() {
|
|
14076
14103
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
14077
|
-
if (this.item.endBehavior === EndBehavior.restart) {
|
|
14078
|
-
this.frameAnimationLoop = true;
|
|
14079
|
-
}
|
|
14080
14104
|
};
|
|
14081
|
-
_proto.
|
|
14082
|
-
this.
|
|
14105
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
14106
|
+
if (!this.isManualTimeSet) {
|
|
14107
|
+
this.frameAnimationTime += dt / 1000;
|
|
14108
|
+
this.isManualTimeSet = false;
|
|
14109
|
+
}
|
|
14083
14110
|
var time = this.frameAnimationTime;
|
|
14084
14111
|
var duration = this.item.duration;
|
|
14085
14112
|
if (time > duration && this.frameAnimationLoop) {
|
|
@@ -16474,7 +16501,6 @@ function getTrailMeshShader(trails, particleMaxCount, name, gpuCapability, env)
|
|
|
16474
16501
|
|
|
16475
16502
|
/**
|
|
16476
16503
|
* @since 2.0.0
|
|
16477
|
-
* @internal
|
|
16478
16504
|
*/ var ParticleSystemRenderer = /*#__PURE__*/ function(RendererComponent) {
|
|
16479
16505
|
_inherits(ParticleSystemRenderer, RendererComponent);
|
|
16480
16506
|
function ParticleSystemRenderer(engine, particleMeshProps, trailMeshProps) {
|
|
@@ -16499,15 +16525,15 @@ function getTrailMeshShader(trails, particleMaxCount, name, gpuCapability, env)
|
|
|
16499
16525
|
return _this;
|
|
16500
16526
|
}
|
|
16501
16527
|
var _proto = ParticleSystemRenderer.prototype;
|
|
16502
|
-
_proto.
|
|
16528
|
+
_proto.onStart = function onStart() {
|
|
16503
16529
|
this._priority = this.item.renderOrder;
|
|
16504
16530
|
this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);
|
|
16505
16531
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.meshes), _step; !(_step = _iterator()).done;){
|
|
16506
16532
|
var mesh = _step.value;
|
|
16507
|
-
mesh.
|
|
16533
|
+
mesh.onStart();
|
|
16508
16534
|
}
|
|
16509
16535
|
};
|
|
16510
|
-
_proto.
|
|
16536
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
16511
16537
|
var time = this.particleMesh.time;
|
|
16512
16538
|
this.particleMesh.mesh.material.setVector4("uParams", new Vector4(time, this.item.duration, 0, 0));
|
|
16513
16539
|
};
|
|
@@ -16731,7 +16757,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16731
16757
|
_proto.getTextures = function getTextures() {
|
|
16732
16758
|
return this.renderer.getTextures();
|
|
16733
16759
|
};
|
|
16734
|
-
_proto.
|
|
16760
|
+
_proto.startEmit = function startEmit() {
|
|
16735
16761
|
if (!this.started || this.ended) {
|
|
16736
16762
|
this.reset();
|
|
16737
16763
|
this.started = true;
|
|
@@ -16757,7 +16783,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16757
16783
|
this.frozen = false;
|
|
16758
16784
|
this.ended = false;
|
|
16759
16785
|
};
|
|
16760
|
-
_proto.
|
|
16786
|
+
_proto.update = function update(delta) {
|
|
16761
16787
|
var _this = this;
|
|
16762
16788
|
if (this.started && !this.frozen) {
|
|
16763
16789
|
var now = this.lastUpdate + delta / 1000;
|
|
@@ -17540,7 +17566,6 @@ function randomArrItem(arr, keepArr) {
|
|
|
17540
17566
|
|
|
17541
17567
|
/**
|
|
17542
17568
|
* @since 2.0.0
|
|
17543
|
-
* @internal
|
|
17544
17569
|
*/ var ParticleBehaviourPlayable = /*#__PURE__*/ function(Playable) {
|
|
17545
17570
|
_inherits(ParticleBehaviourPlayable, Playable);
|
|
17546
17571
|
function ParticleBehaviourPlayable() {
|
|
@@ -17558,7 +17583,7 @@ function randomArrItem(arr, keepArr) {
|
|
|
17558
17583
|
this.particleSystem = boundObject.getComponent(exports.ParticleSystem);
|
|
17559
17584
|
if (this.particleSystem) {
|
|
17560
17585
|
this.particleSystem.name = boundObject.name;
|
|
17561
|
-
this.particleSystem.
|
|
17586
|
+
this.particleSystem.startEmit();
|
|
17562
17587
|
this.particleSystem.initEmitterTransform();
|
|
17563
17588
|
}
|
|
17564
17589
|
};
|
|
@@ -17578,7 +17603,7 @@ function randomArrItem(arr, keepArr) {
|
|
|
17578
17603
|
if (Math.abs(this.time - this.lastTime) < 0.001) {
|
|
17579
17604
|
deltaTime = 0;
|
|
17580
17605
|
}
|
|
17581
|
-
particleSystem.
|
|
17606
|
+
particleSystem.update(deltaTime);
|
|
17582
17607
|
}
|
|
17583
17608
|
this.lastTime = this.time;
|
|
17584
17609
|
};
|
|
@@ -18600,7 +18625,6 @@ var tempSize = new Vector3(1, 1, 1);
|
|
|
18600
18625
|
var tempPos = new Vector3();
|
|
18601
18626
|
/**
|
|
18602
18627
|
* @since 2.0.0
|
|
18603
|
-
* @internal
|
|
18604
18628
|
*/ var TransformAnimationPlayable = /*#__PURE__*/ function(AnimationPlayable) {
|
|
18605
18629
|
_inherits(TransformAnimationPlayable, AnimationPlayable);
|
|
18606
18630
|
function TransformAnimationPlayable() {
|
|
@@ -18762,7 +18786,6 @@ exports.TransformPlayableAsset = __decorate([
|
|
|
18762
18786
|
], exports.TransformPlayableAsset);
|
|
18763
18787
|
/**
|
|
18764
18788
|
* @since 2.0.0
|
|
18765
|
-
* @internal
|
|
18766
18789
|
*/ var ActivationPlayable = /*#__PURE__*/ function(Playable) {
|
|
18767
18790
|
_inherits(ActivationPlayable, Playable);
|
|
18768
18791
|
function ActivationPlayable() {
|
|
@@ -18913,7 +18936,6 @@ var AnimationClipPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
18913
18936
|
|
|
18914
18937
|
/**
|
|
18915
18938
|
* @since 2.0.0
|
|
18916
|
-
* @internal
|
|
18917
18939
|
*/ var TimelineClip = /*#__PURE__*/ function() {
|
|
18918
18940
|
function TimelineClip() {
|
|
18919
18941
|
this.start = 0;
|
|
@@ -19311,25 +19333,15 @@ var TrackSortWrapper = function TrackSortWrapper(track, originalIndex) {
|
|
|
19311
19333
|
this.track = track;
|
|
19312
19334
|
this.originalIndex = originalIndex;
|
|
19313
19335
|
};
|
|
19314
|
-
function isAncestor(ancestorCandidate, descendantCandidate) {
|
|
19315
|
-
var current = descendantCandidate.parent;
|
|
19316
|
-
while(current){
|
|
19317
|
-
if (current === ancestorCandidate) {
|
|
19318
|
-
return true;
|
|
19319
|
-
}
|
|
19320
|
-
current = current.parent;
|
|
19321
|
-
}
|
|
19322
|
-
return false;
|
|
19323
|
-
}
|
|
19324
19336
|
function compareTracks(a, b) {
|
|
19325
19337
|
var bindingA = a.track.binding;
|
|
19326
19338
|
var bindingB = b.track.binding;
|
|
19327
19339
|
if (!_instanceof1(bindingA, exports.VFXItem) || !_instanceof1(bindingB, exports.VFXItem)) {
|
|
19328
19340
|
return a.originalIndex - b.originalIndex;
|
|
19329
19341
|
}
|
|
19330
|
-
if (isAncestor(bindingA, bindingB)) {
|
|
19342
|
+
if (exports.VFXItem.isAncestor(bindingA, bindingB)) {
|
|
19331
19343
|
return -1;
|
|
19332
|
-
} else if (isAncestor(bindingB, bindingA)) {
|
|
19344
|
+
} else if (exports.VFXItem.isAncestor(bindingB, bindingA)) {
|
|
19333
19345
|
return 1;
|
|
19334
19346
|
} else {
|
|
19335
19347
|
return a.originalIndex - b.originalIndex; // 非父子关系的元素保持原始顺序
|
|
@@ -19338,7 +19350,6 @@ function compareTracks(a, b) {
|
|
|
19338
19350
|
|
|
19339
19351
|
/**
|
|
19340
19352
|
* @since 2.0.0
|
|
19341
|
-
* @internal
|
|
19342
19353
|
*/ var CompositionComponent = /*#__PURE__*/ function(Behaviour) {
|
|
19343
19354
|
_inherits(CompositionComponent, Behaviour);
|
|
19344
19355
|
function CompositionComponent() {
|
|
@@ -19354,7 +19365,7 @@ function compareTracks(a, b) {
|
|
|
19354
19365
|
return _this;
|
|
19355
19366
|
}
|
|
19356
19367
|
var _proto = CompositionComponent.prototype;
|
|
19357
|
-
_proto.
|
|
19368
|
+
_proto.onStart = function onStart() {
|
|
19358
19369
|
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;
|
|
19359
19370
|
this.startTime = startTime;
|
|
19360
19371
|
this.resolveBindings();
|
|
@@ -19382,7 +19393,7 @@ function compareTracks(a, b) {
|
|
|
19382
19393
|
_proto.getReusable = function getReusable() {
|
|
19383
19394
|
return this.reusable;
|
|
19384
19395
|
};
|
|
19385
|
-
_proto.
|
|
19396
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
19386
19397
|
var time = this.time;
|
|
19387
19398
|
this.timelinePlayable.setTime(time);
|
|
19388
19399
|
this.graph.evaluate(dt);
|
|
@@ -19418,7 +19429,9 @@ function compareTracks(a, b) {
|
|
|
19418
19429
|
props.content = itemData.content;
|
|
19419
19430
|
item = assetLoader.loadGUID(itemData.id);
|
|
19420
19431
|
item.composition = this.item.composition;
|
|
19421
|
-
var compositionComponent =
|
|
19432
|
+
var compositionComponent = new CompositionComponent(this.engine);
|
|
19433
|
+
compositionComponent.item = item;
|
|
19434
|
+
item.components.push(compositionComponent);
|
|
19422
19435
|
compositionComponent.data = props;
|
|
19423
19436
|
compositionComponent.refId = refId;
|
|
19424
19437
|
item.transform.parentTransform = this.transform;
|
|
@@ -19829,8 +19842,8 @@ exports.TextComponent = /*#__PURE__*/ function(SpriteComponent) {
|
|
|
19829
19842
|
return _this;
|
|
19830
19843
|
}
|
|
19831
19844
|
var _proto = TextComponent.prototype;
|
|
19832
|
-
_proto.
|
|
19833
|
-
SpriteComponent.prototype.
|
|
19845
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
19846
|
+
SpriteComponent.prototype.onUpdate.call(this, dt);
|
|
19834
19847
|
this.updateTexture();
|
|
19835
19848
|
};
|
|
19836
19849
|
_proto.fromData = function fromData(data) {
|
|
@@ -20245,7 +20258,7 @@ exports.EffectComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
20245
20258
|
return _this;
|
|
20246
20259
|
}
|
|
20247
20260
|
var _proto = EffectComponent.prototype;
|
|
20248
|
-
_proto.
|
|
20261
|
+
_proto.onStart = function onStart() {
|
|
20249
20262
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
20250
20263
|
};
|
|
20251
20264
|
_proto.render = function render(renderer) {
|
|
@@ -20372,7 +20385,7 @@ exports.PostProcessVolume = /*#__PURE__*/ function(Behaviour) {
|
|
|
20372
20385
|
return _this;
|
|
20373
20386
|
}
|
|
20374
20387
|
var _proto = PostProcessVolume.prototype;
|
|
20375
|
-
_proto.
|
|
20388
|
+
_proto.onStart = function onStart() {
|
|
20376
20389
|
var composition = this.item.composition;
|
|
20377
20390
|
if (composition) {
|
|
20378
20391
|
composition.globalVolume = this;
|
|
@@ -20514,8 +20527,8 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20514
20527
|
*/ _this.ended = false;
|
|
20515
20528
|
_this.reusable = false;
|
|
20516
20529
|
_this.type = ItemType.base;
|
|
20530
|
+
_this.isDuringPlay = false;
|
|
20517
20531
|
_this.components = [];
|
|
20518
|
-
_this.itemBehaviours = [];
|
|
20519
20532
|
_this.rendererComponents = [];
|
|
20520
20533
|
/**
|
|
20521
20534
|
* 元素可见性,该值的改变会触发 `handleVisibleChanged` 回调
|
|
@@ -20525,6 +20538,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20525
20538
|
* 元素动画的速度
|
|
20526
20539
|
*/ _this.speed = 1;
|
|
20527
20540
|
_this.listIndex = 0;
|
|
20541
|
+
_this.isEnabled = false;
|
|
20528
20542
|
_this.eventProcessor = new EventEmitter();
|
|
20529
20543
|
_this.name = "VFXItem";
|
|
20530
20544
|
_this.transform.name = _this.name;
|
|
@@ -20597,8 +20611,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20597
20611
|
*/ _proto.addComponent = function addComponent(classConstructor) {
|
|
20598
20612
|
var newComponent = new classConstructor(this.engine);
|
|
20599
20613
|
this.components.push(newComponent);
|
|
20600
|
-
newComponent.
|
|
20601
|
-
newComponent.onAttached();
|
|
20614
|
+
newComponent.setVFXItem(this);
|
|
20602
20615
|
return newComponent;
|
|
20603
20616
|
};
|
|
20604
20617
|
/**
|
|
@@ -20631,21 +20644,22 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20631
20644
|
return res;
|
|
20632
20645
|
};
|
|
20633
20646
|
_proto.setParent = function setParent(vfxItem) {
|
|
20634
|
-
if (vfxItem === this) {
|
|
20647
|
+
if (vfxItem === this && !vfxItem) {
|
|
20635
20648
|
return;
|
|
20636
20649
|
}
|
|
20637
20650
|
if (this.parent) {
|
|
20638
20651
|
removeItem(this.parent.children, this);
|
|
20639
20652
|
}
|
|
20640
20653
|
this.parent = vfxItem;
|
|
20641
|
-
if (
|
|
20642
|
-
|
|
20643
|
-
|
|
20644
|
-
|
|
20645
|
-
|
|
20646
|
-
|
|
20647
|
-
|
|
20648
|
-
|
|
20654
|
+
if (!VFXItem.isCamera(this)) {
|
|
20655
|
+
this.transform.parentTransform = vfxItem.transform;
|
|
20656
|
+
}
|
|
20657
|
+
vfxItem.children.push(this);
|
|
20658
|
+
if (!this.composition) {
|
|
20659
|
+
this.composition = vfxItem.composition;
|
|
20660
|
+
}
|
|
20661
|
+
if (!this.isDuringPlay && vfxItem.isDuringPlay) {
|
|
20662
|
+
this.beginPlay();
|
|
20649
20663
|
}
|
|
20650
20664
|
};
|
|
20651
20665
|
/**
|
|
@@ -20676,6 +20690,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20676
20690
|
*/ _proto.setVisible = function setVisible(visible) {
|
|
20677
20691
|
if (this.visible !== visible) {
|
|
20678
20692
|
this.visible = !!visible;
|
|
20693
|
+
this.onActiveChanged();
|
|
20679
20694
|
}
|
|
20680
20695
|
};
|
|
20681
20696
|
/**
|
|
@@ -20800,6 +20815,57 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20800
20815
|
}
|
|
20801
20816
|
return undefined;
|
|
20802
20817
|
};
|
|
20818
|
+
/**
|
|
20819
|
+
* @internal
|
|
20820
|
+
*/ _proto.beginPlay = function beginPlay() {
|
|
20821
|
+
this.isDuringPlay = true;
|
|
20822
|
+
if (this.composition && this.visible && !this.isEnabled) {
|
|
20823
|
+
this.onEnable();
|
|
20824
|
+
}
|
|
20825
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
20826
|
+
var child = _step.value;
|
|
20827
|
+
if (!child.isDuringPlay) {
|
|
20828
|
+
child.beginPlay();
|
|
20829
|
+
}
|
|
20830
|
+
}
|
|
20831
|
+
};
|
|
20832
|
+
/**
|
|
20833
|
+
* @internal
|
|
20834
|
+
*/ _proto.onActiveChanged = function onActiveChanged() {
|
|
20835
|
+
if (!this.isEnabled) {
|
|
20836
|
+
this.onEnable();
|
|
20837
|
+
} else {
|
|
20838
|
+
this.onDisable();
|
|
20839
|
+
}
|
|
20840
|
+
};
|
|
20841
|
+
/**
|
|
20842
|
+
* @internal
|
|
20843
|
+
*/ _proto.onEnable = function onEnable() {
|
|
20844
|
+
this.isEnabled = true;
|
|
20845
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
20846
|
+
var component = _step.value;
|
|
20847
|
+
if (component.enabled && !component.isStartCalled) {
|
|
20848
|
+
component.onStart();
|
|
20849
|
+
}
|
|
20850
|
+
}
|
|
20851
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.components), _step1; !(_step1 = _iterator1()).done;){
|
|
20852
|
+
var component1 = _step1.value;
|
|
20853
|
+
if (component1.enabled && !component1.isEnableCalled) {
|
|
20854
|
+
component1.enable();
|
|
20855
|
+
}
|
|
20856
|
+
}
|
|
20857
|
+
};
|
|
20858
|
+
/**
|
|
20859
|
+
* @internal
|
|
20860
|
+
*/ _proto.onDisable = function onDisable() {
|
|
20861
|
+
this.isEnabled = false;
|
|
20862
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
20863
|
+
var component = _step.value;
|
|
20864
|
+
if (component.enabled && component.isEnableCalled) {
|
|
20865
|
+
component.disable();
|
|
20866
|
+
}
|
|
20867
|
+
}
|
|
20868
|
+
};
|
|
20803
20869
|
_proto.fromData = function fromData(data) {
|
|
20804
20870
|
EffectsObject.prototype.fromData.call(this, data);
|
|
20805
20871
|
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;
|
|
@@ -20849,14 +20915,10 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20849
20915
|
if (duration <= 0) {
|
|
20850
20916
|
throw new Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"] + ".");
|
|
20851
20917
|
}
|
|
20852
|
-
this.itemBehaviours.length = 0;
|
|
20853
20918
|
this.rendererComponents.length = 0;
|
|
20854
20919
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
20855
20920
|
var component = _step.value;
|
|
20856
20921
|
component.item = this;
|
|
20857
|
-
if (_instanceof1(component, Behaviour)) {
|
|
20858
|
-
this.itemBehaviours.push(component);
|
|
20859
|
-
}
|
|
20860
20922
|
if (_instanceof1(component, RendererComponent)) {
|
|
20861
20923
|
this.rendererComponents.push(component);
|
|
20862
20924
|
}
|
|
@@ -20961,6 +21023,16 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20961
21023
|
VFXItem.isExtraCamera = function isExtraCamera(item) {
|
|
20962
21024
|
return item.id === "extra-camera" && item.name === "extra-camera";
|
|
20963
21025
|
};
|
|
21026
|
+
VFXItem.isAncestor = function isAncestor(ancestorCandidate, descendantCandidate) {
|
|
21027
|
+
var current = descendantCandidate.parent;
|
|
21028
|
+
while(current){
|
|
21029
|
+
if (current === ancestorCandidate) {
|
|
21030
|
+
return true;
|
|
21031
|
+
}
|
|
21032
|
+
current = current.parent;
|
|
21033
|
+
}
|
|
21034
|
+
return false;
|
|
21035
|
+
};
|
|
20964
21036
|
_create_class(VFXItem, [
|
|
20965
21037
|
{
|
|
20966
21038
|
key: "content",
|
|
@@ -21627,7 +21699,6 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
21627
21699
|
|
|
21628
21700
|
/**
|
|
21629
21701
|
* @since 2.0.0
|
|
21630
|
-
* @internal
|
|
21631
21702
|
*/ var AssetLoader = /*#__PURE__*/ function() {
|
|
21632
21703
|
function AssetLoader(engine) {
|
|
21633
21704
|
this.engine = engine;
|
|
@@ -24099,7 +24170,7 @@ var seed = 1;
|
|
|
24099
24170
|
];
|
|
24100
24171
|
case 6:
|
|
24101
24172
|
e = _state.sent();
|
|
24102
|
-
throw new Error("Failed to load. Check the template or if the URL is " + (isVideo ? "video" : "image") + " type, URL: " + url + ", Error: " + e.message + ".");
|
|
24173
|
+
throw new Error("Failed to load. Check the template or if the URL is " + (isVideo ? "video" : "image") + " type, URL: " + url + ", Error: " + (e.message || e) + ".");
|
|
24103
24174
|
case 7:
|
|
24104
24175
|
return [
|
|
24105
24176
|
3,
|
|
@@ -24834,6 +24905,109 @@ var listOrder = 0;
|
|
|
24834
24905
|
return CompositionSourceManager;
|
|
24835
24906
|
}();
|
|
24836
24907
|
|
|
24908
|
+
var SceneTicking = /*#__PURE__*/ function() {
|
|
24909
|
+
function SceneTicking() {
|
|
24910
|
+
this.update = new UpdateTickData();
|
|
24911
|
+
this.lateUpdate = new LateUpdateTickData();
|
|
24912
|
+
}
|
|
24913
|
+
var _proto = SceneTicking.prototype;
|
|
24914
|
+
_proto.addComponent = function addComponent(obj) {
|
|
24915
|
+
if (obj.onUpdate !== Component.prototype.onUpdate) {
|
|
24916
|
+
this.update.addComponent(obj);
|
|
24917
|
+
}
|
|
24918
|
+
if (obj.onLateUpdate !== Component.prototype.onLateUpdate) {
|
|
24919
|
+
this.lateUpdate.addComponent(obj);
|
|
24920
|
+
}
|
|
24921
|
+
};
|
|
24922
|
+
_proto.removeComponent = function removeComponent(obj) {
|
|
24923
|
+
if (obj.onUpdate !== Component.prototype.onUpdate) {
|
|
24924
|
+
this.update.removeComponent(obj);
|
|
24925
|
+
}
|
|
24926
|
+
if (obj.onLateUpdate !== Component.prototype.onLateUpdate) {
|
|
24927
|
+
this.lateUpdate.removeComponent(obj);
|
|
24928
|
+
}
|
|
24929
|
+
};
|
|
24930
|
+
_proto.clear = function clear() {
|
|
24931
|
+
this.update.clear();
|
|
24932
|
+
this.lateUpdate.clear();
|
|
24933
|
+
};
|
|
24934
|
+
return SceneTicking;
|
|
24935
|
+
}();
|
|
24936
|
+
var TickData = /*#__PURE__*/ function() {
|
|
24937
|
+
function TickData() {
|
|
24938
|
+
this.components = [];
|
|
24939
|
+
this.ticks = [];
|
|
24940
|
+
}
|
|
24941
|
+
var _proto = TickData.prototype;
|
|
24942
|
+
_proto.tick = function tick(dt) {
|
|
24943
|
+
this.tickComponents(this.components, dt);
|
|
24944
|
+
for(var i = 0; i < this.ticks.length; i++){
|
|
24945
|
+
this.ticks[i](dt);
|
|
24946
|
+
}
|
|
24947
|
+
};
|
|
24948
|
+
_proto.tickComponents = function tickComponents(components, dt) {
|
|
24949
|
+
// To be implemented in derived classes
|
|
24950
|
+
};
|
|
24951
|
+
_proto.addComponent = function addComponent(component) {
|
|
24952
|
+
if (!this.components.includes(component)) {
|
|
24953
|
+
this.components.push(component);
|
|
24954
|
+
}
|
|
24955
|
+
};
|
|
24956
|
+
_proto.removeComponent = function removeComponent(component) {
|
|
24957
|
+
var index = this.components.indexOf(component);
|
|
24958
|
+
if (index > -1) {
|
|
24959
|
+
this.components.splice(index, 1);
|
|
24960
|
+
}
|
|
24961
|
+
};
|
|
24962
|
+
_proto.addTick = function addTick(method, callee) {
|
|
24963
|
+
var tick = method.bind(callee);
|
|
24964
|
+
if (!this.ticks.includes(tick)) {
|
|
24965
|
+
this.ticks.push(tick);
|
|
24966
|
+
}
|
|
24967
|
+
};
|
|
24968
|
+
_proto.clear = function clear() {
|
|
24969
|
+
this.components = [];
|
|
24970
|
+
};
|
|
24971
|
+
return TickData;
|
|
24972
|
+
}();
|
|
24973
|
+
var UpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
24974
|
+
_inherits(UpdateTickData, TickData);
|
|
24975
|
+
function UpdateTickData() {
|
|
24976
|
+
return TickData.apply(this, arguments);
|
|
24977
|
+
}
|
|
24978
|
+
var _proto = UpdateTickData.prototype;
|
|
24979
|
+
_proto.tickComponents = function tickComponents(components, dt) {
|
|
24980
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(components), _step; !(_step = _iterator()).done;){
|
|
24981
|
+
var component = _step.value;
|
|
24982
|
+
component.onUpdate(dt);
|
|
24983
|
+
}
|
|
24984
|
+
};
|
|
24985
|
+
return UpdateTickData;
|
|
24986
|
+
}(TickData);
|
|
24987
|
+
var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
24988
|
+
_inherits(LateUpdateTickData, TickData);
|
|
24989
|
+
function LateUpdateTickData() {
|
|
24990
|
+
return TickData.apply(this, arguments);
|
|
24991
|
+
}
|
|
24992
|
+
var _proto = LateUpdateTickData.prototype;
|
|
24993
|
+
_proto.tickComponents = function tickComponents(components, dt) {
|
|
24994
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(components), _step; !(_step = _iterator()).done;){
|
|
24995
|
+
var component = _step.value;
|
|
24996
|
+
component.onLateUpdate(dt);
|
|
24997
|
+
}
|
|
24998
|
+
};
|
|
24999
|
+
return LateUpdateTickData;
|
|
25000
|
+
} // function compareComponents (a: Component, b: Component): number {
|
|
25001
|
+
// const itemA = a.item;
|
|
25002
|
+
// const itemB = b.item;
|
|
25003
|
+
// if (VFXItem.isAncestor(itemA, itemB)) {
|
|
25004
|
+
// return -1;
|
|
25005
|
+
// } else {
|
|
25006
|
+
// return 1;
|
|
25007
|
+
// }
|
|
25008
|
+
// }
|
|
25009
|
+
(TickData);
|
|
25010
|
+
|
|
24837
25011
|
/**
|
|
24838
25012
|
* 合成抽象类:核心对象,通常一个场景只包含一个合成,可能会有多个合成。
|
|
24839
25013
|
* 合成中包含了相关的 Item 元素,支持对 Item 元素的创建、更新和销毁。
|
|
@@ -24843,6 +25017,7 @@ var listOrder = 0;
|
|
|
24843
25017
|
function Composition(props, scene) {
|
|
24844
25018
|
var _this;
|
|
24845
25019
|
_this = EventEmitter.call(this) || this;
|
|
25020
|
+
_this.sceneTicking = new SceneTicking();
|
|
24846
25021
|
/**
|
|
24847
25022
|
* 动画播放速度
|
|
24848
25023
|
*/ _this.speed = 1;
|
|
@@ -24880,9 +25055,12 @@ var listOrder = 0;
|
|
|
24880
25055
|
_this.rootItem = new exports.VFXItem(_this.getEngine(), sourceContent);
|
|
24881
25056
|
_this.rootItem.name = "rootItem";
|
|
24882
25057
|
_this.rootItem.composition = _assert_this_initialized(_this);
|
|
24883
|
-
|
|
25058
|
+
// Spawn rootCompositionComponent
|
|
25059
|
+
_this.rootComposition = new CompositionComponent(_this.getEngine());
|
|
24884
25060
|
_this.rootComposition.startTime = sourceContent.startTime;
|
|
24885
25061
|
_this.rootComposition.data = sourceContent;
|
|
25062
|
+
_this.rootComposition.item = _this.rootItem;
|
|
25063
|
+
_this.rootItem.components.push(_this.rootComposition);
|
|
24886
25064
|
var imageUsage = !reusable && imgUsage;
|
|
24887
25065
|
_this.width = width;
|
|
24888
25066
|
_this.height = height;
|
|
@@ -24916,7 +25094,6 @@ var listOrder = 0;
|
|
|
24916
25094
|
_this.rendererOptions = null;
|
|
24917
25095
|
_this.rootComposition.createContent();
|
|
24918
25096
|
_this.buildItemTree(_this.rootItem);
|
|
24919
|
-
_this.callAwake(_this.rootItem);
|
|
24920
25097
|
_this.rootItem.onEnd = function() {
|
|
24921
25098
|
window.setTimeout(function() {
|
|
24922
25099
|
_this.emit("end", {
|
|
@@ -24928,6 +25105,16 @@ var listOrder = 0;
|
|
|
24928
25105
|
return _this;
|
|
24929
25106
|
}
|
|
24930
25107
|
var _proto = Composition.prototype;
|
|
25108
|
+
_proto.initializeSceneTicking = function initializeSceneTicking(item) {
|
|
25109
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(item.components), _step; !(_step = _iterator()).done;){
|
|
25110
|
+
var component = _step.value;
|
|
25111
|
+
this.sceneTicking.addComponent(component);
|
|
25112
|
+
}
|
|
25113
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.children), _step1; !(_step1 = _iterator1()).done;){
|
|
25114
|
+
var child = _step1.value;
|
|
25115
|
+
this.initializeSceneTicking(child);
|
|
25116
|
+
}
|
|
25117
|
+
};
|
|
24931
25118
|
/**
|
|
24932
25119
|
* 获取合成的时长
|
|
24933
25120
|
*/ _proto.getDuration = function getDuration() {
|
|
@@ -25030,7 +25217,7 @@ var listOrder = 0;
|
|
|
25030
25217
|
this.resume();
|
|
25031
25218
|
}
|
|
25032
25219
|
if (!this.rootComposition.isStartCalled) {
|
|
25033
|
-
this.rootComposition.
|
|
25220
|
+
this.rootComposition.onStart();
|
|
25034
25221
|
this.rootComposition.isStartCalled = true;
|
|
25035
25222
|
}
|
|
25036
25223
|
this.forwardTime(time + this.startTime);
|
|
@@ -25107,9 +25294,12 @@ var listOrder = 0;
|
|
|
25107
25294
|
// 更新 model-tree-plugin
|
|
25108
25295
|
this.updatePluginLoaders(deltaTime);
|
|
25109
25296
|
// scene VFXItem components lifetime function.
|
|
25110
|
-
|
|
25111
|
-
|
|
25112
|
-
|
|
25297
|
+
if (!this.rootItem.isDuringPlay) {
|
|
25298
|
+
this.callAwake(this.rootItem);
|
|
25299
|
+
this.rootItem.beginPlay();
|
|
25300
|
+
}
|
|
25301
|
+
this.sceneTicking.update.tick(time);
|
|
25302
|
+
this.sceneTicking.lateUpdate.tick(time);
|
|
25113
25303
|
this.updateCamera();
|
|
25114
25304
|
this.prepareRender();
|
|
25115
25305
|
if (this.shouldDispose()) {
|
|
@@ -25162,11 +25352,11 @@ var listOrder = 0;
|
|
|
25162
25352
|
return t;
|
|
25163
25353
|
};
|
|
25164
25354
|
_proto.callAwake = function callAwake(item) {
|
|
25165
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.
|
|
25166
|
-
var
|
|
25167
|
-
if (!
|
|
25168
|
-
|
|
25169
|
-
|
|
25355
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(item.components), _step; !(_step = _iterator()).done;){
|
|
25356
|
+
var component = _step.value;
|
|
25357
|
+
if (!component.isAwakeCalled) {
|
|
25358
|
+
component.onAwake();
|
|
25359
|
+
component.isAwakeCalled = true;
|
|
25170
25360
|
}
|
|
25171
25361
|
}
|
|
25172
25362
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.children), _step1; !(_step1 = _iterator1()).done;){
|
|
@@ -25174,72 +25364,6 @@ var listOrder = 0;
|
|
|
25174
25364
|
this.callAwake(child);
|
|
25175
25365
|
}
|
|
25176
25366
|
};
|
|
25177
|
-
_proto.callStart = function callStart(item) {
|
|
25178
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.itemBehaviours), _step; !(_step = _iterator()).done;){
|
|
25179
|
-
var itemBehaviour = _step.value;
|
|
25180
|
-
if (itemBehaviour.isActiveAndEnabled && !itemBehaviour.isStartCalled) {
|
|
25181
|
-
itemBehaviour.start();
|
|
25182
|
-
itemBehaviour.isStartCalled = true;
|
|
25183
|
-
}
|
|
25184
|
-
}
|
|
25185
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.rendererComponents), _step1; !(_step1 = _iterator1()).done;){
|
|
25186
|
-
var rendererComponent = _step1.value;
|
|
25187
|
-
if (rendererComponent.isActiveAndEnabled && !rendererComponent.isStartCalled) {
|
|
25188
|
-
rendererComponent.start();
|
|
25189
|
-
rendererComponent.isStartCalled = true;
|
|
25190
|
-
}
|
|
25191
|
-
}
|
|
25192
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(item.children), _step2; !(_step2 = _iterator2()).done;){
|
|
25193
|
-
var child = _step2.value;
|
|
25194
|
-
this.callStart(child);
|
|
25195
|
-
}
|
|
25196
|
-
};
|
|
25197
|
-
_proto.callUpdate = function callUpdate(item, dt) {
|
|
25198
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.itemBehaviours), _step; !(_step = _iterator()).done;){
|
|
25199
|
-
var itemBehaviour = _step.value;
|
|
25200
|
-
if (itemBehaviour.isActiveAndEnabled && itemBehaviour.isStartCalled) {
|
|
25201
|
-
itemBehaviour.update(dt);
|
|
25202
|
-
}
|
|
25203
|
-
}
|
|
25204
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.rendererComponents), _step1; !(_step1 = _iterator1()).done;){
|
|
25205
|
-
var rendererComponent = _step1.value;
|
|
25206
|
-
if (rendererComponent.isActiveAndEnabled && rendererComponent.isStartCalled) {
|
|
25207
|
-
rendererComponent.update(dt);
|
|
25208
|
-
}
|
|
25209
|
-
}
|
|
25210
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(item.children), _step2; !(_step2 = _iterator2()).done;){
|
|
25211
|
-
var child = _step2.value;
|
|
25212
|
-
if (exports.VFXItem.isComposition(child)) {
|
|
25213
|
-
if (child.ended && child.endBehavior === EndBehavior.restart) {
|
|
25214
|
-
child.ended = false;
|
|
25215
|
-
// TODO K帧动画在元素重建后需要 tick ,否则会导致元素位置和 k 帧第一帧位置不一致
|
|
25216
|
-
this.callUpdate(child, 0);
|
|
25217
|
-
} else {
|
|
25218
|
-
this.callUpdate(child, dt);
|
|
25219
|
-
}
|
|
25220
|
-
} else {
|
|
25221
|
-
this.callUpdate(child, dt);
|
|
25222
|
-
}
|
|
25223
|
-
}
|
|
25224
|
-
};
|
|
25225
|
-
_proto.callLateUpdate = function callLateUpdate(item, dt) {
|
|
25226
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.itemBehaviours), _step; !(_step = _iterator()).done;){
|
|
25227
|
-
var itemBehaviour = _step.value;
|
|
25228
|
-
if (itemBehaviour.isActiveAndEnabled && itemBehaviour.isStartCalled) {
|
|
25229
|
-
itemBehaviour.lateUpdate(dt);
|
|
25230
|
-
}
|
|
25231
|
-
}
|
|
25232
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.rendererComponents), _step1; !(_step1 = _iterator1()).done;){
|
|
25233
|
-
var rendererComponent = _step1.value;
|
|
25234
|
-
if (rendererComponent.isActiveAndEnabled && rendererComponent.isStartCalled) {
|
|
25235
|
-
rendererComponent.lateUpdate(dt);
|
|
25236
|
-
}
|
|
25237
|
-
}
|
|
25238
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(item.children), _step2; !(_step2 = _iterator2()).done;){
|
|
25239
|
-
var child = _step2.value;
|
|
25240
|
-
this.callLateUpdate(child, dt);
|
|
25241
|
-
}
|
|
25242
|
-
};
|
|
25243
25367
|
/**
|
|
25244
25368
|
* 构建父子树,同时保存到 itemCacheMap 中便于查找
|
|
25245
25369
|
*/ _proto.buildItemTree = function buildItemTree(compVFXItem) {
|
|
@@ -27113,7 +27237,6 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
|
|
|
27113
27237
|
|
|
27114
27238
|
/**
|
|
27115
27239
|
* @since 2.0.0
|
|
27116
|
-
* @internal
|
|
27117
27240
|
*/ var EffectsPackage = /*#__PURE__*/ function() {
|
|
27118
27241
|
function EffectsPackage() {
|
|
27119
27242
|
this.exportObjectDatas = [];
|
|
@@ -27522,11 +27645,12 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
|
|
|
27522
27645
|
return Engine;
|
|
27523
27646
|
}();
|
|
27524
27647
|
|
|
27648
|
+
var DEFAULT_FPS = 60;
|
|
27525
27649
|
/**
|
|
27526
27650
|
* 定时器类
|
|
27527
27651
|
*/ var Ticker = /*#__PURE__*/ function() {
|
|
27528
27652
|
function Ticker(fps) {
|
|
27529
|
-
if (fps === void 0) fps =
|
|
27653
|
+
if (fps === void 0) fps = DEFAULT_FPS;
|
|
27530
27654
|
this.paused = true;
|
|
27531
27655
|
this.lastTime = 0;
|
|
27532
27656
|
// deltaTime
|
|
@@ -27661,7 +27785,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
|
|
|
27661
27785
|
registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
|
|
27662
27786
|
registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
|
|
27663
27787
|
registerPlugin("interact", InteractLoader, exports.VFXItem, true);
|
|
27664
|
-
var version = "2.0.
|
|
27788
|
+
var version = "2.1.0-alpha.0";
|
|
27665
27789
|
logger.info("Core version: " + version + ".");
|
|
27666
27790
|
|
|
27667
27791
|
exports.AbstractPlugin = AbstractPlugin;
|
|
@@ -27685,6 +27809,7 @@ exports.Composition = Composition;
|
|
|
27685
27809
|
exports.CompositionComponent = CompositionComponent;
|
|
27686
27810
|
exports.CompositionSourceManager = CompositionSourceManager;
|
|
27687
27811
|
exports.DEFAULT_FONTS = DEFAULT_FONTS;
|
|
27812
|
+
exports.DEFAULT_FPS = DEFAULT_FPS;
|
|
27688
27813
|
exports.Database = Database;
|
|
27689
27814
|
exports.Downloader = Downloader;
|
|
27690
27815
|
exports.EFFECTS_COPY_MESH_NAME = EFFECTS_COPY_MESH_NAME;
|