@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.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime core for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.0.
|
|
6
|
+
* Version: v2.1.0-alpha.0
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -4603,87 +4603,109 @@ function getDirectStore(target) {
|
|
|
4603
4603
|
*/ var Component = /*#__PURE__*/ function(EffectsObject) {
|
|
4604
4604
|
_inherits(Component, EffectsObject);
|
|
4605
4605
|
function Component() {
|
|
4606
|
-
return EffectsObject.apply(this, arguments);
|
|
4607
|
-
}
|
|
4608
|
-
var _proto = Component.prototype;
|
|
4609
|
-
_proto.onAttached = function onAttached() {};
|
|
4610
|
-
_proto.onDestroy = function onDestroy() {};
|
|
4611
|
-
_proto.fromData = function fromData(data) {
|
|
4612
|
-
EffectsObject.prototype.fromData.call(this, data);
|
|
4613
|
-
if (data.item) {
|
|
4614
|
-
this.item = data.item;
|
|
4615
|
-
}
|
|
4616
|
-
};
|
|
4617
|
-
_proto.dispose = function dispose() {
|
|
4618
|
-
this.onDestroy();
|
|
4619
|
-
if (this.item) {
|
|
4620
|
-
removeItem(this.item.components, this);
|
|
4621
|
-
}
|
|
4622
|
-
};
|
|
4623
|
-
_create_class(Component, [
|
|
4624
|
-
{
|
|
4625
|
-
key: "transform",
|
|
4626
|
-
get: /**
|
|
4627
|
-
* 附加到的 VFXItem 对象 Transform 组件
|
|
4628
|
-
*/ function get() {
|
|
4629
|
-
return this.item.transform;
|
|
4630
|
-
}
|
|
4631
|
-
}
|
|
4632
|
-
]);
|
|
4633
|
-
return Component;
|
|
4634
|
-
}(EffectsObject);
|
|
4635
|
-
/**
|
|
4636
|
-
* @since 2.0.0
|
|
4637
|
-
*/ var Behaviour = /*#__PURE__*/ function(Component) {
|
|
4638
|
-
_inherits(Behaviour, Component);
|
|
4639
|
-
function Behaviour() {
|
|
4640
4606
|
var _this;
|
|
4641
|
-
_this =
|
|
4607
|
+
_this = EffectsObject.apply(this, arguments) || this;
|
|
4642
4608
|
_this.isAwakeCalled = false;
|
|
4643
4609
|
_this.isStartCalled = false;
|
|
4610
|
+
_this.isEnableCalled = false;
|
|
4644
4611
|
_this._enabled = true;
|
|
4645
4612
|
return _this;
|
|
4646
4613
|
}
|
|
4647
|
-
var _proto =
|
|
4614
|
+
var _proto = Component.prototype;
|
|
4648
4615
|
/**
|
|
4649
4616
|
* 生命周期函数,初始化后调用,生命周期内只调用一次
|
|
4650
|
-
*/ _proto.
|
|
4617
|
+
*/ _proto.onAwake = function onAwake() {
|
|
4651
4618
|
// OVERRIDE
|
|
4652
4619
|
};
|
|
4653
4620
|
/**
|
|
4654
|
-
*
|
|
4621
|
+
* 在 enabled 变为 true 时触发
|
|
4655
4622
|
*/ _proto.onEnable = function onEnable() {
|
|
4656
4623
|
// OVERRIDE
|
|
4657
4624
|
};
|
|
4658
4625
|
/**
|
|
4626
|
+
* 在 enabled 变为 false 时触发
|
|
4627
|
+
*/ _proto.onDisable = function onDisable() {
|
|
4628
|
+
// OVERRIDE
|
|
4629
|
+
};
|
|
4630
|
+
/**
|
|
4659
4631
|
* 生命周期函数,在第一次 update 前调用,生命周期内只调用一次
|
|
4660
|
-
*/ _proto.
|
|
4632
|
+
*/ _proto.onStart = function onStart() {
|
|
4661
4633
|
// OVERRIDE
|
|
4662
4634
|
};
|
|
4663
4635
|
/**
|
|
4664
4636
|
* 生命周期函数,每帧调用一次
|
|
4665
|
-
*/ _proto.
|
|
4637
|
+
*/ _proto.onUpdate = function onUpdate(dt) {
|
|
4666
4638
|
// OVERRIDE
|
|
4667
4639
|
};
|
|
4668
4640
|
/**
|
|
4669
4641
|
* 生命周期函数,每帧调用一次,在 update 之后调用
|
|
4670
|
-
*/ _proto.
|
|
4642
|
+
*/ _proto.onLateUpdate = function onLateUpdate(dt) {
|
|
4643
|
+
// OVERRIDE
|
|
4644
|
+
};
|
|
4645
|
+
/**
|
|
4646
|
+
* 生命周期函数,在组件销毁时调用
|
|
4647
|
+
*/ _proto.onDestroy = function onDestroy() {
|
|
4671
4648
|
// OVERRIDE
|
|
4672
4649
|
};
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
this.
|
|
4650
|
+
/**
|
|
4651
|
+
* @internal
|
|
4652
|
+
*/ _proto.enable = function enable() {
|
|
4653
|
+
if (this.item.composition) {
|
|
4654
|
+
this.item.composition.sceneTicking.addComponent(this);
|
|
4655
|
+
this.isEnableCalled = true;
|
|
4656
|
+
}
|
|
4657
|
+
this.onEnable();
|
|
4658
|
+
};
|
|
4659
|
+
/**
|
|
4660
|
+
* @internal
|
|
4661
|
+
*/ _proto.disable = function disable() {
|
|
4662
|
+
this.onDisable();
|
|
4663
|
+
if (this.item.composition) {
|
|
4664
|
+
this.isEnableCalled = false;
|
|
4665
|
+
this.item.composition.sceneTicking.removeComponent(this);
|
|
4666
|
+
}
|
|
4667
|
+
};
|
|
4668
|
+
_proto.setVFXItem = function setVFXItem(item) {
|
|
4669
|
+
this.item = item;
|
|
4670
|
+
if (item.isDuringPlay) {
|
|
4671
|
+
if (!this.isAwakeCalled) {
|
|
4672
|
+
this.onAwake();
|
|
4673
|
+
this.isAwakeCalled = true;
|
|
4674
|
+
}
|
|
4675
|
+
if (item.getVisible() && this.enabled) {
|
|
4676
|
+
this.start();
|
|
4677
|
+
this.enable();
|
|
4678
|
+
}
|
|
4679
|
+
}
|
|
4680
|
+
};
|
|
4681
|
+
_proto.fromData = function fromData(data) {
|
|
4682
|
+
EffectsObject.prototype.fromData.call(this, data);
|
|
4683
|
+
if (data.item) {
|
|
4684
|
+
this.item = data.item;
|
|
4678
4685
|
}
|
|
4679
4686
|
};
|
|
4680
4687
|
_proto.dispose = function dispose() {
|
|
4688
|
+
this.onDestroy();
|
|
4681
4689
|
if (this.item) {
|
|
4682
|
-
removeItem(this.item.
|
|
4690
|
+
removeItem(this.item.components, this);
|
|
4683
4691
|
}
|
|
4684
|
-
Component.prototype.dispose.call(this);
|
|
4685
4692
|
};
|
|
4686
|
-
|
|
4693
|
+
_proto.start = function start() {
|
|
4694
|
+
if (this.isStartCalled) {
|
|
4695
|
+
return;
|
|
4696
|
+
}
|
|
4697
|
+
this.isStartCalled = true;
|
|
4698
|
+
this.onStart();
|
|
4699
|
+
};
|
|
4700
|
+
_create_class(Component, [
|
|
4701
|
+
{
|
|
4702
|
+
key: "transform",
|
|
4703
|
+
get: /**
|
|
4704
|
+
* 附加到的 VFXItem 对象 Transform 组件
|
|
4705
|
+
*/ function get() {
|
|
4706
|
+
return this.item.transform;
|
|
4707
|
+
}
|
|
4708
|
+
},
|
|
4687
4709
|
{
|
|
4688
4710
|
key: "isActiveAndEnabled",
|
|
4689
4711
|
get: /**
|
|
@@ -4698,24 +4720,46 @@ function getDirectStore(target) {
|
|
|
4698
4720
|
return this._enabled;
|
|
4699
4721
|
},
|
|
4700
4722
|
set: function set(value) {
|
|
4701
|
-
this.
|
|
4702
|
-
|
|
4703
|
-
if (
|
|
4704
|
-
this.
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4723
|
+
if (this.enabled !== value) {
|
|
4724
|
+
this._enabled = value;
|
|
4725
|
+
if (value) {
|
|
4726
|
+
if (this.isActiveAndEnabled) {
|
|
4727
|
+
this.enable();
|
|
4728
|
+
if (!this.isStartCalled) {
|
|
4729
|
+
this.onStart();
|
|
4730
|
+
this.isStartCalled = true;
|
|
4731
|
+
}
|
|
4732
|
+
}
|
|
4733
|
+
} else {
|
|
4734
|
+
if (this.isEnableCalled) {
|
|
4735
|
+
this.disable();
|
|
4736
|
+
}
|
|
4709
4737
|
}
|
|
4710
4738
|
}
|
|
4711
4739
|
}
|
|
4712
4740
|
}
|
|
4713
4741
|
]);
|
|
4714
|
-
return
|
|
4715
|
-
}(
|
|
4742
|
+
return Component;
|
|
4743
|
+
}(EffectsObject);
|
|
4716
4744
|
__decorate([
|
|
4717
4745
|
serialize()
|
|
4718
|
-
],
|
|
4746
|
+
], Component.prototype, "_enabled", void 0);
|
|
4747
|
+
/**
|
|
4748
|
+
* @since 2.0.0
|
|
4749
|
+
*/ var Behaviour = /*#__PURE__*/ function(Component) {
|
|
4750
|
+
_inherits(Behaviour, Component);
|
|
4751
|
+
function Behaviour() {
|
|
4752
|
+
return Component.apply(this, arguments);
|
|
4753
|
+
}
|
|
4754
|
+
var _proto = Behaviour.prototype;
|
|
4755
|
+
_proto.setVFXItem = function setVFXItem(item) {
|
|
4756
|
+
Component.prototype.setVFXItem.call(this, item);
|
|
4757
|
+
};
|
|
4758
|
+
_proto.dispose = function dispose() {
|
|
4759
|
+
Component.prototype.dispose.call(this);
|
|
4760
|
+
};
|
|
4761
|
+
return Behaviour;
|
|
4762
|
+
}(Component);
|
|
4719
4763
|
|
|
4720
4764
|
/**
|
|
4721
4765
|
* 所有渲染组件的基类
|
|
@@ -4725,19 +4769,14 @@ __decorate([
|
|
|
4725
4769
|
function RendererComponent() {
|
|
4726
4770
|
var _this;
|
|
4727
4771
|
_this = Component.apply(this, arguments) || this;
|
|
4728
|
-
_this.isStartCalled = false;
|
|
4729
4772
|
_this.materials = [];
|
|
4730
4773
|
_this._priority = 0;
|
|
4731
|
-
_this._enabled = true;
|
|
4732
4774
|
return _this;
|
|
4733
4775
|
}
|
|
4734
4776
|
var _proto = RendererComponent.prototype;
|
|
4735
|
-
_proto.onEnable = function onEnable() {};
|
|
4736
|
-
_proto.start = function start() {};
|
|
4737
|
-
_proto.update = function update(dt) {};
|
|
4738
|
-
_proto.lateUpdate = function lateUpdate(dt) {};
|
|
4739
4777
|
_proto.render = function render(renderer) {};
|
|
4740
|
-
_proto.
|
|
4778
|
+
_proto.setVFXItem = function setVFXItem(item) {
|
|
4779
|
+
Component.prototype.setVFXItem.call(this, item);
|
|
4741
4780
|
this.item.rendererComponents.push(this);
|
|
4742
4781
|
};
|
|
4743
4782
|
_proto.fromData = function fromData(data) {
|
|
@@ -4762,26 +4801,6 @@ __decorate([
|
|
|
4762
4801
|
this._priority = value;
|
|
4763
4802
|
}
|
|
4764
4803
|
},
|
|
4765
|
-
{
|
|
4766
|
-
key: "enabled",
|
|
4767
|
-
get: function get() {
|
|
4768
|
-
return this._enabled;
|
|
4769
|
-
},
|
|
4770
|
-
set: function set(value) {
|
|
4771
|
-
this._enabled = value;
|
|
4772
|
-
if (value) {
|
|
4773
|
-
this.onEnable();
|
|
4774
|
-
}
|
|
4775
|
-
}
|
|
4776
|
-
},
|
|
4777
|
-
{
|
|
4778
|
-
key: "isActiveAndEnabled",
|
|
4779
|
-
get: /**
|
|
4780
|
-
* 组件是否可以更新,true 更新,false 不更新
|
|
4781
|
-
*/ function get() {
|
|
4782
|
-
return this.item.getVisible() && this.enabled;
|
|
4783
|
-
}
|
|
4784
|
-
},
|
|
4785
4804
|
{
|
|
4786
4805
|
key: "material",
|
|
4787
4806
|
get: function get() {
|
|
@@ -4804,9 +4823,6 @@ __decorate([
|
|
|
4804
4823
|
__decorate([
|
|
4805
4824
|
serialize()
|
|
4806
4825
|
], RendererComponent.prototype, "_priority", void 0);
|
|
4807
|
-
__decorate([
|
|
4808
|
-
serialize()
|
|
4809
|
-
], RendererComponent.prototype, "_enabled", void 0);
|
|
4810
4826
|
|
|
4811
4827
|
/**
|
|
4812
4828
|
* 抽象插件类
|
|
@@ -4850,7 +4866,7 @@ var CameraController = /*#__PURE__*/ function(Behaviour) {
|
|
|
4850
4866
|
return _this;
|
|
4851
4867
|
}
|
|
4852
4868
|
var _proto = CameraController.prototype;
|
|
4853
|
-
_proto.
|
|
4869
|
+
_proto.onUpdate = function onUpdate() {
|
|
4854
4870
|
if (this.item.composition && this.item.transform.getValid()) {
|
|
4855
4871
|
var camera = this.item.composition.camera;
|
|
4856
4872
|
camera.near = this.options.near;
|
|
@@ -8082,7 +8098,7 @@ function _loadVideo() {
|
|
|
8082
8098
|
}, true);
|
|
8083
8099
|
}
|
|
8084
8100
|
video.addEventListener("error", function(e) {
|
|
8085
|
-
reject(
|
|
8101
|
+
reject("Load video fail.");
|
|
8086
8102
|
});
|
|
8087
8103
|
})
|
|
8088
8104
|
];
|
|
@@ -13248,7 +13264,7 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13248
13264
|
return _this;
|
|
13249
13265
|
}
|
|
13250
13266
|
var _proto = InteractComponent.prototype;
|
|
13251
|
-
_proto.
|
|
13267
|
+
_proto.onStart = function onStart() {
|
|
13252
13268
|
var _this = this;
|
|
13253
13269
|
var options = this.item.props.content.options;
|
|
13254
13270
|
var env = this.item.engine.renderer.env;
|
|
@@ -13284,8 +13300,11 @@ var InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13284
13300
|
}
|
|
13285
13301
|
};
|
|
13286
13302
|
};
|
|
13287
|
-
_proto.
|
|
13303
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
13288
13304
|
var _this_previewContent;
|
|
13305
|
+
if (!this.isActiveAndEnabled) {
|
|
13306
|
+
return;
|
|
13307
|
+
}
|
|
13289
13308
|
(_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.updateMesh();
|
|
13290
13309
|
if (!this.hasBeenAddedToComposition && this.item.composition) {
|
|
13291
13310
|
var options = this.item.props.content.options;
|
|
@@ -13556,7 +13575,6 @@ function _assert_this_initialized(self) {
|
|
|
13556
13575
|
/**
|
|
13557
13576
|
* 动画图,负责更新所有的动画节点
|
|
13558
13577
|
* @since 2.0.0
|
|
13559
|
-
* @internal
|
|
13560
13578
|
*/ var PlayableGraph = /*#__PURE__*/ function() {
|
|
13561
13579
|
function PlayableGraph() {
|
|
13562
13580
|
this.playableOutputs = [];
|
|
@@ -13616,7 +13634,6 @@ function _assert_this_initialized(self) {
|
|
|
13616
13634
|
/**
|
|
13617
13635
|
* 动画图可播放节点对象
|
|
13618
13636
|
* @since 2.0.0
|
|
13619
|
-
* @internal
|
|
13620
13637
|
*/ var Playable = /*#__PURE__*/ function() {
|
|
13621
13638
|
function Playable(graph, inputCount) {
|
|
13622
13639
|
if (inputCount === void 0) inputCount = 0;
|
|
@@ -13630,6 +13647,9 @@ function _assert_this_initialized(self) {
|
|
|
13630
13647
|
this.outputs = [];
|
|
13631
13648
|
this.playState = 0;
|
|
13632
13649
|
this.traversalMode = 0;
|
|
13650
|
+
/**
|
|
13651
|
+
* 当前本地播放的时间
|
|
13652
|
+
*/ this.time = 0;
|
|
13633
13653
|
graph.addPlayable(this);
|
|
13634
13654
|
this.inputs = new Array(inputCount);
|
|
13635
13655
|
this.inputOuputPorts = new Array(inputCount);
|
|
@@ -13814,7 +13834,6 @@ function _assert_this_initialized(self) {
|
|
|
13814
13834
|
/**
|
|
13815
13835
|
* 动画图输出节点对象,将动画数据采样到绑定的元素属性上
|
|
13816
13836
|
* @since 2.0.0
|
|
13817
|
-
* @internal
|
|
13818
13837
|
*/ var PlayableOutput = /*#__PURE__*/ function() {
|
|
13819
13838
|
function PlayableOutput() {
|
|
13820
13839
|
this.sourceOutputPort = 0;
|
|
@@ -14076,10 +14095,10 @@ var SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
14076
14095
|
this.material.setVector2("_Size", this.transform.size);
|
|
14077
14096
|
renderer.drawGeometry(geo, material);
|
|
14078
14097
|
};
|
|
14079
|
-
_proto.
|
|
14098
|
+
_proto.onStart = function onStart() {
|
|
14080
14099
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
14081
14100
|
};
|
|
14082
|
-
_proto.
|
|
14101
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
14083
14102
|
if (!this.isManualTimeSet) {
|
|
14084
14103
|
this.frameAnimationTime += dt / 1000;
|
|
14085
14104
|
this.isManualTimeSet = false;
|
|
@@ -16502,15 +16521,15 @@ function getTrailMeshShader(trails, particleMaxCount, name, gpuCapability, env)
|
|
|
16502
16521
|
return _this;
|
|
16503
16522
|
}
|
|
16504
16523
|
var _proto = ParticleSystemRenderer.prototype;
|
|
16505
|
-
_proto.
|
|
16524
|
+
_proto.onStart = function onStart() {
|
|
16506
16525
|
this._priority = this.item.renderOrder;
|
|
16507
16526
|
this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);
|
|
16508
16527
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.meshes), _step; !(_step = _iterator()).done;){
|
|
16509
16528
|
var mesh = _step.value;
|
|
16510
|
-
mesh.
|
|
16529
|
+
mesh.onStart();
|
|
16511
16530
|
}
|
|
16512
16531
|
};
|
|
16513
|
-
_proto.
|
|
16532
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
16514
16533
|
var time = this.particleMesh.time;
|
|
16515
16534
|
this.particleMesh.mesh.material.setVector4("uParams", new Vector4(time, this.item.duration, 0, 0));
|
|
16516
16535
|
};
|
|
@@ -16734,7 +16753,7 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16734
16753
|
_proto.getTextures = function getTextures() {
|
|
16735
16754
|
return this.renderer.getTextures();
|
|
16736
16755
|
};
|
|
16737
|
-
_proto.
|
|
16756
|
+
_proto.startEmit = function startEmit() {
|
|
16738
16757
|
if (!this.started || this.ended) {
|
|
16739
16758
|
this.reset();
|
|
16740
16759
|
this.started = true;
|
|
@@ -16760,7 +16779,7 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16760
16779
|
this.frozen = false;
|
|
16761
16780
|
this.ended = false;
|
|
16762
16781
|
};
|
|
16763
|
-
_proto.
|
|
16782
|
+
_proto.update = function update(delta) {
|
|
16764
16783
|
var _this = this;
|
|
16765
16784
|
if (this.started && !this.frozen) {
|
|
16766
16785
|
var now = this.lastUpdate + delta / 1000;
|
|
@@ -17543,7 +17562,6 @@ function randomArrItem(arr, keepArr) {
|
|
|
17543
17562
|
|
|
17544
17563
|
/**
|
|
17545
17564
|
* @since 2.0.0
|
|
17546
|
-
* @internal
|
|
17547
17565
|
*/ var ParticleBehaviourPlayable = /*#__PURE__*/ function(Playable) {
|
|
17548
17566
|
_inherits(ParticleBehaviourPlayable, Playable);
|
|
17549
17567
|
function ParticleBehaviourPlayable() {
|
|
@@ -17561,7 +17579,7 @@ function randomArrItem(arr, keepArr) {
|
|
|
17561
17579
|
this.particleSystem = boundObject.getComponent(ParticleSystem);
|
|
17562
17580
|
if (this.particleSystem) {
|
|
17563
17581
|
this.particleSystem.name = boundObject.name;
|
|
17564
|
-
this.particleSystem.
|
|
17582
|
+
this.particleSystem.startEmit();
|
|
17565
17583
|
this.particleSystem.initEmitterTransform();
|
|
17566
17584
|
}
|
|
17567
17585
|
};
|
|
@@ -17581,7 +17599,7 @@ function randomArrItem(arr, keepArr) {
|
|
|
17581
17599
|
if (Math.abs(this.time - this.lastTime) < 0.001) {
|
|
17582
17600
|
deltaTime = 0;
|
|
17583
17601
|
}
|
|
17584
|
-
particleSystem.
|
|
17602
|
+
particleSystem.update(deltaTime);
|
|
17585
17603
|
}
|
|
17586
17604
|
this.lastTime = this.time;
|
|
17587
17605
|
};
|
|
@@ -18603,7 +18621,6 @@ var tempSize = new Vector3(1, 1, 1);
|
|
|
18603
18621
|
var tempPos = new Vector3();
|
|
18604
18622
|
/**
|
|
18605
18623
|
* @since 2.0.0
|
|
18606
|
-
* @internal
|
|
18607
18624
|
*/ var TransformAnimationPlayable = /*#__PURE__*/ function(AnimationPlayable) {
|
|
18608
18625
|
_inherits(TransformAnimationPlayable, AnimationPlayable);
|
|
18609
18626
|
function TransformAnimationPlayable() {
|
|
@@ -18765,7 +18782,6 @@ TransformPlayableAsset = __decorate([
|
|
|
18765
18782
|
], TransformPlayableAsset);
|
|
18766
18783
|
/**
|
|
18767
18784
|
* @since 2.0.0
|
|
18768
|
-
* @internal
|
|
18769
18785
|
*/ var ActivationPlayable = /*#__PURE__*/ function(Playable) {
|
|
18770
18786
|
_inherits(ActivationPlayable, Playable);
|
|
18771
18787
|
function ActivationPlayable() {
|
|
@@ -18916,7 +18932,6 @@ var AnimationClipPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
18916
18932
|
|
|
18917
18933
|
/**
|
|
18918
18934
|
* @since 2.0.0
|
|
18919
|
-
* @internal
|
|
18920
18935
|
*/ var TimelineClip = /*#__PURE__*/ function() {
|
|
18921
18936
|
function TimelineClip() {
|
|
18922
18937
|
this.start = 0;
|
|
@@ -19314,25 +19329,15 @@ var TrackSortWrapper = function TrackSortWrapper(track, originalIndex) {
|
|
|
19314
19329
|
this.track = track;
|
|
19315
19330
|
this.originalIndex = originalIndex;
|
|
19316
19331
|
};
|
|
19317
|
-
function isAncestor(ancestorCandidate, descendantCandidate) {
|
|
19318
|
-
var current = descendantCandidate.parent;
|
|
19319
|
-
while(current){
|
|
19320
|
-
if (current === ancestorCandidate) {
|
|
19321
|
-
return true;
|
|
19322
|
-
}
|
|
19323
|
-
current = current.parent;
|
|
19324
|
-
}
|
|
19325
|
-
return false;
|
|
19326
|
-
}
|
|
19327
19332
|
function compareTracks(a, b) {
|
|
19328
19333
|
var bindingA = a.track.binding;
|
|
19329
19334
|
var bindingB = b.track.binding;
|
|
19330
19335
|
if (!_instanceof1(bindingA, VFXItem) || !_instanceof1(bindingB, VFXItem)) {
|
|
19331
19336
|
return a.originalIndex - b.originalIndex;
|
|
19332
19337
|
}
|
|
19333
|
-
if (isAncestor(bindingA, bindingB)) {
|
|
19338
|
+
if (VFXItem.isAncestor(bindingA, bindingB)) {
|
|
19334
19339
|
return -1;
|
|
19335
|
-
} else if (isAncestor(bindingB, bindingA)) {
|
|
19340
|
+
} else if (VFXItem.isAncestor(bindingB, bindingA)) {
|
|
19336
19341
|
return 1;
|
|
19337
19342
|
} else {
|
|
19338
19343
|
return a.originalIndex - b.originalIndex; // 非父子关系的元素保持原始顺序
|
|
@@ -19356,7 +19361,7 @@ function compareTracks(a, b) {
|
|
|
19356
19361
|
return _this;
|
|
19357
19362
|
}
|
|
19358
19363
|
var _proto = CompositionComponent.prototype;
|
|
19359
|
-
_proto.
|
|
19364
|
+
_proto.onStart = function onStart() {
|
|
19360
19365
|
var _this_item_props = this.item.props, _this_item_props_startTime = _this_item_props.startTime, startTime = _this_item_props_startTime === void 0 ? 0 : _this_item_props_startTime;
|
|
19361
19366
|
this.startTime = startTime;
|
|
19362
19367
|
this.resolveBindings();
|
|
@@ -19384,7 +19389,7 @@ function compareTracks(a, b) {
|
|
|
19384
19389
|
_proto.getReusable = function getReusable() {
|
|
19385
19390
|
return this.reusable;
|
|
19386
19391
|
};
|
|
19387
|
-
_proto.
|
|
19392
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
19388
19393
|
var time = this.time;
|
|
19389
19394
|
this.timelinePlayable.setTime(time);
|
|
19390
19395
|
this.graph.evaluate(dt);
|
|
@@ -19420,7 +19425,9 @@ function compareTracks(a, b) {
|
|
|
19420
19425
|
props.content = itemData.content;
|
|
19421
19426
|
item = assetLoader.loadGUID(itemData.id);
|
|
19422
19427
|
item.composition = this.item.composition;
|
|
19423
|
-
var compositionComponent =
|
|
19428
|
+
var compositionComponent = new CompositionComponent(this.engine);
|
|
19429
|
+
compositionComponent.item = item;
|
|
19430
|
+
item.components.push(compositionComponent);
|
|
19424
19431
|
compositionComponent.data = props;
|
|
19425
19432
|
compositionComponent.refId = refId;
|
|
19426
19433
|
item.transform.parentTransform = this.transform;
|
|
@@ -19831,8 +19838,8 @@ var TextComponent = /*#__PURE__*/ function(SpriteComponent) {
|
|
|
19831
19838
|
return _this;
|
|
19832
19839
|
}
|
|
19833
19840
|
var _proto = TextComponent.prototype;
|
|
19834
|
-
_proto.
|
|
19835
|
-
SpriteComponent.prototype.
|
|
19841
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
19842
|
+
SpriteComponent.prototype.onUpdate.call(this, dt);
|
|
19836
19843
|
this.updateTexture();
|
|
19837
19844
|
};
|
|
19838
19845
|
_proto.fromData = function fromData(data) {
|
|
@@ -20247,7 +20254,7 @@ var EffectComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
20247
20254
|
return _this;
|
|
20248
20255
|
}
|
|
20249
20256
|
var _proto = EffectComponent.prototype;
|
|
20250
|
-
_proto.
|
|
20257
|
+
_proto.onStart = function onStart() {
|
|
20251
20258
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
20252
20259
|
};
|
|
20253
20260
|
_proto.render = function render(renderer) {
|
|
@@ -20374,7 +20381,7 @@ var PostProcessVolume = /*#__PURE__*/ function(Behaviour) {
|
|
|
20374
20381
|
return _this;
|
|
20375
20382
|
}
|
|
20376
20383
|
var _proto = PostProcessVolume.prototype;
|
|
20377
|
-
_proto.
|
|
20384
|
+
_proto.onStart = function onStart() {
|
|
20378
20385
|
var composition = this.item.composition;
|
|
20379
20386
|
if (composition) {
|
|
20380
20387
|
composition.globalVolume = this;
|
|
@@ -20516,8 +20523,8 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20516
20523
|
*/ _this.ended = false;
|
|
20517
20524
|
_this.reusable = false;
|
|
20518
20525
|
_this.type = ItemType.base;
|
|
20526
|
+
_this.isDuringPlay = false;
|
|
20519
20527
|
_this.components = [];
|
|
20520
|
-
_this.itemBehaviours = [];
|
|
20521
20528
|
_this.rendererComponents = [];
|
|
20522
20529
|
/**
|
|
20523
20530
|
* 元素可见性,该值的改变会触发 `handleVisibleChanged` 回调
|
|
@@ -20527,6 +20534,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20527
20534
|
* 元素动画的速度
|
|
20528
20535
|
*/ _this.speed = 1;
|
|
20529
20536
|
_this.listIndex = 0;
|
|
20537
|
+
_this.isEnabled = false;
|
|
20530
20538
|
_this.eventProcessor = new EventEmitter();
|
|
20531
20539
|
_this.name = "VFXItem";
|
|
20532
20540
|
_this.transform.name = _this.name;
|
|
@@ -20599,8 +20607,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20599
20607
|
*/ _proto.addComponent = function addComponent(classConstructor) {
|
|
20600
20608
|
var newComponent = new classConstructor(this.engine);
|
|
20601
20609
|
this.components.push(newComponent);
|
|
20602
|
-
newComponent.
|
|
20603
|
-
newComponent.onAttached();
|
|
20610
|
+
newComponent.setVFXItem(this);
|
|
20604
20611
|
return newComponent;
|
|
20605
20612
|
};
|
|
20606
20613
|
/**
|
|
@@ -20633,21 +20640,22 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20633
20640
|
return res;
|
|
20634
20641
|
};
|
|
20635
20642
|
_proto.setParent = function setParent(vfxItem) {
|
|
20636
|
-
if (vfxItem === this) {
|
|
20643
|
+
if (vfxItem === this && !vfxItem) {
|
|
20637
20644
|
return;
|
|
20638
20645
|
}
|
|
20639
20646
|
if (this.parent) {
|
|
20640
20647
|
removeItem(this.parent.children, this);
|
|
20641
20648
|
}
|
|
20642
20649
|
this.parent = vfxItem;
|
|
20643
|
-
if (
|
|
20644
|
-
|
|
20645
|
-
|
|
20646
|
-
|
|
20647
|
-
|
|
20648
|
-
|
|
20649
|
-
|
|
20650
|
-
|
|
20650
|
+
if (!VFXItem.isCamera(this)) {
|
|
20651
|
+
this.transform.parentTransform = vfxItem.transform;
|
|
20652
|
+
}
|
|
20653
|
+
vfxItem.children.push(this);
|
|
20654
|
+
if (!this.composition) {
|
|
20655
|
+
this.composition = vfxItem.composition;
|
|
20656
|
+
}
|
|
20657
|
+
if (!this.isDuringPlay && vfxItem.isDuringPlay) {
|
|
20658
|
+
this.beginPlay();
|
|
20651
20659
|
}
|
|
20652
20660
|
};
|
|
20653
20661
|
/**
|
|
@@ -20678,6 +20686,7 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20678
20686
|
*/ _proto.setVisible = function setVisible(visible) {
|
|
20679
20687
|
if (this.visible !== visible) {
|
|
20680
20688
|
this.visible = !!visible;
|
|
20689
|
+
this.onActiveChanged();
|
|
20681
20690
|
}
|
|
20682
20691
|
};
|
|
20683
20692
|
/**
|
|
@@ -20802,6 +20811,57 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20802
20811
|
}
|
|
20803
20812
|
return undefined;
|
|
20804
20813
|
};
|
|
20814
|
+
/**
|
|
20815
|
+
* @internal
|
|
20816
|
+
*/ _proto.beginPlay = function beginPlay() {
|
|
20817
|
+
this.isDuringPlay = true;
|
|
20818
|
+
if (this.composition && this.visible && !this.isEnabled) {
|
|
20819
|
+
this.onEnable();
|
|
20820
|
+
}
|
|
20821
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
20822
|
+
var child = _step.value;
|
|
20823
|
+
if (!child.isDuringPlay) {
|
|
20824
|
+
child.beginPlay();
|
|
20825
|
+
}
|
|
20826
|
+
}
|
|
20827
|
+
};
|
|
20828
|
+
/**
|
|
20829
|
+
* @internal
|
|
20830
|
+
*/ _proto.onActiveChanged = function onActiveChanged() {
|
|
20831
|
+
if (!this.isEnabled) {
|
|
20832
|
+
this.onEnable();
|
|
20833
|
+
} else {
|
|
20834
|
+
this.onDisable();
|
|
20835
|
+
}
|
|
20836
|
+
};
|
|
20837
|
+
/**
|
|
20838
|
+
* @internal
|
|
20839
|
+
*/ _proto.onEnable = function onEnable() {
|
|
20840
|
+
this.isEnabled = true;
|
|
20841
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
20842
|
+
var component = _step.value;
|
|
20843
|
+
if (component.enabled && !component.isStartCalled) {
|
|
20844
|
+
component.onStart();
|
|
20845
|
+
}
|
|
20846
|
+
}
|
|
20847
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.components), _step1; !(_step1 = _iterator1()).done;){
|
|
20848
|
+
var component1 = _step1.value;
|
|
20849
|
+
if (component1.enabled && !component1.isEnableCalled) {
|
|
20850
|
+
component1.enable();
|
|
20851
|
+
}
|
|
20852
|
+
}
|
|
20853
|
+
};
|
|
20854
|
+
/**
|
|
20855
|
+
* @internal
|
|
20856
|
+
*/ _proto.onDisable = function onDisable() {
|
|
20857
|
+
this.isEnabled = false;
|
|
20858
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
20859
|
+
var component = _step.value;
|
|
20860
|
+
if (component.enabled && component.isEnableCalled) {
|
|
20861
|
+
component.disable();
|
|
20862
|
+
}
|
|
20863
|
+
}
|
|
20864
|
+
};
|
|
20805
20865
|
_proto.fromData = function fromData(data) {
|
|
20806
20866
|
EffectsObject.prototype.fromData.call(this, data);
|
|
20807
20867
|
var id = data.id, name = data.name, delay = data.delay, parentId = data.parentId, endBehavior = data.endBehavior, transform = data.transform, _data_listIndex = data.listIndex, listIndex = _data_listIndex === void 0 ? 0 : _data_listIndex, _data_duration = data.duration, duration = _data_duration === void 0 ? 0 : _data_duration;
|
|
@@ -20851,14 +20911,10 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20851
20911
|
if (duration <= 0) {
|
|
20852
20912
|
throw new Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"] + ".");
|
|
20853
20913
|
}
|
|
20854
|
-
this.itemBehaviours.length = 0;
|
|
20855
20914
|
this.rendererComponents.length = 0;
|
|
20856
20915
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
20857
20916
|
var component = _step.value;
|
|
20858
20917
|
component.item = this;
|
|
20859
|
-
if (_instanceof1(component, Behaviour)) {
|
|
20860
|
-
this.itemBehaviours.push(component);
|
|
20861
|
-
}
|
|
20862
20918
|
if (_instanceof1(component, RendererComponent)) {
|
|
20863
20919
|
this.rendererComponents.push(component);
|
|
20864
20920
|
}
|
|
@@ -20963,6 +21019,16 @@ var VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20963
21019
|
VFXItem.isExtraCamera = function isExtraCamera(item) {
|
|
20964
21020
|
return item.id === "extra-camera" && item.name === "extra-camera";
|
|
20965
21021
|
};
|
|
21022
|
+
VFXItem.isAncestor = function isAncestor(ancestorCandidate, descendantCandidate) {
|
|
21023
|
+
var current = descendantCandidate.parent;
|
|
21024
|
+
while(current){
|
|
21025
|
+
if (current === ancestorCandidate) {
|
|
21026
|
+
return true;
|
|
21027
|
+
}
|
|
21028
|
+
current = current.parent;
|
|
21029
|
+
}
|
|
21030
|
+
return false;
|
|
21031
|
+
};
|
|
20966
21032
|
_create_class(VFXItem, [
|
|
20967
21033
|
{
|
|
20968
21034
|
key: "content",
|
|
@@ -24100,7 +24166,7 @@ var seed = 1;
|
|
|
24100
24166
|
];
|
|
24101
24167
|
case 6:
|
|
24102
24168
|
e = _state.sent();
|
|
24103
|
-
throw new Error("Failed to load. Check the template or if the URL is " + (isVideo ? "video" : "image") + " type, URL: " + url + ", Error: " + e.message + ".");
|
|
24169
|
+
throw new Error("Failed to load. Check the template or if the URL is " + (isVideo ? "video" : "image") + " type, URL: " + url + ", Error: " + (e.message || e) + ".");
|
|
24104
24170
|
case 7:
|
|
24105
24171
|
return [
|
|
24106
24172
|
3,
|
|
@@ -24835,6 +24901,109 @@ var listOrder = 0;
|
|
|
24835
24901
|
return CompositionSourceManager;
|
|
24836
24902
|
}();
|
|
24837
24903
|
|
|
24904
|
+
var SceneTicking = /*#__PURE__*/ function() {
|
|
24905
|
+
function SceneTicking() {
|
|
24906
|
+
this.update = new UpdateTickData();
|
|
24907
|
+
this.lateUpdate = new LateUpdateTickData();
|
|
24908
|
+
}
|
|
24909
|
+
var _proto = SceneTicking.prototype;
|
|
24910
|
+
_proto.addComponent = function addComponent(obj) {
|
|
24911
|
+
if (obj.onUpdate !== Component.prototype.onUpdate) {
|
|
24912
|
+
this.update.addComponent(obj);
|
|
24913
|
+
}
|
|
24914
|
+
if (obj.onLateUpdate !== Component.prototype.onLateUpdate) {
|
|
24915
|
+
this.lateUpdate.addComponent(obj);
|
|
24916
|
+
}
|
|
24917
|
+
};
|
|
24918
|
+
_proto.removeComponent = function removeComponent(obj) {
|
|
24919
|
+
if (obj.onUpdate !== Component.prototype.onUpdate) {
|
|
24920
|
+
this.update.removeComponent(obj);
|
|
24921
|
+
}
|
|
24922
|
+
if (obj.onLateUpdate !== Component.prototype.onLateUpdate) {
|
|
24923
|
+
this.lateUpdate.removeComponent(obj);
|
|
24924
|
+
}
|
|
24925
|
+
};
|
|
24926
|
+
_proto.clear = function clear() {
|
|
24927
|
+
this.update.clear();
|
|
24928
|
+
this.lateUpdate.clear();
|
|
24929
|
+
};
|
|
24930
|
+
return SceneTicking;
|
|
24931
|
+
}();
|
|
24932
|
+
var TickData = /*#__PURE__*/ function() {
|
|
24933
|
+
function TickData() {
|
|
24934
|
+
this.components = [];
|
|
24935
|
+
this.ticks = [];
|
|
24936
|
+
}
|
|
24937
|
+
var _proto = TickData.prototype;
|
|
24938
|
+
_proto.tick = function tick(dt) {
|
|
24939
|
+
this.tickComponents(this.components, dt);
|
|
24940
|
+
for(var i = 0; i < this.ticks.length; i++){
|
|
24941
|
+
this.ticks[i](dt);
|
|
24942
|
+
}
|
|
24943
|
+
};
|
|
24944
|
+
_proto.tickComponents = function tickComponents(components, dt) {
|
|
24945
|
+
// To be implemented in derived classes
|
|
24946
|
+
};
|
|
24947
|
+
_proto.addComponent = function addComponent(component) {
|
|
24948
|
+
if (!this.components.includes(component)) {
|
|
24949
|
+
this.components.push(component);
|
|
24950
|
+
}
|
|
24951
|
+
};
|
|
24952
|
+
_proto.removeComponent = function removeComponent(component) {
|
|
24953
|
+
var index = this.components.indexOf(component);
|
|
24954
|
+
if (index > -1) {
|
|
24955
|
+
this.components.splice(index, 1);
|
|
24956
|
+
}
|
|
24957
|
+
};
|
|
24958
|
+
_proto.addTick = function addTick(method, callee) {
|
|
24959
|
+
var tick = method.bind(callee);
|
|
24960
|
+
if (!this.ticks.includes(tick)) {
|
|
24961
|
+
this.ticks.push(tick);
|
|
24962
|
+
}
|
|
24963
|
+
};
|
|
24964
|
+
_proto.clear = function clear() {
|
|
24965
|
+
this.components = [];
|
|
24966
|
+
};
|
|
24967
|
+
return TickData;
|
|
24968
|
+
}();
|
|
24969
|
+
var UpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
24970
|
+
_inherits(UpdateTickData, TickData);
|
|
24971
|
+
function UpdateTickData() {
|
|
24972
|
+
return TickData.apply(this, arguments);
|
|
24973
|
+
}
|
|
24974
|
+
var _proto = UpdateTickData.prototype;
|
|
24975
|
+
_proto.tickComponents = function tickComponents(components, dt) {
|
|
24976
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(components), _step; !(_step = _iterator()).done;){
|
|
24977
|
+
var component = _step.value;
|
|
24978
|
+
component.onUpdate(dt);
|
|
24979
|
+
}
|
|
24980
|
+
};
|
|
24981
|
+
return UpdateTickData;
|
|
24982
|
+
}(TickData);
|
|
24983
|
+
var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
24984
|
+
_inherits(LateUpdateTickData, TickData);
|
|
24985
|
+
function LateUpdateTickData() {
|
|
24986
|
+
return TickData.apply(this, arguments);
|
|
24987
|
+
}
|
|
24988
|
+
var _proto = LateUpdateTickData.prototype;
|
|
24989
|
+
_proto.tickComponents = function tickComponents(components, dt) {
|
|
24990
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(components), _step; !(_step = _iterator()).done;){
|
|
24991
|
+
var component = _step.value;
|
|
24992
|
+
component.onLateUpdate(dt);
|
|
24993
|
+
}
|
|
24994
|
+
};
|
|
24995
|
+
return LateUpdateTickData;
|
|
24996
|
+
} // function compareComponents (a: Component, b: Component): number {
|
|
24997
|
+
// const itemA = a.item;
|
|
24998
|
+
// const itemB = b.item;
|
|
24999
|
+
// if (VFXItem.isAncestor(itemA, itemB)) {
|
|
25000
|
+
// return -1;
|
|
25001
|
+
// } else {
|
|
25002
|
+
// return 1;
|
|
25003
|
+
// }
|
|
25004
|
+
// }
|
|
25005
|
+
(TickData);
|
|
25006
|
+
|
|
24838
25007
|
/**
|
|
24839
25008
|
* 合成抽象类:核心对象,通常一个场景只包含一个合成,可能会有多个合成。
|
|
24840
25009
|
* 合成中包含了相关的 Item 元素,支持对 Item 元素的创建、更新和销毁。
|
|
@@ -24844,6 +25013,7 @@ var listOrder = 0;
|
|
|
24844
25013
|
function Composition(props, scene) {
|
|
24845
25014
|
var _this;
|
|
24846
25015
|
_this = EventEmitter.call(this) || this;
|
|
25016
|
+
_this.sceneTicking = new SceneTicking();
|
|
24847
25017
|
/**
|
|
24848
25018
|
* 动画播放速度
|
|
24849
25019
|
*/ _this.speed = 1;
|
|
@@ -24881,9 +25051,12 @@ var listOrder = 0;
|
|
|
24881
25051
|
_this.rootItem = new VFXItem(_this.getEngine(), sourceContent);
|
|
24882
25052
|
_this.rootItem.name = "rootItem";
|
|
24883
25053
|
_this.rootItem.composition = _assert_this_initialized(_this);
|
|
24884
|
-
|
|
25054
|
+
// Spawn rootCompositionComponent
|
|
25055
|
+
_this.rootComposition = new CompositionComponent(_this.getEngine());
|
|
24885
25056
|
_this.rootComposition.startTime = sourceContent.startTime;
|
|
24886
25057
|
_this.rootComposition.data = sourceContent;
|
|
25058
|
+
_this.rootComposition.item = _this.rootItem;
|
|
25059
|
+
_this.rootItem.components.push(_this.rootComposition);
|
|
24887
25060
|
var imageUsage = !reusable && imgUsage;
|
|
24888
25061
|
_this.width = width;
|
|
24889
25062
|
_this.height = height;
|
|
@@ -24917,7 +25090,6 @@ var listOrder = 0;
|
|
|
24917
25090
|
_this.rendererOptions = null;
|
|
24918
25091
|
_this.rootComposition.createContent();
|
|
24919
25092
|
_this.buildItemTree(_this.rootItem);
|
|
24920
|
-
_this.callAwake(_this.rootItem);
|
|
24921
25093
|
_this.rootItem.onEnd = function() {
|
|
24922
25094
|
window.setTimeout(function() {
|
|
24923
25095
|
_this.emit("end", {
|
|
@@ -24929,6 +25101,16 @@ var listOrder = 0;
|
|
|
24929
25101
|
return _this;
|
|
24930
25102
|
}
|
|
24931
25103
|
var _proto = Composition.prototype;
|
|
25104
|
+
_proto.initializeSceneTicking = function initializeSceneTicking(item) {
|
|
25105
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(item.components), _step; !(_step = _iterator()).done;){
|
|
25106
|
+
var component = _step.value;
|
|
25107
|
+
this.sceneTicking.addComponent(component);
|
|
25108
|
+
}
|
|
25109
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.children), _step1; !(_step1 = _iterator1()).done;){
|
|
25110
|
+
var child = _step1.value;
|
|
25111
|
+
this.initializeSceneTicking(child);
|
|
25112
|
+
}
|
|
25113
|
+
};
|
|
24932
25114
|
/**
|
|
24933
25115
|
* 获取合成的时长
|
|
24934
25116
|
*/ _proto.getDuration = function getDuration() {
|
|
@@ -25031,7 +25213,7 @@ var listOrder = 0;
|
|
|
25031
25213
|
this.resume();
|
|
25032
25214
|
}
|
|
25033
25215
|
if (!this.rootComposition.isStartCalled) {
|
|
25034
|
-
this.rootComposition.
|
|
25216
|
+
this.rootComposition.onStart();
|
|
25035
25217
|
this.rootComposition.isStartCalled = true;
|
|
25036
25218
|
}
|
|
25037
25219
|
this.forwardTime(time + this.startTime);
|
|
@@ -25108,9 +25290,12 @@ var listOrder = 0;
|
|
|
25108
25290
|
// 更新 model-tree-plugin
|
|
25109
25291
|
this.updatePluginLoaders(deltaTime);
|
|
25110
25292
|
// scene VFXItem components lifetime function.
|
|
25111
|
-
|
|
25112
|
-
|
|
25113
|
-
|
|
25293
|
+
if (!this.rootItem.isDuringPlay) {
|
|
25294
|
+
this.callAwake(this.rootItem);
|
|
25295
|
+
this.rootItem.beginPlay();
|
|
25296
|
+
}
|
|
25297
|
+
this.sceneTicking.update.tick(time);
|
|
25298
|
+
this.sceneTicking.lateUpdate.tick(time);
|
|
25114
25299
|
this.updateCamera();
|
|
25115
25300
|
this.prepareRender();
|
|
25116
25301
|
if (this.shouldDispose()) {
|
|
@@ -25163,11 +25348,11 @@ var listOrder = 0;
|
|
|
25163
25348
|
return t;
|
|
25164
25349
|
};
|
|
25165
25350
|
_proto.callAwake = function callAwake(item) {
|
|
25166
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.
|
|
25167
|
-
var
|
|
25168
|
-
if (!
|
|
25169
|
-
|
|
25170
|
-
|
|
25351
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(item.components), _step; !(_step = _iterator()).done;){
|
|
25352
|
+
var component = _step.value;
|
|
25353
|
+
if (!component.isAwakeCalled) {
|
|
25354
|
+
component.onAwake();
|
|
25355
|
+
component.isAwakeCalled = true;
|
|
25171
25356
|
}
|
|
25172
25357
|
}
|
|
25173
25358
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.children), _step1; !(_step1 = _iterator1()).done;){
|
|
@@ -25175,72 +25360,6 @@ var listOrder = 0;
|
|
|
25175
25360
|
this.callAwake(child);
|
|
25176
25361
|
}
|
|
25177
25362
|
};
|
|
25178
|
-
_proto.callStart = function callStart(item) {
|
|
25179
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.itemBehaviours), _step; !(_step = _iterator()).done;){
|
|
25180
|
-
var itemBehaviour = _step.value;
|
|
25181
|
-
if (itemBehaviour.isActiveAndEnabled && !itemBehaviour.isStartCalled) {
|
|
25182
|
-
itemBehaviour.start();
|
|
25183
|
-
itemBehaviour.isStartCalled = true;
|
|
25184
|
-
}
|
|
25185
|
-
}
|
|
25186
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.rendererComponents), _step1; !(_step1 = _iterator1()).done;){
|
|
25187
|
-
var rendererComponent = _step1.value;
|
|
25188
|
-
if (rendererComponent.isActiveAndEnabled && !rendererComponent.isStartCalled) {
|
|
25189
|
-
rendererComponent.start();
|
|
25190
|
-
rendererComponent.isStartCalled = true;
|
|
25191
|
-
}
|
|
25192
|
-
}
|
|
25193
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(item.children), _step2; !(_step2 = _iterator2()).done;){
|
|
25194
|
-
var child = _step2.value;
|
|
25195
|
-
this.callStart(child);
|
|
25196
|
-
}
|
|
25197
|
-
};
|
|
25198
|
-
_proto.callUpdate = function callUpdate(item, dt) {
|
|
25199
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.itemBehaviours), _step; !(_step = _iterator()).done;){
|
|
25200
|
-
var itemBehaviour = _step.value;
|
|
25201
|
-
if (itemBehaviour.isActiveAndEnabled && itemBehaviour.isStartCalled) {
|
|
25202
|
-
itemBehaviour.update(dt);
|
|
25203
|
-
}
|
|
25204
|
-
}
|
|
25205
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.rendererComponents), _step1; !(_step1 = _iterator1()).done;){
|
|
25206
|
-
var rendererComponent = _step1.value;
|
|
25207
|
-
if (rendererComponent.isActiveAndEnabled && rendererComponent.isStartCalled) {
|
|
25208
|
-
rendererComponent.update(dt);
|
|
25209
|
-
}
|
|
25210
|
-
}
|
|
25211
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(item.children), _step2; !(_step2 = _iterator2()).done;){
|
|
25212
|
-
var child = _step2.value;
|
|
25213
|
-
if (VFXItem.isComposition(child)) {
|
|
25214
|
-
if (child.ended && child.endBehavior === EndBehavior.restart) {
|
|
25215
|
-
child.ended = false;
|
|
25216
|
-
// TODO K帧动画在元素重建后需要 tick ,否则会导致元素位置和 k 帧第一帧位置不一致
|
|
25217
|
-
this.callUpdate(child, 0);
|
|
25218
|
-
} else {
|
|
25219
|
-
this.callUpdate(child, dt);
|
|
25220
|
-
}
|
|
25221
|
-
} else {
|
|
25222
|
-
this.callUpdate(child, dt);
|
|
25223
|
-
}
|
|
25224
|
-
}
|
|
25225
|
-
};
|
|
25226
|
-
_proto.callLateUpdate = function callLateUpdate(item, dt) {
|
|
25227
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.itemBehaviours), _step; !(_step = _iterator()).done;){
|
|
25228
|
-
var itemBehaviour = _step.value;
|
|
25229
|
-
if (itemBehaviour.isActiveAndEnabled && itemBehaviour.isStartCalled) {
|
|
25230
|
-
itemBehaviour.lateUpdate(dt);
|
|
25231
|
-
}
|
|
25232
|
-
}
|
|
25233
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.rendererComponents), _step1; !(_step1 = _iterator1()).done;){
|
|
25234
|
-
var rendererComponent = _step1.value;
|
|
25235
|
-
if (rendererComponent.isActiveAndEnabled && rendererComponent.isStartCalled) {
|
|
25236
|
-
rendererComponent.lateUpdate(dt);
|
|
25237
|
-
}
|
|
25238
|
-
}
|
|
25239
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(item.children), _step2; !(_step2 = _iterator2()).done;){
|
|
25240
|
-
var child = _step2.value;
|
|
25241
|
-
this.callLateUpdate(child, dt);
|
|
25242
|
-
}
|
|
25243
|
-
};
|
|
25244
25363
|
/**
|
|
25245
25364
|
* 构建父子树,同时保存到 itemCacheMap 中便于查找
|
|
25246
25365
|
*/ _proto.buildItemTree = function buildItemTree(compVFXItem) {
|
|
@@ -27522,11 +27641,12 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
|
|
|
27522
27641
|
return Engine;
|
|
27523
27642
|
}();
|
|
27524
27643
|
|
|
27644
|
+
var DEFAULT_FPS = 60;
|
|
27525
27645
|
/**
|
|
27526
27646
|
* 定时器类
|
|
27527
27647
|
*/ var Ticker = /*#__PURE__*/ function() {
|
|
27528
27648
|
function Ticker(fps) {
|
|
27529
|
-
if (fps === void 0) fps =
|
|
27649
|
+
if (fps === void 0) fps = DEFAULT_FPS;
|
|
27530
27650
|
this.paused = true;
|
|
27531
27651
|
this.lastTime = 0;
|
|
27532
27652
|
// deltaTime
|
|
@@ -27661,8 +27781,8 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
|
|
|
27661
27781
|
registerPlugin("particle", ParticleLoader, VFXItem, true);
|
|
27662
27782
|
registerPlugin("cal", CalculateLoader, VFXItem, true);
|
|
27663
27783
|
registerPlugin("interact", InteractLoader, VFXItem, true);
|
|
27664
|
-
var version = "2.0.
|
|
27784
|
+
var version = "2.1.0-alpha.0";
|
|
27665
27785
|
logger.info("Core version: " + version + ".");
|
|
27666
27786
|
|
|
27667
|
-
export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Engine, EventEmitter, EventSystem, FilterMode, Float16ArrayWrapper, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, PostProcessVolume, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, SpriteColorPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, decimalEqual, defaultGlobalVolume, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isSceneJSON, isSceneURL, isSceneWithOptions, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemFrameFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
|
|
27787
|
+
export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, DEFAULT_FPS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Engine, EventEmitter, EventSystem, FilterMode, Float16ArrayWrapper, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, PostProcessVolume, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, SpriteColorPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, decimalEqual, defaultGlobalVolume, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isSceneJSON, isSceneURL, isSceneWithOptions, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemFrameFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
|
|
27668
27788
|
//# sourceMappingURL=index.mjs.map
|