@galacean/effects-core 2.0.3 → 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/comp-vfx-item.d.ts +2 -2
- package/dist/components/component.d.ts +27 -18
- package/dist/components/effect-component.d.ts +1 -1
- 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 -3
- package/dist/index.js +347 -226
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +347 -227
- package/dist/index.mjs.map +1 -1
- package/dist/plugins/cal/calculate-item.d.ts +8 -0
- package/dist/plugins/cal/calculate-vfx-item.d.ts +50 -0
- package/dist/plugins/cal/playable-graph.d.ts +90 -0
- package/dist/plugins/camera/camera-controller-node.d.ts +1 -1
- package/dist/plugins/interact/interact-item.d.ts +2 -2
- package/dist/plugins/particle/particle-system-renderer.d.ts +2 -2
- package/dist/plugins/particle/particle-system.d.ts +2 -2
- package/dist/plugins/particle/particle-vfx-item.d.ts +11 -1
- package/dist/plugins/sprite/sprite-item.d.ts +2 -2
- package/dist/plugins/text/text-item.d.ts +1 -1
- package/dist/plugins/timeline/track.d.ts +54 -1
- package/dist/ticker.d.ts +1 -0
- package/dist/vfx-item.d.ts +4 -2
- 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';
|
|
@@ -4607,87 +4607,109 @@ function getDirectStore(target) {
|
|
|
4607
4607
|
*/ var Component = /*#__PURE__*/ function(EffectsObject) {
|
|
4608
4608
|
_inherits(Component, EffectsObject);
|
|
4609
4609
|
function Component() {
|
|
4610
|
-
return EffectsObject.apply(this, arguments);
|
|
4611
|
-
}
|
|
4612
|
-
var _proto = Component.prototype;
|
|
4613
|
-
_proto.onAttached = function onAttached() {};
|
|
4614
|
-
_proto.onDestroy = function onDestroy() {};
|
|
4615
|
-
_proto.fromData = function fromData(data) {
|
|
4616
|
-
EffectsObject.prototype.fromData.call(this, data);
|
|
4617
|
-
if (data.item) {
|
|
4618
|
-
this.item = data.item;
|
|
4619
|
-
}
|
|
4620
|
-
};
|
|
4621
|
-
_proto.dispose = function dispose() {
|
|
4622
|
-
this.onDestroy();
|
|
4623
|
-
if (this.item) {
|
|
4624
|
-
removeItem(this.item.components, this);
|
|
4625
|
-
}
|
|
4626
|
-
};
|
|
4627
|
-
_create_class(Component, [
|
|
4628
|
-
{
|
|
4629
|
-
key: "transform",
|
|
4630
|
-
get: /**
|
|
4631
|
-
* 附加到的 VFXItem 对象 Transform 组件
|
|
4632
|
-
*/ function get() {
|
|
4633
|
-
return this.item.transform;
|
|
4634
|
-
}
|
|
4635
|
-
}
|
|
4636
|
-
]);
|
|
4637
|
-
return Component;
|
|
4638
|
-
}(EffectsObject);
|
|
4639
|
-
/**
|
|
4640
|
-
* @since 2.0.0
|
|
4641
|
-
*/ var Behaviour = /*#__PURE__*/ function(Component) {
|
|
4642
|
-
_inherits(Behaviour, Component);
|
|
4643
|
-
function Behaviour() {
|
|
4644
4610
|
var _this;
|
|
4645
|
-
_this =
|
|
4611
|
+
_this = EffectsObject.apply(this, arguments) || this;
|
|
4646
4612
|
_this.isAwakeCalled = false;
|
|
4647
4613
|
_this.isStartCalled = false;
|
|
4614
|
+
_this.isEnableCalled = false;
|
|
4648
4615
|
_this._enabled = true;
|
|
4649
4616
|
return _this;
|
|
4650
4617
|
}
|
|
4651
|
-
var _proto =
|
|
4618
|
+
var _proto = Component.prototype;
|
|
4652
4619
|
/**
|
|
4653
4620
|
* 生命周期函数,初始化后调用,生命周期内只调用一次
|
|
4654
|
-
*/ _proto.
|
|
4621
|
+
*/ _proto.onAwake = function onAwake() {
|
|
4655
4622
|
// OVERRIDE
|
|
4656
4623
|
};
|
|
4657
4624
|
/**
|
|
4658
|
-
*
|
|
4625
|
+
* 在 enabled 变为 true 时触发
|
|
4659
4626
|
*/ _proto.onEnable = function onEnable() {
|
|
4660
4627
|
// OVERRIDE
|
|
4661
4628
|
};
|
|
4662
4629
|
/**
|
|
4630
|
+
* 在 enabled 变为 false 时触发
|
|
4631
|
+
*/ _proto.onDisable = function onDisable() {
|
|
4632
|
+
// OVERRIDE
|
|
4633
|
+
};
|
|
4634
|
+
/**
|
|
4663
4635
|
* 生命周期函数,在第一次 update 前调用,生命周期内只调用一次
|
|
4664
|
-
*/ _proto.
|
|
4636
|
+
*/ _proto.onStart = function onStart() {
|
|
4665
4637
|
// OVERRIDE
|
|
4666
4638
|
};
|
|
4667
4639
|
/**
|
|
4668
4640
|
* 生命周期函数,每帧调用一次
|
|
4669
|
-
*/ _proto.
|
|
4641
|
+
*/ _proto.onUpdate = function onUpdate(dt) {
|
|
4670
4642
|
// OVERRIDE
|
|
4671
4643
|
};
|
|
4672
4644
|
/**
|
|
4673
4645
|
* 生命周期函数,每帧调用一次,在 update 之后调用
|
|
4674
|
-
*/ _proto.
|
|
4646
|
+
*/ _proto.onLateUpdate = function onLateUpdate(dt) {
|
|
4647
|
+
// OVERRIDE
|
|
4648
|
+
};
|
|
4649
|
+
/**
|
|
4650
|
+
* 生命周期函数,在组件销毁时调用
|
|
4651
|
+
*/ _proto.onDestroy = function onDestroy() {
|
|
4675
4652
|
// OVERRIDE
|
|
4676
4653
|
};
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
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;
|
|
4682
4689
|
}
|
|
4683
4690
|
};
|
|
4684
4691
|
_proto.dispose = function dispose() {
|
|
4692
|
+
this.onDestroy();
|
|
4685
4693
|
if (this.item) {
|
|
4686
|
-
removeItem(this.item.
|
|
4694
|
+
removeItem(this.item.components, this);
|
|
4687
4695
|
}
|
|
4688
|
-
Component.prototype.dispose.call(this);
|
|
4689
4696
|
};
|
|
4690
|
-
|
|
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
|
+
},
|
|
4691
4713
|
{
|
|
4692
4714
|
key: "isActiveAndEnabled",
|
|
4693
4715
|
get: /**
|
|
@@ -4702,24 +4724,46 @@ function getDirectStore(target) {
|
|
|
4702
4724
|
return this._enabled;
|
|
4703
4725
|
},
|
|
4704
4726
|
set: function set(value) {
|
|
4705
|
-
this.
|
|
4706
|
-
|
|
4707
|
-
if (
|
|
4708
|
-
this.
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
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
|
+
}
|
|
4713
4741
|
}
|
|
4714
4742
|
}
|
|
4715
4743
|
}
|
|
4716
4744
|
}
|
|
4717
4745
|
]);
|
|
4718
|
-
return
|
|
4719
|
-
}(
|
|
4746
|
+
return Component;
|
|
4747
|
+
}(EffectsObject);
|
|
4720
4748
|
__decorate([
|
|
4721
4749
|
serialize()
|
|
4722
|
-
],
|
|
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);
|
|
4723
4767
|
|
|
4724
4768
|
/**
|
|
4725
4769
|
* 所有渲染组件的基类
|
|
@@ -4729,19 +4773,14 @@ __decorate([
|
|
|
4729
4773
|
function RendererComponent() {
|
|
4730
4774
|
var _this;
|
|
4731
4775
|
_this = Component.apply(this, arguments) || this;
|
|
4732
|
-
_this.isStartCalled = false;
|
|
4733
4776
|
_this.materials = [];
|
|
4734
4777
|
_this._priority = 0;
|
|
4735
|
-
_this._enabled = true;
|
|
4736
4778
|
return _this;
|
|
4737
4779
|
}
|
|
4738
4780
|
var _proto = RendererComponent.prototype;
|
|
4739
|
-
_proto.onEnable = function onEnable() {};
|
|
4740
|
-
_proto.start = function start() {};
|
|
4741
|
-
_proto.update = function update(dt) {};
|
|
4742
|
-
_proto.lateUpdate = function lateUpdate(dt) {};
|
|
4743
4781
|
_proto.render = function render(renderer) {};
|
|
4744
|
-
_proto.
|
|
4782
|
+
_proto.setVFXItem = function setVFXItem(item) {
|
|
4783
|
+
Component.prototype.setVFXItem.call(this, item);
|
|
4745
4784
|
this.item.rendererComponents.push(this);
|
|
4746
4785
|
};
|
|
4747
4786
|
_proto.fromData = function fromData(data) {
|
|
@@ -4766,26 +4805,6 @@ __decorate([
|
|
|
4766
4805
|
this._priority = value;
|
|
4767
4806
|
}
|
|
4768
4807
|
},
|
|
4769
|
-
{
|
|
4770
|
-
key: "enabled",
|
|
4771
|
-
get: function get() {
|
|
4772
|
-
return this._enabled;
|
|
4773
|
-
},
|
|
4774
|
-
set: function set(value) {
|
|
4775
|
-
this._enabled = value;
|
|
4776
|
-
if (value) {
|
|
4777
|
-
this.onEnable();
|
|
4778
|
-
}
|
|
4779
|
-
}
|
|
4780
|
-
},
|
|
4781
|
-
{
|
|
4782
|
-
key: "isActiveAndEnabled",
|
|
4783
|
-
get: /**
|
|
4784
|
-
* 组件是否可以更新,true 更新,false 不更新
|
|
4785
|
-
*/ function get() {
|
|
4786
|
-
return this.item.getVisible() && this.enabled;
|
|
4787
|
-
}
|
|
4788
|
-
},
|
|
4789
4808
|
{
|
|
4790
4809
|
key: "material",
|
|
4791
4810
|
get: function get() {
|
|
@@ -4808,9 +4827,6 @@ __decorate([
|
|
|
4808
4827
|
__decorate([
|
|
4809
4828
|
serialize()
|
|
4810
4829
|
], RendererComponent.prototype, "_priority", void 0);
|
|
4811
|
-
__decorate([
|
|
4812
|
-
serialize()
|
|
4813
|
-
], RendererComponent.prototype, "_enabled", void 0);
|
|
4814
4830
|
|
|
4815
4831
|
/**
|
|
4816
4832
|
* 抽象插件类
|
|
@@ -4854,7 +4870,7 @@ exports.CameraController = /*#__PURE__*/ function(Behaviour) {
|
|
|
4854
4870
|
return _this;
|
|
4855
4871
|
}
|
|
4856
4872
|
var _proto = CameraController.prototype;
|
|
4857
|
-
_proto.
|
|
4873
|
+
_proto.onUpdate = function onUpdate() {
|
|
4858
4874
|
if (this.item.composition && this.item.transform.getValid()) {
|
|
4859
4875
|
var camera = this.item.composition.camera;
|
|
4860
4876
|
camera.near = this.options.near;
|
|
@@ -8086,7 +8102,7 @@ function _loadVideo() {
|
|
|
8086
8102
|
}, true);
|
|
8087
8103
|
}
|
|
8088
8104
|
video.addEventListener("error", function(e) {
|
|
8089
|
-
reject(
|
|
8105
|
+
reject("Load video fail.");
|
|
8090
8106
|
});
|
|
8091
8107
|
})
|
|
8092
8108
|
];
|
|
@@ -13252,7 +13268,7 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13252
13268
|
return _this;
|
|
13253
13269
|
}
|
|
13254
13270
|
var _proto = InteractComponent.prototype;
|
|
13255
|
-
_proto.
|
|
13271
|
+
_proto.onStart = function onStart() {
|
|
13256
13272
|
var _this = this;
|
|
13257
13273
|
var options = this.item.props.content.options;
|
|
13258
13274
|
var env = this.item.engine.renderer.env;
|
|
@@ -13288,8 +13304,11 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13288
13304
|
}
|
|
13289
13305
|
};
|
|
13290
13306
|
};
|
|
13291
|
-
_proto.
|
|
13307
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
13292
13308
|
var _this_previewContent;
|
|
13309
|
+
if (!this.isActiveAndEnabled) {
|
|
13310
|
+
return;
|
|
13311
|
+
}
|
|
13293
13312
|
(_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.updateMesh();
|
|
13294
13313
|
if (!this.hasBeenAddedToComposition && this.item.composition) {
|
|
13295
13314
|
var options = this.item.props.content.options;
|
|
@@ -13560,7 +13579,6 @@ function _assert_this_initialized(self) {
|
|
|
13560
13579
|
/**
|
|
13561
13580
|
* 动画图,负责更新所有的动画节点
|
|
13562
13581
|
* @since 2.0.0
|
|
13563
|
-
* @internal
|
|
13564
13582
|
*/ var PlayableGraph = /*#__PURE__*/ function() {
|
|
13565
13583
|
function PlayableGraph() {
|
|
13566
13584
|
this.playableOutputs = [];
|
|
@@ -13620,7 +13638,6 @@ function _assert_this_initialized(self) {
|
|
|
13620
13638
|
/**
|
|
13621
13639
|
* 动画图可播放节点对象
|
|
13622
13640
|
* @since 2.0.0
|
|
13623
|
-
* @internal
|
|
13624
13641
|
*/ var Playable = /*#__PURE__*/ function() {
|
|
13625
13642
|
function Playable(graph, inputCount) {
|
|
13626
13643
|
if (inputCount === void 0) inputCount = 0;
|
|
@@ -13634,6 +13651,9 @@ function _assert_this_initialized(self) {
|
|
|
13634
13651
|
this.outputs = [];
|
|
13635
13652
|
this.playState = 0;
|
|
13636
13653
|
this.traversalMode = 0;
|
|
13654
|
+
/**
|
|
13655
|
+
* 当前本地播放的时间
|
|
13656
|
+
*/ this.time = 0;
|
|
13637
13657
|
graph.addPlayable(this);
|
|
13638
13658
|
this.inputs = new Array(inputCount);
|
|
13639
13659
|
this.inputOuputPorts = new Array(inputCount);
|
|
@@ -13818,7 +13838,6 @@ function _assert_this_initialized(self) {
|
|
|
13818
13838
|
/**
|
|
13819
13839
|
* 动画图输出节点对象,将动画数据采样到绑定的元素属性上
|
|
13820
13840
|
* @since 2.0.0
|
|
13821
|
-
* @internal
|
|
13822
13841
|
*/ var PlayableOutput = /*#__PURE__*/ function() {
|
|
13823
13842
|
function PlayableOutput() {
|
|
13824
13843
|
this.sourceOutputPort = 0;
|
|
@@ -14080,10 +14099,10 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
14080
14099
|
this.material.setVector2("_Size", this.transform.size);
|
|
14081
14100
|
renderer.drawGeometry(geo, material);
|
|
14082
14101
|
};
|
|
14083
|
-
_proto.
|
|
14102
|
+
_proto.onStart = function onStart() {
|
|
14084
14103
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
14085
14104
|
};
|
|
14086
|
-
_proto.
|
|
14105
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
14087
14106
|
if (!this.isManualTimeSet) {
|
|
14088
14107
|
this.frameAnimationTime += dt / 1000;
|
|
14089
14108
|
this.isManualTimeSet = false;
|
|
@@ -16506,15 +16525,15 @@ function getTrailMeshShader(trails, particleMaxCount, name, gpuCapability, env)
|
|
|
16506
16525
|
return _this;
|
|
16507
16526
|
}
|
|
16508
16527
|
var _proto = ParticleSystemRenderer.prototype;
|
|
16509
|
-
_proto.
|
|
16528
|
+
_proto.onStart = function onStart() {
|
|
16510
16529
|
this._priority = this.item.renderOrder;
|
|
16511
16530
|
this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);
|
|
16512
16531
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.meshes), _step; !(_step = _iterator()).done;){
|
|
16513
16532
|
var mesh = _step.value;
|
|
16514
|
-
mesh.
|
|
16533
|
+
mesh.onStart();
|
|
16515
16534
|
}
|
|
16516
16535
|
};
|
|
16517
|
-
_proto.
|
|
16536
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
16518
16537
|
var time = this.particleMesh.time;
|
|
16519
16538
|
this.particleMesh.mesh.material.setVector4("uParams", new Vector4(time, this.item.duration, 0, 0));
|
|
16520
16539
|
};
|
|
@@ -16738,7 +16757,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16738
16757
|
_proto.getTextures = function getTextures() {
|
|
16739
16758
|
return this.renderer.getTextures();
|
|
16740
16759
|
};
|
|
16741
|
-
_proto.
|
|
16760
|
+
_proto.startEmit = function startEmit() {
|
|
16742
16761
|
if (!this.started || this.ended) {
|
|
16743
16762
|
this.reset();
|
|
16744
16763
|
this.started = true;
|
|
@@ -16764,7 +16783,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16764
16783
|
this.frozen = false;
|
|
16765
16784
|
this.ended = false;
|
|
16766
16785
|
};
|
|
16767
|
-
_proto.
|
|
16786
|
+
_proto.update = function update(delta) {
|
|
16768
16787
|
var _this = this;
|
|
16769
16788
|
if (this.started && !this.frozen) {
|
|
16770
16789
|
var now = this.lastUpdate + delta / 1000;
|
|
@@ -17547,7 +17566,6 @@ function randomArrItem(arr, keepArr) {
|
|
|
17547
17566
|
|
|
17548
17567
|
/**
|
|
17549
17568
|
* @since 2.0.0
|
|
17550
|
-
* @internal
|
|
17551
17569
|
*/ var ParticleBehaviourPlayable = /*#__PURE__*/ function(Playable) {
|
|
17552
17570
|
_inherits(ParticleBehaviourPlayable, Playable);
|
|
17553
17571
|
function ParticleBehaviourPlayable() {
|
|
@@ -17565,7 +17583,7 @@ function randomArrItem(arr, keepArr) {
|
|
|
17565
17583
|
this.particleSystem = boundObject.getComponent(exports.ParticleSystem);
|
|
17566
17584
|
if (this.particleSystem) {
|
|
17567
17585
|
this.particleSystem.name = boundObject.name;
|
|
17568
|
-
this.particleSystem.
|
|
17586
|
+
this.particleSystem.startEmit();
|
|
17569
17587
|
this.particleSystem.initEmitterTransform();
|
|
17570
17588
|
}
|
|
17571
17589
|
};
|
|
@@ -17585,7 +17603,7 @@ function randomArrItem(arr, keepArr) {
|
|
|
17585
17603
|
if (Math.abs(this.time - this.lastTime) < 0.001) {
|
|
17586
17604
|
deltaTime = 0;
|
|
17587
17605
|
}
|
|
17588
|
-
particleSystem.
|
|
17606
|
+
particleSystem.update(deltaTime);
|
|
17589
17607
|
}
|
|
17590
17608
|
this.lastTime = this.time;
|
|
17591
17609
|
};
|
|
@@ -18607,7 +18625,6 @@ var tempSize = new Vector3(1, 1, 1);
|
|
|
18607
18625
|
var tempPos = new Vector3();
|
|
18608
18626
|
/**
|
|
18609
18627
|
* @since 2.0.0
|
|
18610
|
-
* @internal
|
|
18611
18628
|
*/ var TransformAnimationPlayable = /*#__PURE__*/ function(AnimationPlayable) {
|
|
18612
18629
|
_inherits(TransformAnimationPlayable, AnimationPlayable);
|
|
18613
18630
|
function TransformAnimationPlayable() {
|
|
@@ -18769,7 +18786,6 @@ exports.TransformPlayableAsset = __decorate([
|
|
|
18769
18786
|
], exports.TransformPlayableAsset);
|
|
18770
18787
|
/**
|
|
18771
18788
|
* @since 2.0.0
|
|
18772
|
-
* @internal
|
|
18773
18789
|
*/ var ActivationPlayable = /*#__PURE__*/ function(Playable) {
|
|
18774
18790
|
_inherits(ActivationPlayable, Playable);
|
|
18775
18791
|
function ActivationPlayable() {
|
|
@@ -18920,7 +18936,6 @@ var AnimationClipPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
18920
18936
|
|
|
18921
18937
|
/**
|
|
18922
18938
|
* @since 2.0.0
|
|
18923
|
-
* @internal
|
|
18924
18939
|
*/ var TimelineClip = /*#__PURE__*/ function() {
|
|
18925
18940
|
function TimelineClip() {
|
|
18926
18941
|
this.start = 0;
|
|
@@ -19318,25 +19333,15 @@ var TrackSortWrapper = function TrackSortWrapper(track, originalIndex) {
|
|
|
19318
19333
|
this.track = track;
|
|
19319
19334
|
this.originalIndex = originalIndex;
|
|
19320
19335
|
};
|
|
19321
|
-
function isAncestor(ancestorCandidate, descendantCandidate) {
|
|
19322
|
-
var current = descendantCandidate.parent;
|
|
19323
|
-
while(current){
|
|
19324
|
-
if (current === ancestorCandidate) {
|
|
19325
|
-
return true;
|
|
19326
|
-
}
|
|
19327
|
-
current = current.parent;
|
|
19328
|
-
}
|
|
19329
|
-
return false;
|
|
19330
|
-
}
|
|
19331
19336
|
function compareTracks(a, b) {
|
|
19332
19337
|
var bindingA = a.track.binding;
|
|
19333
19338
|
var bindingB = b.track.binding;
|
|
19334
19339
|
if (!_instanceof1(bindingA, exports.VFXItem) || !_instanceof1(bindingB, exports.VFXItem)) {
|
|
19335
19340
|
return a.originalIndex - b.originalIndex;
|
|
19336
19341
|
}
|
|
19337
|
-
if (isAncestor(bindingA, bindingB)) {
|
|
19342
|
+
if (exports.VFXItem.isAncestor(bindingA, bindingB)) {
|
|
19338
19343
|
return -1;
|
|
19339
|
-
} else if (isAncestor(bindingB, bindingA)) {
|
|
19344
|
+
} else if (exports.VFXItem.isAncestor(bindingB, bindingA)) {
|
|
19340
19345
|
return 1;
|
|
19341
19346
|
} else {
|
|
19342
19347
|
return a.originalIndex - b.originalIndex; // 非父子关系的元素保持原始顺序
|
|
@@ -19360,7 +19365,7 @@ function compareTracks(a, b) {
|
|
|
19360
19365
|
return _this;
|
|
19361
19366
|
}
|
|
19362
19367
|
var _proto = CompositionComponent.prototype;
|
|
19363
|
-
_proto.
|
|
19368
|
+
_proto.onStart = function onStart() {
|
|
19364
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;
|
|
19365
19370
|
this.startTime = startTime;
|
|
19366
19371
|
this.resolveBindings();
|
|
@@ -19388,7 +19393,7 @@ function compareTracks(a, b) {
|
|
|
19388
19393
|
_proto.getReusable = function getReusable() {
|
|
19389
19394
|
return this.reusable;
|
|
19390
19395
|
};
|
|
19391
|
-
_proto.
|
|
19396
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
19392
19397
|
var time = this.time;
|
|
19393
19398
|
this.timelinePlayable.setTime(time);
|
|
19394
19399
|
this.graph.evaluate(dt);
|
|
@@ -19424,7 +19429,9 @@ function compareTracks(a, b) {
|
|
|
19424
19429
|
props.content = itemData.content;
|
|
19425
19430
|
item = assetLoader.loadGUID(itemData.id);
|
|
19426
19431
|
item.composition = this.item.composition;
|
|
19427
|
-
var compositionComponent =
|
|
19432
|
+
var compositionComponent = new CompositionComponent(this.engine);
|
|
19433
|
+
compositionComponent.item = item;
|
|
19434
|
+
item.components.push(compositionComponent);
|
|
19428
19435
|
compositionComponent.data = props;
|
|
19429
19436
|
compositionComponent.refId = refId;
|
|
19430
19437
|
item.transform.parentTransform = this.transform;
|
|
@@ -19835,8 +19842,8 @@ exports.TextComponent = /*#__PURE__*/ function(SpriteComponent) {
|
|
|
19835
19842
|
return _this;
|
|
19836
19843
|
}
|
|
19837
19844
|
var _proto = TextComponent.prototype;
|
|
19838
|
-
_proto.
|
|
19839
|
-
SpriteComponent.prototype.
|
|
19845
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
19846
|
+
SpriteComponent.prototype.onUpdate.call(this, dt);
|
|
19840
19847
|
this.updateTexture();
|
|
19841
19848
|
};
|
|
19842
19849
|
_proto.fromData = function fromData(data) {
|
|
@@ -20251,7 +20258,7 @@ exports.EffectComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
20251
20258
|
return _this;
|
|
20252
20259
|
}
|
|
20253
20260
|
var _proto = EffectComponent.prototype;
|
|
20254
|
-
_proto.
|
|
20261
|
+
_proto.onStart = function onStart() {
|
|
20255
20262
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
20256
20263
|
};
|
|
20257
20264
|
_proto.render = function render(renderer) {
|
|
@@ -20378,7 +20385,7 @@ exports.PostProcessVolume = /*#__PURE__*/ function(Behaviour) {
|
|
|
20378
20385
|
return _this;
|
|
20379
20386
|
}
|
|
20380
20387
|
var _proto = PostProcessVolume.prototype;
|
|
20381
|
-
_proto.
|
|
20388
|
+
_proto.onStart = function onStart() {
|
|
20382
20389
|
var composition = this.item.composition;
|
|
20383
20390
|
if (composition) {
|
|
20384
20391
|
composition.globalVolume = this;
|
|
@@ -20520,8 +20527,8 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20520
20527
|
*/ _this.ended = false;
|
|
20521
20528
|
_this.reusable = false;
|
|
20522
20529
|
_this.type = ItemType.base;
|
|
20530
|
+
_this.isDuringPlay = false;
|
|
20523
20531
|
_this.components = [];
|
|
20524
|
-
_this.itemBehaviours = [];
|
|
20525
20532
|
_this.rendererComponents = [];
|
|
20526
20533
|
/**
|
|
20527
20534
|
* 元素可见性,该值的改变会触发 `handleVisibleChanged` 回调
|
|
@@ -20531,6 +20538,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20531
20538
|
* 元素动画的速度
|
|
20532
20539
|
*/ _this.speed = 1;
|
|
20533
20540
|
_this.listIndex = 0;
|
|
20541
|
+
_this.isEnabled = false;
|
|
20534
20542
|
_this.eventProcessor = new EventEmitter();
|
|
20535
20543
|
_this.name = "VFXItem";
|
|
20536
20544
|
_this.transform.name = _this.name;
|
|
@@ -20603,8 +20611,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20603
20611
|
*/ _proto.addComponent = function addComponent(classConstructor) {
|
|
20604
20612
|
var newComponent = new classConstructor(this.engine);
|
|
20605
20613
|
this.components.push(newComponent);
|
|
20606
|
-
newComponent.
|
|
20607
|
-
newComponent.onAttached();
|
|
20614
|
+
newComponent.setVFXItem(this);
|
|
20608
20615
|
return newComponent;
|
|
20609
20616
|
};
|
|
20610
20617
|
/**
|
|
@@ -20637,21 +20644,22 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20637
20644
|
return res;
|
|
20638
20645
|
};
|
|
20639
20646
|
_proto.setParent = function setParent(vfxItem) {
|
|
20640
|
-
if (vfxItem === this) {
|
|
20647
|
+
if (vfxItem === this && !vfxItem) {
|
|
20641
20648
|
return;
|
|
20642
20649
|
}
|
|
20643
20650
|
if (this.parent) {
|
|
20644
20651
|
removeItem(this.parent.children, this);
|
|
20645
20652
|
}
|
|
20646
20653
|
this.parent = vfxItem;
|
|
20647
|
-
if (
|
|
20648
|
-
|
|
20649
|
-
|
|
20650
|
-
|
|
20651
|
-
|
|
20652
|
-
|
|
20653
|
-
|
|
20654
|
-
|
|
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();
|
|
20655
20663
|
}
|
|
20656
20664
|
};
|
|
20657
20665
|
/**
|
|
@@ -20682,6 +20690,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20682
20690
|
*/ _proto.setVisible = function setVisible(visible) {
|
|
20683
20691
|
if (this.visible !== visible) {
|
|
20684
20692
|
this.visible = !!visible;
|
|
20693
|
+
this.onActiveChanged();
|
|
20685
20694
|
}
|
|
20686
20695
|
};
|
|
20687
20696
|
/**
|
|
@@ -20806,6 +20815,57 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20806
20815
|
}
|
|
20807
20816
|
return undefined;
|
|
20808
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
|
+
};
|
|
20809
20869
|
_proto.fromData = function fromData(data) {
|
|
20810
20870
|
EffectsObject.prototype.fromData.call(this, data);
|
|
20811
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;
|
|
@@ -20855,14 +20915,10 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20855
20915
|
if (duration <= 0) {
|
|
20856
20916
|
throw new Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"] + ".");
|
|
20857
20917
|
}
|
|
20858
|
-
this.itemBehaviours.length = 0;
|
|
20859
20918
|
this.rendererComponents.length = 0;
|
|
20860
20919
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
20861
20920
|
var component = _step.value;
|
|
20862
20921
|
component.item = this;
|
|
20863
|
-
if (_instanceof1(component, Behaviour)) {
|
|
20864
|
-
this.itemBehaviours.push(component);
|
|
20865
|
-
}
|
|
20866
20922
|
if (_instanceof1(component, RendererComponent)) {
|
|
20867
20923
|
this.rendererComponents.push(component);
|
|
20868
20924
|
}
|
|
@@ -20967,6 +21023,16 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20967
21023
|
VFXItem.isExtraCamera = function isExtraCamera(item) {
|
|
20968
21024
|
return item.id === "extra-camera" && item.name === "extra-camera";
|
|
20969
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
|
+
};
|
|
20970
21036
|
_create_class(VFXItem, [
|
|
20971
21037
|
{
|
|
20972
21038
|
key: "content",
|
|
@@ -24104,7 +24170,7 @@ var seed = 1;
|
|
|
24104
24170
|
];
|
|
24105
24171
|
case 6:
|
|
24106
24172
|
e = _state.sent();
|
|
24107
|
-
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) + ".");
|
|
24108
24174
|
case 7:
|
|
24109
24175
|
return [
|
|
24110
24176
|
3,
|
|
@@ -24839,6 +24905,109 @@ var listOrder = 0;
|
|
|
24839
24905
|
return CompositionSourceManager;
|
|
24840
24906
|
}();
|
|
24841
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
|
+
|
|
24842
25011
|
/**
|
|
24843
25012
|
* 合成抽象类:核心对象,通常一个场景只包含一个合成,可能会有多个合成。
|
|
24844
25013
|
* 合成中包含了相关的 Item 元素,支持对 Item 元素的创建、更新和销毁。
|
|
@@ -24848,6 +25017,7 @@ var listOrder = 0;
|
|
|
24848
25017
|
function Composition(props, scene) {
|
|
24849
25018
|
var _this;
|
|
24850
25019
|
_this = EventEmitter.call(this) || this;
|
|
25020
|
+
_this.sceneTicking = new SceneTicking();
|
|
24851
25021
|
/**
|
|
24852
25022
|
* 动画播放速度
|
|
24853
25023
|
*/ _this.speed = 1;
|
|
@@ -24885,9 +25055,12 @@ var listOrder = 0;
|
|
|
24885
25055
|
_this.rootItem = new exports.VFXItem(_this.getEngine(), sourceContent);
|
|
24886
25056
|
_this.rootItem.name = "rootItem";
|
|
24887
25057
|
_this.rootItem.composition = _assert_this_initialized(_this);
|
|
24888
|
-
|
|
25058
|
+
// Spawn rootCompositionComponent
|
|
25059
|
+
_this.rootComposition = new CompositionComponent(_this.getEngine());
|
|
24889
25060
|
_this.rootComposition.startTime = sourceContent.startTime;
|
|
24890
25061
|
_this.rootComposition.data = sourceContent;
|
|
25062
|
+
_this.rootComposition.item = _this.rootItem;
|
|
25063
|
+
_this.rootItem.components.push(_this.rootComposition);
|
|
24891
25064
|
var imageUsage = !reusable && imgUsage;
|
|
24892
25065
|
_this.width = width;
|
|
24893
25066
|
_this.height = height;
|
|
@@ -24921,7 +25094,6 @@ var listOrder = 0;
|
|
|
24921
25094
|
_this.rendererOptions = null;
|
|
24922
25095
|
_this.rootComposition.createContent();
|
|
24923
25096
|
_this.buildItemTree(_this.rootItem);
|
|
24924
|
-
_this.callAwake(_this.rootItem);
|
|
24925
25097
|
_this.rootItem.onEnd = function() {
|
|
24926
25098
|
window.setTimeout(function() {
|
|
24927
25099
|
_this.emit("end", {
|
|
@@ -24933,6 +25105,16 @@ var listOrder = 0;
|
|
|
24933
25105
|
return _this;
|
|
24934
25106
|
}
|
|
24935
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
|
+
};
|
|
24936
25118
|
/**
|
|
24937
25119
|
* 获取合成的时长
|
|
24938
25120
|
*/ _proto.getDuration = function getDuration() {
|
|
@@ -25035,7 +25217,7 @@ var listOrder = 0;
|
|
|
25035
25217
|
this.resume();
|
|
25036
25218
|
}
|
|
25037
25219
|
if (!this.rootComposition.isStartCalled) {
|
|
25038
|
-
this.rootComposition.
|
|
25220
|
+
this.rootComposition.onStart();
|
|
25039
25221
|
this.rootComposition.isStartCalled = true;
|
|
25040
25222
|
}
|
|
25041
25223
|
this.forwardTime(time + this.startTime);
|
|
@@ -25112,9 +25294,12 @@ var listOrder = 0;
|
|
|
25112
25294
|
// 更新 model-tree-plugin
|
|
25113
25295
|
this.updatePluginLoaders(deltaTime);
|
|
25114
25296
|
// scene VFXItem components lifetime function.
|
|
25115
|
-
|
|
25116
|
-
|
|
25117
|
-
|
|
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);
|
|
25118
25303
|
this.updateCamera();
|
|
25119
25304
|
this.prepareRender();
|
|
25120
25305
|
if (this.shouldDispose()) {
|
|
@@ -25167,11 +25352,11 @@ var listOrder = 0;
|
|
|
25167
25352
|
return t;
|
|
25168
25353
|
};
|
|
25169
25354
|
_proto.callAwake = function callAwake(item) {
|
|
25170
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.
|
|
25171
|
-
var
|
|
25172
|
-
if (!
|
|
25173
|
-
|
|
25174
|
-
|
|
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;
|
|
25175
25360
|
}
|
|
25176
25361
|
}
|
|
25177
25362
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.children), _step1; !(_step1 = _iterator1()).done;){
|
|
@@ -25179,72 +25364,6 @@ var listOrder = 0;
|
|
|
25179
25364
|
this.callAwake(child);
|
|
25180
25365
|
}
|
|
25181
25366
|
};
|
|
25182
|
-
_proto.callStart = function callStart(item) {
|
|
25183
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.itemBehaviours), _step; !(_step = _iterator()).done;){
|
|
25184
|
-
var itemBehaviour = _step.value;
|
|
25185
|
-
if (itemBehaviour.isActiveAndEnabled && !itemBehaviour.isStartCalled) {
|
|
25186
|
-
itemBehaviour.start();
|
|
25187
|
-
itemBehaviour.isStartCalled = true;
|
|
25188
|
-
}
|
|
25189
|
-
}
|
|
25190
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.rendererComponents), _step1; !(_step1 = _iterator1()).done;){
|
|
25191
|
-
var rendererComponent = _step1.value;
|
|
25192
|
-
if (rendererComponent.isActiveAndEnabled && !rendererComponent.isStartCalled) {
|
|
25193
|
-
rendererComponent.start();
|
|
25194
|
-
rendererComponent.isStartCalled = true;
|
|
25195
|
-
}
|
|
25196
|
-
}
|
|
25197
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(item.children), _step2; !(_step2 = _iterator2()).done;){
|
|
25198
|
-
var child = _step2.value;
|
|
25199
|
-
this.callStart(child);
|
|
25200
|
-
}
|
|
25201
|
-
};
|
|
25202
|
-
_proto.callUpdate = function callUpdate(item, dt) {
|
|
25203
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.itemBehaviours), _step; !(_step = _iterator()).done;){
|
|
25204
|
-
var itemBehaviour = _step.value;
|
|
25205
|
-
if (itemBehaviour.isActiveAndEnabled && itemBehaviour.isStartCalled) {
|
|
25206
|
-
itemBehaviour.update(dt);
|
|
25207
|
-
}
|
|
25208
|
-
}
|
|
25209
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.rendererComponents), _step1; !(_step1 = _iterator1()).done;){
|
|
25210
|
-
var rendererComponent = _step1.value;
|
|
25211
|
-
if (rendererComponent.isActiveAndEnabled && rendererComponent.isStartCalled) {
|
|
25212
|
-
rendererComponent.update(dt);
|
|
25213
|
-
}
|
|
25214
|
-
}
|
|
25215
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(item.children), _step2; !(_step2 = _iterator2()).done;){
|
|
25216
|
-
var child = _step2.value;
|
|
25217
|
-
if (exports.VFXItem.isComposition(child)) {
|
|
25218
|
-
if (child.ended && child.endBehavior === EndBehavior.restart) {
|
|
25219
|
-
child.ended = false;
|
|
25220
|
-
// TODO K帧动画在元素重建后需要 tick ,否则会导致元素位置和 k 帧第一帧位置不一致
|
|
25221
|
-
this.callUpdate(child, 0);
|
|
25222
|
-
} else {
|
|
25223
|
-
this.callUpdate(child, dt);
|
|
25224
|
-
}
|
|
25225
|
-
} else {
|
|
25226
|
-
this.callUpdate(child, dt);
|
|
25227
|
-
}
|
|
25228
|
-
}
|
|
25229
|
-
};
|
|
25230
|
-
_proto.callLateUpdate = function callLateUpdate(item, dt) {
|
|
25231
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.itemBehaviours), _step; !(_step = _iterator()).done;){
|
|
25232
|
-
var itemBehaviour = _step.value;
|
|
25233
|
-
if (itemBehaviour.isActiveAndEnabled && itemBehaviour.isStartCalled) {
|
|
25234
|
-
itemBehaviour.lateUpdate(dt);
|
|
25235
|
-
}
|
|
25236
|
-
}
|
|
25237
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.rendererComponents), _step1; !(_step1 = _iterator1()).done;){
|
|
25238
|
-
var rendererComponent = _step1.value;
|
|
25239
|
-
if (rendererComponent.isActiveAndEnabled && rendererComponent.isStartCalled) {
|
|
25240
|
-
rendererComponent.lateUpdate(dt);
|
|
25241
|
-
}
|
|
25242
|
-
}
|
|
25243
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(item.children), _step2; !(_step2 = _iterator2()).done;){
|
|
25244
|
-
var child = _step2.value;
|
|
25245
|
-
this.callLateUpdate(child, dt);
|
|
25246
|
-
}
|
|
25247
|
-
};
|
|
25248
25367
|
/**
|
|
25249
25368
|
* 构建父子树,同时保存到 itemCacheMap 中便于查找
|
|
25250
25369
|
*/ _proto.buildItemTree = function buildItemTree(compVFXItem) {
|
|
@@ -27526,11 +27645,12 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
|
|
|
27526
27645
|
return Engine;
|
|
27527
27646
|
}();
|
|
27528
27647
|
|
|
27648
|
+
var DEFAULT_FPS = 60;
|
|
27529
27649
|
/**
|
|
27530
27650
|
* 定时器类
|
|
27531
27651
|
*/ var Ticker = /*#__PURE__*/ function() {
|
|
27532
27652
|
function Ticker(fps) {
|
|
27533
|
-
if (fps === void 0) fps =
|
|
27653
|
+
if (fps === void 0) fps = DEFAULT_FPS;
|
|
27534
27654
|
this.paused = true;
|
|
27535
27655
|
this.lastTime = 0;
|
|
27536
27656
|
// deltaTime
|
|
@@ -27665,7 +27785,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
|
|
|
27665
27785
|
registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
|
|
27666
27786
|
registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
|
|
27667
27787
|
registerPlugin("interact", InteractLoader, exports.VFXItem, true);
|
|
27668
|
-
var version = "2.0.
|
|
27788
|
+
var version = "2.1.0-alpha.0";
|
|
27669
27789
|
logger.info("Core version: " + version + ".");
|
|
27670
27790
|
|
|
27671
27791
|
exports.AbstractPlugin = AbstractPlugin;
|
|
@@ -27689,6 +27809,7 @@ exports.Composition = Composition;
|
|
|
27689
27809
|
exports.CompositionComponent = CompositionComponent;
|
|
27690
27810
|
exports.CompositionSourceManager = CompositionSourceManager;
|
|
27691
27811
|
exports.DEFAULT_FONTS = DEFAULT_FONTS;
|
|
27812
|
+
exports.DEFAULT_FPS = DEFAULT_FPS;
|
|
27692
27813
|
exports.Database = Database;
|
|
27693
27814
|
exports.Downloader = Downloader;
|
|
27694
27815
|
exports.EFFECTS_COPY_MESH_NAME = EFFECTS_COPY_MESH_NAME;
|