@galacean/effects-threejs 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/index.js +354 -233
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +354 -234
- package/dist/index.mjs.map +1 -1
- package/dist/three-mesh.d.ts +1 -1
- package/dist/three-sprite-component.d.ts +1 -1
- package/dist/three-text-component.d.ts +16 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime threejs plugin 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';
|
|
@@ -4629,87 +4629,109 @@ function getDirectStore(target) {
|
|
|
4629
4629
|
*/ var Component = /*#__PURE__*/ function(EffectsObject) {
|
|
4630
4630
|
_inherits(Component, EffectsObject);
|
|
4631
4631
|
function Component() {
|
|
4632
|
-
return EffectsObject.apply(this, arguments);
|
|
4633
|
-
}
|
|
4634
|
-
var _proto = Component.prototype;
|
|
4635
|
-
_proto.onAttached = function onAttached() {};
|
|
4636
|
-
_proto.onDestroy = function onDestroy() {};
|
|
4637
|
-
_proto.fromData = function fromData(data) {
|
|
4638
|
-
EffectsObject.prototype.fromData.call(this, data);
|
|
4639
|
-
if (data.item) {
|
|
4640
|
-
this.item = data.item;
|
|
4641
|
-
}
|
|
4642
|
-
};
|
|
4643
|
-
_proto.dispose = function dispose() {
|
|
4644
|
-
this.onDestroy();
|
|
4645
|
-
if (this.item) {
|
|
4646
|
-
removeItem(this.item.components, this);
|
|
4647
|
-
}
|
|
4648
|
-
};
|
|
4649
|
-
_create_class(Component, [
|
|
4650
|
-
{
|
|
4651
|
-
key: "transform",
|
|
4652
|
-
get: /**
|
|
4653
|
-
* 附加到的 VFXItem 对象 Transform 组件
|
|
4654
|
-
*/ function get() {
|
|
4655
|
-
return this.item.transform;
|
|
4656
|
-
}
|
|
4657
|
-
}
|
|
4658
|
-
]);
|
|
4659
|
-
return Component;
|
|
4660
|
-
}(EffectsObject);
|
|
4661
|
-
/**
|
|
4662
|
-
* @since 2.0.0
|
|
4663
|
-
*/ var Behaviour = /*#__PURE__*/ function(Component) {
|
|
4664
|
-
_inherits(Behaviour, Component);
|
|
4665
|
-
function Behaviour() {
|
|
4666
4632
|
var _this;
|
|
4667
|
-
_this =
|
|
4633
|
+
_this = EffectsObject.apply(this, arguments) || this;
|
|
4668
4634
|
_this.isAwakeCalled = false;
|
|
4669
4635
|
_this.isStartCalled = false;
|
|
4636
|
+
_this.isEnableCalled = false;
|
|
4670
4637
|
_this._enabled = true;
|
|
4671
4638
|
return _this;
|
|
4672
4639
|
}
|
|
4673
|
-
var _proto =
|
|
4640
|
+
var _proto = Component.prototype;
|
|
4674
4641
|
/**
|
|
4675
4642
|
* 生命周期函数,初始化后调用,生命周期内只调用一次
|
|
4676
|
-
*/ _proto.
|
|
4643
|
+
*/ _proto.onAwake = function onAwake() {
|
|
4677
4644
|
// OVERRIDE
|
|
4678
4645
|
};
|
|
4679
4646
|
/**
|
|
4680
|
-
*
|
|
4647
|
+
* 在 enabled 变为 true 时触发
|
|
4681
4648
|
*/ _proto.onEnable = function onEnable() {
|
|
4682
4649
|
// OVERRIDE
|
|
4683
4650
|
};
|
|
4684
4651
|
/**
|
|
4652
|
+
* 在 enabled 变为 false 时触发
|
|
4653
|
+
*/ _proto.onDisable = function onDisable() {
|
|
4654
|
+
// OVERRIDE
|
|
4655
|
+
};
|
|
4656
|
+
/**
|
|
4685
4657
|
* 生命周期函数,在第一次 update 前调用,生命周期内只调用一次
|
|
4686
|
-
*/ _proto.
|
|
4658
|
+
*/ _proto.onStart = function onStart() {
|
|
4687
4659
|
// OVERRIDE
|
|
4688
4660
|
};
|
|
4689
4661
|
/**
|
|
4690
4662
|
* 生命周期函数,每帧调用一次
|
|
4691
|
-
*/ _proto.
|
|
4663
|
+
*/ _proto.onUpdate = function onUpdate(dt) {
|
|
4692
4664
|
// OVERRIDE
|
|
4693
4665
|
};
|
|
4694
4666
|
/**
|
|
4695
4667
|
* 生命周期函数,每帧调用一次,在 update 之后调用
|
|
4696
|
-
*/ _proto.
|
|
4668
|
+
*/ _proto.onLateUpdate = function onLateUpdate(dt) {
|
|
4669
|
+
// OVERRIDE
|
|
4670
|
+
};
|
|
4671
|
+
/**
|
|
4672
|
+
* 生命周期函数,在组件销毁时调用
|
|
4673
|
+
*/ _proto.onDestroy = function onDestroy() {
|
|
4697
4674
|
// OVERRIDE
|
|
4698
4675
|
};
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
this.
|
|
4676
|
+
/**
|
|
4677
|
+
* @internal
|
|
4678
|
+
*/ _proto.enable = function enable() {
|
|
4679
|
+
if (this.item.composition) {
|
|
4680
|
+
this.item.composition.sceneTicking.addComponent(this);
|
|
4681
|
+
this.isEnableCalled = true;
|
|
4682
|
+
}
|
|
4683
|
+
this.onEnable();
|
|
4684
|
+
};
|
|
4685
|
+
/**
|
|
4686
|
+
* @internal
|
|
4687
|
+
*/ _proto.disable = function disable() {
|
|
4688
|
+
this.onDisable();
|
|
4689
|
+
if (this.item.composition) {
|
|
4690
|
+
this.isEnableCalled = false;
|
|
4691
|
+
this.item.composition.sceneTicking.removeComponent(this);
|
|
4692
|
+
}
|
|
4693
|
+
};
|
|
4694
|
+
_proto.setVFXItem = function setVFXItem(item) {
|
|
4695
|
+
this.item = item;
|
|
4696
|
+
if (item.isDuringPlay) {
|
|
4697
|
+
if (!this.isAwakeCalled) {
|
|
4698
|
+
this.onAwake();
|
|
4699
|
+
this.isAwakeCalled = true;
|
|
4700
|
+
}
|
|
4701
|
+
if (item.getVisible() && this.enabled) {
|
|
4702
|
+
this.start();
|
|
4703
|
+
this.enable();
|
|
4704
|
+
}
|
|
4705
|
+
}
|
|
4706
|
+
};
|
|
4707
|
+
_proto.fromData = function fromData(data) {
|
|
4708
|
+
EffectsObject.prototype.fromData.call(this, data);
|
|
4709
|
+
if (data.item) {
|
|
4710
|
+
this.item = data.item;
|
|
4704
4711
|
}
|
|
4705
4712
|
};
|
|
4706
4713
|
_proto.dispose = function dispose() {
|
|
4714
|
+
this.onDestroy();
|
|
4707
4715
|
if (this.item) {
|
|
4708
|
-
removeItem(this.item.
|
|
4716
|
+
removeItem(this.item.components, this);
|
|
4709
4717
|
}
|
|
4710
|
-
Component.prototype.dispose.call(this);
|
|
4711
4718
|
};
|
|
4712
|
-
|
|
4719
|
+
_proto.start = function start() {
|
|
4720
|
+
if (this.isStartCalled) {
|
|
4721
|
+
return;
|
|
4722
|
+
}
|
|
4723
|
+
this.isStartCalled = true;
|
|
4724
|
+
this.onStart();
|
|
4725
|
+
};
|
|
4726
|
+
_create_class(Component, [
|
|
4727
|
+
{
|
|
4728
|
+
key: "transform",
|
|
4729
|
+
get: /**
|
|
4730
|
+
* 附加到的 VFXItem 对象 Transform 组件
|
|
4731
|
+
*/ function get() {
|
|
4732
|
+
return this.item.transform;
|
|
4733
|
+
}
|
|
4734
|
+
},
|
|
4713
4735
|
{
|
|
4714
4736
|
key: "isActiveAndEnabled",
|
|
4715
4737
|
get: /**
|
|
@@ -4724,24 +4746,46 @@ function getDirectStore(target) {
|
|
|
4724
4746
|
return this._enabled;
|
|
4725
4747
|
},
|
|
4726
4748
|
set: function set(value) {
|
|
4727
|
-
this.
|
|
4728
|
-
|
|
4729
|
-
if (
|
|
4730
|
-
this.
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4749
|
+
if (this.enabled !== value) {
|
|
4750
|
+
this._enabled = value;
|
|
4751
|
+
if (value) {
|
|
4752
|
+
if (this.isActiveAndEnabled) {
|
|
4753
|
+
this.enable();
|
|
4754
|
+
if (!this.isStartCalled) {
|
|
4755
|
+
this.onStart();
|
|
4756
|
+
this.isStartCalled = true;
|
|
4757
|
+
}
|
|
4758
|
+
}
|
|
4759
|
+
} else {
|
|
4760
|
+
if (this.isEnableCalled) {
|
|
4761
|
+
this.disable();
|
|
4762
|
+
}
|
|
4735
4763
|
}
|
|
4736
4764
|
}
|
|
4737
4765
|
}
|
|
4738
4766
|
}
|
|
4739
4767
|
]);
|
|
4740
|
-
return
|
|
4741
|
-
}(
|
|
4768
|
+
return Component;
|
|
4769
|
+
}(EffectsObject);
|
|
4742
4770
|
__decorate([
|
|
4743
4771
|
serialize()
|
|
4744
|
-
],
|
|
4772
|
+
], Component.prototype, "_enabled", void 0);
|
|
4773
|
+
/**
|
|
4774
|
+
* @since 2.0.0
|
|
4775
|
+
*/ var Behaviour = /*#__PURE__*/ function(Component) {
|
|
4776
|
+
_inherits(Behaviour, Component);
|
|
4777
|
+
function Behaviour() {
|
|
4778
|
+
return Component.apply(this, arguments);
|
|
4779
|
+
}
|
|
4780
|
+
var _proto = Behaviour.prototype;
|
|
4781
|
+
_proto.setVFXItem = function setVFXItem(item) {
|
|
4782
|
+
Component.prototype.setVFXItem.call(this, item);
|
|
4783
|
+
};
|
|
4784
|
+
_proto.dispose = function dispose() {
|
|
4785
|
+
Component.prototype.dispose.call(this);
|
|
4786
|
+
};
|
|
4787
|
+
return Behaviour;
|
|
4788
|
+
}(Component);
|
|
4745
4789
|
|
|
4746
4790
|
/**
|
|
4747
4791
|
* 所有渲染组件的基类
|
|
@@ -4751,19 +4795,14 @@ __decorate([
|
|
|
4751
4795
|
function RendererComponent() {
|
|
4752
4796
|
var _this;
|
|
4753
4797
|
_this = Component.apply(this, arguments) || this;
|
|
4754
|
-
_this.isStartCalled = false;
|
|
4755
4798
|
_this.materials = [];
|
|
4756
4799
|
_this._priority = 0;
|
|
4757
|
-
_this._enabled = true;
|
|
4758
4800
|
return _this;
|
|
4759
4801
|
}
|
|
4760
4802
|
var _proto = RendererComponent.prototype;
|
|
4761
|
-
_proto.onEnable = function onEnable() {};
|
|
4762
|
-
_proto.start = function start() {};
|
|
4763
|
-
_proto.update = function update(dt) {};
|
|
4764
|
-
_proto.lateUpdate = function lateUpdate(dt) {};
|
|
4765
4803
|
_proto.render = function render(renderer) {};
|
|
4766
|
-
_proto.
|
|
4804
|
+
_proto.setVFXItem = function setVFXItem(item) {
|
|
4805
|
+
Component.prototype.setVFXItem.call(this, item);
|
|
4767
4806
|
this.item.rendererComponents.push(this);
|
|
4768
4807
|
};
|
|
4769
4808
|
_proto.fromData = function fromData(data) {
|
|
@@ -4788,26 +4827,6 @@ __decorate([
|
|
|
4788
4827
|
this._priority = value;
|
|
4789
4828
|
}
|
|
4790
4829
|
},
|
|
4791
|
-
{
|
|
4792
|
-
key: "enabled",
|
|
4793
|
-
get: function get() {
|
|
4794
|
-
return this._enabled;
|
|
4795
|
-
},
|
|
4796
|
-
set: function set(value) {
|
|
4797
|
-
this._enabled = value;
|
|
4798
|
-
if (value) {
|
|
4799
|
-
this.onEnable();
|
|
4800
|
-
}
|
|
4801
|
-
}
|
|
4802
|
-
},
|
|
4803
|
-
{
|
|
4804
|
-
key: "isActiveAndEnabled",
|
|
4805
|
-
get: /**
|
|
4806
|
-
* 组件是否可以更新,true 更新,false 不更新
|
|
4807
|
-
*/ function get() {
|
|
4808
|
-
return this.item.getVisible() && this.enabled;
|
|
4809
|
-
}
|
|
4810
|
-
},
|
|
4811
4830
|
{
|
|
4812
4831
|
key: "material",
|
|
4813
4832
|
get: function get() {
|
|
@@ -4830,9 +4849,6 @@ __decorate([
|
|
|
4830
4849
|
__decorate([
|
|
4831
4850
|
serialize()
|
|
4832
4851
|
], RendererComponent.prototype, "_priority", void 0);
|
|
4833
|
-
__decorate([
|
|
4834
|
-
serialize()
|
|
4835
|
-
], RendererComponent.prototype, "_enabled", void 0);
|
|
4836
4852
|
|
|
4837
4853
|
/**
|
|
4838
4854
|
* 抽象插件类
|
|
@@ -4876,7 +4892,7 @@ exports.CameraController = /*#__PURE__*/ function(Behaviour) {
|
|
|
4876
4892
|
return _this;
|
|
4877
4893
|
}
|
|
4878
4894
|
var _proto = CameraController.prototype;
|
|
4879
|
-
_proto.
|
|
4895
|
+
_proto.onUpdate = function onUpdate() {
|
|
4880
4896
|
if (this.item.composition && this.item.transform.getValid()) {
|
|
4881
4897
|
var camera = this.item.composition.camera;
|
|
4882
4898
|
camera.near = this.options.near;
|
|
@@ -8108,7 +8124,7 @@ function _loadVideo() {
|
|
|
8108
8124
|
}, true);
|
|
8109
8125
|
}
|
|
8110
8126
|
video.addEventListener("error", function(e) {
|
|
8111
|
-
reject(
|
|
8127
|
+
reject("Load video fail.");
|
|
8112
8128
|
});
|
|
8113
8129
|
})
|
|
8114
8130
|
];
|
|
@@ -13274,7 +13290,7 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13274
13290
|
return _this;
|
|
13275
13291
|
}
|
|
13276
13292
|
var _proto = InteractComponent.prototype;
|
|
13277
|
-
_proto.
|
|
13293
|
+
_proto.onStart = function onStart() {
|
|
13278
13294
|
var _this = this;
|
|
13279
13295
|
var options = this.item.props.content.options;
|
|
13280
13296
|
var env = this.item.engine.renderer.env;
|
|
@@ -13310,8 +13326,11 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
13310
13326
|
}
|
|
13311
13327
|
};
|
|
13312
13328
|
};
|
|
13313
|
-
_proto.
|
|
13329
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
13314
13330
|
var _this_previewContent;
|
|
13331
|
+
if (!this.isActiveAndEnabled) {
|
|
13332
|
+
return;
|
|
13333
|
+
}
|
|
13315
13334
|
(_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.updateMesh();
|
|
13316
13335
|
if (!this.hasBeenAddedToComposition && this.item.composition) {
|
|
13317
13336
|
var options = this.item.props.content.options;
|
|
@@ -13582,7 +13601,6 @@ function _assert_this_initialized(self) {
|
|
|
13582
13601
|
/**
|
|
13583
13602
|
* 动画图,负责更新所有的动画节点
|
|
13584
13603
|
* @since 2.0.0
|
|
13585
|
-
* @internal
|
|
13586
13604
|
*/ var PlayableGraph = /*#__PURE__*/ function() {
|
|
13587
13605
|
function PlayableGraph() {
|
|
13588
13606
|
this.playableOutputs = [];
|
|
@@ -13642,7 +13660,6 @@ function _assert_this_initialized(self) {
|
|
|
13642
13660
|
/**
|
|
13643
13661
|
* 动画图可播放节点对象
|
|
13644
13662
|
* @since 2.0.0
|
|
13645
|
-
* @internal
|
|
13646
13663
|
*/ var Playable = /*#__PURE__*/ function() {
|
|
13647
13664
|
function Playable(graph, inputCount) {
|
|
13648
13665
|
if (inputCount === void 0) inputCount = 0;
|
|
@@ -13656,6 +13673,9 @@ function _assert_this_initialized(self) {
|
|
|
13656
13673
|
this.outputs = [];
|
|
13657
13674
|
this.playState = 0;
|
|
13658
13675
|
this.traversalMode = 0;
|
|
13676
|
+
/**
|
|
13677
|
+
* 当前本地播放的时间
|
|
13678
|
+
*/ this.time = 0;
|
|
13659
13679
|
graph.addPlayable(this);
|
|
13660
13680
|
this.inputs = new Array(inputCount);
|
|
13661
13681
|
this.inputOuputPorts = new Array(inputCount);
|
|
@@ -13840,7 +13860,6 @@ function _assert_this_initialized(self) {
|
|
|
13840
13860
|
/**
|
|
13841
13861
|
* 动画图输出节点对象,将动画数据采样到绑定的元素属性上
|
|
13842
13862
|
* @since 2.0.0
|
|
13843
|
-
* @internal
|
|
13844
13863
|
*/ var PlayableOutput = /*#__PURE__*/ function() {
|
|
13845
13864
|
function PlayableOutput() {
|
|
13846
13865
|
this.sourceOutputPort = 0;
|
|
@@ -14102,10 +14121,10 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
14102
14121
|
this.material.setVector2("_Size", this.transform.size);
|
|
14103
14122
|
renderer.drawGeometry(geo, material);
|
|
14104
14123
|
};
|
|
14105
|
-
_proto.
|
|
14124
|
+
_proto.onStart = function onStart() {
|
|
14106
14125
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
14107
14126
|
};
|
|
14108
|
-
_proto.
|
|
14127
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
14109
14128
|
if (!this.isManualTimeSet) {
|
|
14110
14129
|
this.frameAnimationTime += dt / 1000;
|
|
14111
14130
|
this.isManualTimeSet = false;
|
|
@@ -16528,15 +16547,15 @@ function getTrailMeshShader(trails, particleMaxCount, name, gpuCapability, env)
|
|
|
16528
16547
|
return _this;
|
|
16529
16548
|
}
|
|
16530
16549
|
var _proto = ParticleSystemRenderer.prototype;
|
|
16531
|
-
_proto.
|
|
16550
|
+
_proto.onStart = function onStart() {
|
|
16532
16551
|
this._priority = this.item.renderOrder;
|
|
16533
16552
|
this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);
|
|
16534
16553
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.meshes), _step; !(_step = _iterator()).done;){
|
|
16535
16554
|
var mesh = _step.value;
|
|
16536
|
-
mesh.
|
|
16555
|
+
mesh.onStart();
|
|
16537
16556
|
}
|
|
16538
16557
|
};
|
|
16539
|
-
_proto.
|
|
16558
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
16540
16559
|
var time = this.particleMesh.time;
|
|
16541
16560
|
this.particleMesh.mesh.material.setVector4("uParams", new Vector4(time, this.item.duration, 0, 0));
|
|
16542
16561
|
};
|
|
@@ -16760,7 +16779,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16760
16779
|
_proto.getTextures = function getTextures() {
|
|
16761
16780
|
return this.renderer.getTextures();
|
|
16762
16781
|
};
|
|
16763
|
-
_proto.
|
|
16782
|
+
_proto.startEmit = function startEmit() {
|
|
16764
16783
|
if (!this.started || this.ended) {
|
|
16765
16784
|
this.reset();
|
|
16766
16785
|
this.started = true;
|
|
@@ -16786,7 +16805,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16786
16805
|
this.frozen = false;
|
|
16787
16806
|
this.ended = false;
|
|
16788
16807
|
};
|
|
16789
|
-
_proto.
|
|
16808
|
+
_proto.update = function update(delta) {
|
|
16790
16809
|
var _this = this;
|
|
16791
16810
|
if (this.started && !this.frozen) {
|
|
16792
16811
|
var now = this.lastUpdate + delta / 1000;
|
|
@@ -17569,7 +17588,6 @@ function randomArrItem(arr, keepArr) {
|
|
|
17569
17588
|
|
|
17570
17589
|
/**
|
|
17571
17590
|
* @since 2.0.0
|
|
17572
|
-
* @internal
|
|
17573
17591
|
*/ var ParticleBehaviourPlayable = /*#__PURE__*/ function(Playable) {
|
|
17574
17592
|
_inherits(ParticleBehaviourPlayable, Playable);
|
|
17575
17593
|
function ParticleBehaviourPlayable() {
|
|
@@ -17587,7 +17605,7 @@ function randomArrItem(arr, keepArr) {
|
|
|
17587
17605
|
this.particleSystem = boundObject.getComponent(exports.ParticleSystem);
|
|
17588
17606
|
if (this.particleSystem) {
|
|
17589
17607
|
this.particleSystem.name = boundObject.name;
|
|
17590
|
-
this.particleSystem.
|
|
17608
|
+
this.particleSystem.startEmit();
|
|
17591
17609
|
this.particleSystem.initEmitterTransform();
|
|
17592
17610
|
}
|
|
17593
17611
|
};
|
|
@@ -17607,7 +17625,7 @@ function randomArrItem(arr, keepArr) {
|
|
|
17607
17625
|
if (Math.abs(this.time - this.lastTime) < 0.001) {
|
|
17608
17626
|
deltaTime = 0;
|
|
17609
17627
|
}
|
|
17610
|
-
particleSystem.
|
|
17628
|
+
particleSystem.update(deltaTime);
|
|
17611
17629
|
}
|
|
17612
17630
|
this.lastTime = this.time;
|
|
17613
17631
|
};
|
|
@@ -18629,7 +18647,6 @@ var tempSize = new Vector3(1, 1, 1);
|
|
|
18629
18647
|
var tempPos = new Vector3();
|
|
18630
18648
|
/**
|
|
18631
18649
|
* @since 2.0.0
|
|
18632
|
-
* @internal
|
|
18633
18650
|
*/ var TransformAnimationPlayable = /*#__PURE__*/ function(AnimationPlayable) {
|
|
18634
18651
|
_inherits(TransformAnimationPlayable, AnimationPlayable);
|
|
18635
18652
|
function TransformAnimationPlayable() {
|
|
@@ -18791,7 +18808,6 @@ exports.TransformPlayableAsset = __decorate([
|
|
|
18791
18808
|
], exports.TransformPlayableAsset);
|
|
18792
18809
|
/**
|
|
18793
18810
|
* @since 2.0.0
|
|
18794
|
-
* @internal
|
|
18795
18811
|
*/ var ActivationPlayable = /*#__PURE__*/ function(Playable) {
|
|
18796
18812
|
_inherits(ActivationPlayable, Playable);
|
|
18797
18813
|
function ActivationPlayable() {
|
|
@@ -18942,7 +18958,6 @@ var AnimationClipPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
18942
18958
|
|
|
18943
18959
|
/**
|
|
18944
18960
|
* @since 2.0.0
|
|
18945
|
-
* @internal
|
|
18946
18961
|
*/ var TimelineClip = /*#__PURE__*/ function() {
|
|
18947
18962
|
function TimelineClip() {
|
|
18948
18963
|
this.start = 0;
|
|
@@ -19340,25 +19355,15 @@ var TrackSortWrapper = function TrackSortWrapper(track, originalIndex) {
|
|
|
19340
19355
|
this.track = track;
|
|
19341
19356
|
this.originalIndex = originalIndex;
|
|
19342
19357
|
};
|
|
19343
|
-
function isAncestor(ancestorCandidate, descendantCandidate) {
|
|
19344
|
-
var current = descendantCandidate.parent;
|
|
19345
|
-
while(current){
|
|
19346
|
-
if (current === ancestorCandidate) {
|
|
19347
|
-
return true;
|
|
19348
|
-
}
|
|
19349
|
-
current = current.parent;
|
|
19350
|
-
}
|
|
19351
|
-
return false;
|
|
19352
|
-
}
|
|
19353
19358
|
function compareTracks(a, b) {
|
|
19354
19359
|
var bindingA = a.track.binding;
|
|
19355
19360
|
var bindingB = b.track.binding;
|
|
19356
19361
|
if (!_instanceof1(bindingA, exports.VFXItem) || !_instanceof1(bindingB, exports.VFXItem)) {
|
|
19357
19362
|
return a.originalIndex - b.originalIndex;
|
|
19358
19363
|
}
|
|
19359
|
-
if (isAncestor(bindingA, bindingB)) {
|
|
19364
|
+
if (exports.VFXItem.isAncestor(bindingA, bindingB)) {
|
|
19360
19365
|
return -1;
|
|
19361
|
-
} else if (isAncestor(bindingB, bindingA)) {
|
|
19366
|
+
} else if (exports.VFXItem.isAncestor(bindingB, bindingA)) {
|
|
19362
19367
|
return 1;
|
|
19363
19368
|
} else {
|
|
19364
19369
|
return a.originalIndex - b.originalIndex; // 非父子关系的元素保持原始顺序
|
|
@@ -19382,7 +19387,7 @@ function compareTracks(a, b) {
|
|
|
19382
19387
|
return _this;
|
|
19383
19388
|
}
|
|
19384
19389
|
var _proto = CompositionComponent.prototype;
|
|
19385
|
-
_proto.
|
|
19390
|
+
_proto.onStart = function onStart() {
|
|
19386
19391
|
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;
|
|
19387
19392
|
this.startTime = startTime;
|
|
19388
19393
|
this.resolveBindings();
|
|
@@ -19410,7 +19415,7 @@ function compareTracks(a, b) {
|
|
|
19410
19415
|
_proto.getReusable = function getReusable() {
|
|
19411
19416
|
return this.reusable;
|
|
19412
19417
|
};
|
|
19413
|
-
_proto.
|
|
19418
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
19414
19419
|
var time = this.time;
|
|
19415
19420
|
this.timelinePlayable.setTime(time);
|
|
19416
19421
|
this.graph.evaluate(dt);
|
|
@@ -19446,7 +19451,9 @@ function compareTracks(a, b) {
|
|
|
19446
19451
|
props.content = itemData.content;
|
|
19447
19452
|
item = assetLoader.loadGUID(itemData.id);
|
|
19448
19453
|
item.composition = this.item.composition;
|
|
19449
|
-
var compositionComponent =
|
|
19454
|
+
var compositionComponent = new CompositionComponent(this.engine);
|
|
19455
|
+
compositionComponent.item = item;
|
|
19456
|
+
item.components.push(compositionComponent);
|
|
19450
19457
|
compositionComponent.data = props;
|
|
19451
19458
|
compositionComponent.refId = refId;
|
|
19452
19459
|
item.transform.parentTransform = this.transform;
|
|
@@ -19857,8 +19864,8 @@ exports.TextComponent = /*#__PURE__*/ function(SpriteComponent) {
|
|
|
19857
19864
|
return _this;
|
|
19858
19865
|
}
|
|
19859
19866
|
var _proto = TextComponent.prototype;
|
|
19860
|
-
_proto.
|
|
19861
|
-
SpriteComponent.prototype.
|
|
19867
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
19868
|
+
SpriteComponent.prototype.onUpdate.call(this, dt);
|
|
19862
19869
|
this.updateTexture();
|
|
19863
19870
|
};
|
|
19864
19871
|
_proto.fromData = function fromData(data) {
|
|
@@ -20273,7 +20280,7 @@ exports.EffectComponent = /*#__PURE__*/ function(RendererComponent) {
|
|
|
20273
20280
|
return _this;
|
|
20274
20281
|
}
|
|
20275
20282
|
var _proto = EffectComponent.prototype;
|
|
20276
|
-
_proto.
|
|
20283
|
+
_proto.onStart = function onStart() {
|
|
20277
20284
|
this.item.getHitTestParams = this.getHitTestParams;
|
|
20278
20285
|
};
|
|
20279
20286
|
_proto.render = function render(renderer) {
|
|
@@ -20400,7 +20407,7 @@ exports.PostProcessVolume = /*#__PURE__*/ function(Behaviour) {
|
|
|
20400
20407
|
return _this;
|
|
20401
20408
|
}
|
|
20402
20409
|
var _proto = PostProcessVolume.prototype;
|
|
20403
|
-
_proto.
|
|
20410
|
+
_proto.onStart = function onStart() {
|
|
20404
20411
|
var composition = this.item.composition;
|
|
20405
20412
|
if (composition) {
|
|
20406
20413
|
composition.globalVolume = this;
|
|
@@ -20542,8 +20549,8 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20542
20549
|
*/ _this.ended = false;
|
|
20543
20550
|
_this.reusable = false;
|
|
20544
20551
|
_this.type = ItemType.base;
|
|
20552
|
+
_this.isDuringPlay = false;
|
|
20545
20553
|
_this.components = [];
|
|
20546
|
-
_this.itemBehaviours = [];
|
|
20547
20554
|
_this.rendererComponents = [];
|
|
20548
20555
|
/**
|
|
20549
20556
|
* 元素可见性,该值的改变会触发 `handleVisibleChanged` 回调
|
|
@@ -20553,6 +20560,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20553
20560
|
* 元素动画的速度
|
|
20554
20561
|
*/ _this.speed = 1;
|
|
20555
20562
|
_this.listIndex = 0;
|
|
20563
|
+
_this.isEnabled = false;
|
|
20556
20564
|
_this.eventProcessor = new EventEmitter();
|
|
20557
20565
|
_this.name = "VFXItem";
|
|
20558
20566
|
_this.transform.name = _this.name;
|
|
@@ -20625,8 +20633,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20625
20633
|
*/ _proto.addComponent = function addComponent(classConstructor) {
|
|
20626
20634
|
var newComponent = new classConstructor(this.engine);
|
|
20627
20635
|
this.components.push(newComponent);
|
|
20628
|
-
newComponent.
|
|
20629
|
-
newComponent.onAttached();
|
|
20636
|
+
newComponent.setVFXItem(this);
|
|
20630
20637
|
return newComponent;
|
|
20631
20638
|
};
|
|
20632
20639
|
/**
|
|
@@ -20659,21 +20666,22 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20659
20666
|
return res;
|
|
20660
20667
|
};
|
|
20661
20668
|
_proto.setParent = function setParent(vfxItem) {
|
|
20662
|
-
if (vfxItem === this) {
|
|
20669
|
+
if (vfxItem === this && !vfxItem) {
|
|
20663
20670
|
return;
|
|
20664
20671
|
}
|
|
20665
20672
|
if (this.parent) {
|
|
20666
20673
|
removeItem(this.parent.children, this);
|
|
20667
20674
|
}
|
|
20668
20675
|
this.parent = vfxItem;
|
|
20669
|
-
if (
|
|
20670
|
-
|
|
20671
|
-
|
|
20672
|
-
|
|
20673
|
-
|
|
20674
|
-
|
|
20675
|
-
|
|
20676
|
-
|
|
20676
|
+
if (!VFXItem.isCamera(this)) {
|
|
20677
|
+
this.transform.parentTransform = vfxItem.transform;
|
|
20678
|
+
}
|
|
20679
|
+
vfxItem.children.push(this);
|
|
20680
|
+
if (!this.composition) {
|
|
20681
|
+
this.composition = vfxItem.composition;
|
|
20682
|
+
}
|
|
20683
|
+
if (!this.isDuringPlay && vfxItem.isDuringPlay) {
|
|
20684
|
+
this.beginPlay();
|
|
20677
20685
|
}
|
|
20678
20686
|
};
|
|
20679
20687
|
/**
|
|
@@ -20704,6 +20712,7 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20704
20712
|
*/ _proto.setVisible = function setVisible(visible) {
|
|
20705
20713
|
if (this.visible !== visible) {
|
|
20706
20714
|
this.visible = !!visible;
|
|
20715
|
+
this.onActiveChanged();
|
|
20707
20716
|
}
|
|
20708
20717
|
};
|
|
20709
20718
|
/**
|
|
@@ -20828,6 +20837,57 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20828
20837
|
}
|
|
20829
20838
|
return undefined;
|
|
20830
20839
|
};
|
|
20840
|
+
/**
|
|
20841
|
+
* @internal
|
|
20842
|
+
*/ _proto.beginPlay = function beginPlay() {
|
|
20843
|
+
this.isDuringPlay = true;
|
|
20844
|
+
if (this.composition && this.visible && !this.isEnabled) {
|
|
20845
|
+
this.onEnable();
|
|
20846
|
+
}
|
|
20847
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
|
|
20848
|
+
var child = _step.value;
|
|
20849
|
+
if (!child.isDuringPlay) {
|
|
20850
|
+
child.beginPlay();
|
|
20851
|
+
}
|
|
20852
|
+
}
|
|
20853
|
+
};
|
|
20854
|
+
/**
|
|
20855
|
+
* @internal
|
|
20856
|
+
*/ _proto.onActiveChanged = function onActiveChanged() {
|
|
20857
|
+
if (!this.isEnabled) {
|
|
20858
|
+
this.onEnable();
|
|
20859
|
+
} else {
|
|
20860
|
+
this.onDisable();
|
|
20861
|
+
}
|
|
20862
|
+
};
|
|
20863
|
+
/**
|
|
20864
|
+
* @internal
|
|
20865
|
+
*/ _proto.onEnable = function onEnable() {
|
|
20866
|
+
this.isEnabled = true;
|
|
20867
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
20868
|
+
var component = _step.value;
|
|
20869
|
+
if (component.enabled && !component.isStartCalled) {
|
|
20870
|
+
component.onStart();
|
|
20871
|
+
}
|
|
20872
|
+
}
|
|
20873
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.components), _step1; !(_step1 = _iterator1()).done;){
|
|
20874
|
+
var component1 = _step1.value;
|
|
20875
|
+
if (component1.enabled && !component1.isEnableCalled) {
|
|
20876
|
+
component1.enable();
|
|
20877
|
+
}
|
|
20878
|
+
}
|
|
20879
|
+
};
|
|
20880
|
+
/**
|
|
20881
|
+
* @internal
|
|
20882
|
+
*/ _proto.onDisable = function onDisable() {
|
|
20883
|
+
this.isEnabled = false;
|
|
20884
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
20885
|
+
var component = _step.value;
|
|
20886
|
+
if (component.enabled && component.isEnableCalled) {
|
|
20887
|
+
component.disable();
|
|
20888
|
+
}
|
|
20889
|
+
}
|
|
20890
|
+
};
|
|
20831
20891
|
_proto.fromData = function fromData(data) {
|
|
20832
20892
|
EffectsObject.prototype.fromData.call(this, data);
|
|
20833
20893
|
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;
|
|
@@ -20877,14 +20937,10 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20877
20937
|
if (duration <= 0) {
|
|
20878
20938
|
throw new Error("Item duration can't be less than 0, see " + HELP_LINK["Item duration can't be less than 0"] + ".");
|
|
20879
20939
|
}
|
|
20880
|
-
this.itemBehaviours.length = 0;
|
|
20881
20940
|
this.rendererComponents.length = 0;
|
|
20882
20941
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.components), _step; !(_step = _iterator()).done;){
|
|
20883
20942
|
var component = _step.value;
|
|
20884
20943
|
component.item = this;
|
|
20885
|
-
if (_instanceof1(component, Behaviour)) {
|
|
20886
|
-
this.itemBehaviours.push(component);
|
|
20887
|
-
}
|
|
20888
20944
|
if (_instanceof1(component, RendererComponent)) {
|
|
20889
20945
|
this.rendererComponents.push(component);
|
|
20890
20946
|
}
|
|
@@ -20989,6 +21045,16 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
|
|
|
20989
21045
|
VFXItem.isExtraCamera = function isExtraCamera(item) {
|
|
20990
21046
|
return item.id === "extra-camera" && item.name === "extra-camera";
|
|
20991
21047
|
};
|
|
21048
|
+
VFXItem.isAncestor = function isAncestor(ancestorCandidate, descendantCandidate) {
|
|
21049
|
+
var current = descendantCandidate.parent;
|
|
21050
|
+
while(current){
|
|
21051
|
+
if (current === ancestorCandidate) {
|
|
21052
|
+
return true;
|
|
21053
|
+
}
|
|
21054
|
+
current = current.parent;
|
|
21055
|
+
}
|
|
21056
|
+
return false;
|
|
21057
|
+
};
|
|
20992
21058
|
_create_class(VFXItem, [
|
|
20993
21059
|
{
|
|
20994
21060
|
key: "content",
|
|
@@ -24126,7 +24192,7 @@ var seed$1 = 1;
|
|
|
24126
24192
|
];
|
|
24127
24193
|
case 6:
|
|
24128
24194
|
e = _state.sent();
|
|
24129
|
-
throw new Error("Failed to load. Check the template or if the URL is " + (isVideo ? "video" : "image") + " type, URL: " + url + ", Error: " + e.message + ".");
|
|
24195
|
+
throw new Error("Failed to load. Check the template or if the URL is " + (isVideo ? "video" : "image") + " type, URL: " + url + ", Error: " + (e.message || e) + ".");
|
|
24130
24196
|
case 7:
|
|
24131
24197
|
return [
|
|
24132
24198
|
3,
|
|
@@ -24861,6 +24927,109 @@ var listOrder = 0;
|
|
|
24861
24927
|
return CompositionSourceManager;
|
|
24862
24928
|
}();
|
|
24863
24929
|
|
|
24930
|
+
var SceneTicking = /*#__PURE__*/ function() {
|
|
24931
|
+
function SceneTicking() {
|
|
24932
|
+
this.update = new UpdateTickData();
|
|
24933
|
+
this.lateUpdate = new LateUpdateTickData();
|
|
24934
|
+
}
|
|
24935
|
+
var _proto = SceneTicking.prototype;
|
|
24936
|
+
_proto.addComponent = function addComponent(obj) {
|
|
24937
|
+
if (obj.onUpdate !== Component.prototype.onUpdate) {
|
|
24938
|
+
this.update.addComponent(obj);
|
|
24939
|
+
}
|
|
24940
|
+
if (obj.onLateUpdate !== Component.prototype.onLateUpdate) {
|
|
24941
|
+
this.lateUpdate.addComponent(obj);
|
|
24942
|
+
}
|
|
24943
|
+
};
|
|
24944
|
+
_proto.removeComponent = function removeComponent(obj) {
|
|
24945
|
+
if (obj.onUpdate !== Component.prototype.onUpdate) {
|
|
24946
|
+
this.update.removeComponent(obj);
|
|
24947
|
+
}
|
|
24948
|
+
if (obj.onLateUpdate !== Component.prototype.onLateUpdate) {
|
|
24949
|
+
this.lateUpdate.removeComponent(obj);
|
|
24950
|
+
}
|
|
24951
|
+
};
|
|
24952
|
+
_proto.clear = function clear() {
|
|
24953
|
+
this.update.clear();
|
|
24954
|
+
this.lateUpdate.clear();
|
|
24955
|
+
};
|
|
24956
|
+
return SceneTicking;
|
|
24957
|
+
}();
|
|
24958
|
+
var TickData = /*#__PURE__*/ function() {
|
|
24959
|
+
function TickData() {
|
|
24960
|
+
this.components = [];
|
|
24961
|
+
this.ticks = [];
|
|
24962
|
+
}
|
|
24963
|
+
var _proto = TickData.prototype;
|
|
24964
|
+
_proto.tick = function tick(dt) {
|
|
24965
|
+
this.tickComponents(this.components, dt);
|
|
24966
|
+
for(var i = 0; i < this.ticks.length; i++){
|
|
24967
|
+
this.ticks[i](dt);
|
|
24968
|
+
}
|
|
24969
|
+
};
|
|
24970
|
+
_proto.tickComponents = function tickComponents(components, dt) {
|
|
24971
|
+
// To be implemented in derived classes
|
|
24972
|
+
};
|
|
24973
|
+
_proto.addComponent = function addComponent(component) {
|
|
24974
|
+
if (!this.components.includes(component)) {
|
|
24975
|
+
this.components.push(component);
|
|
24976
|
+
}
|
|
24977
|
+
};
|
|
24978
|
+
_proto.removeComponent = function removeComponent(component) {
|
|
24979
|
+
var index = this.components.indexOf(component);
|
|
24980
|
+
if (index > -1) {
|
|
24981
|
+
this.components.splice(index, 1);
|
|
24982
|
+
}
|
|
24983
|
+
};
|
|
24984
|
+
_proto.addTick = function addTick(method, callee) {
|
|
24985
|
+
var tick = method.bind(callee);
|
|
24986
|
+
if (!this.ticks.includes(tick)) {
|
|
24987
|
+
this.ticks.push(tick);
|
|
24988
|
+
}
|
|
24989
|
+
};
|
|
24990
|
+
_proto.clear = function clear() {
|
|
24991
|
+
this.components = [];
|
|
24992
|
+
};
|
|
24993
|
+
return TickData;
|
|
24994
|
+
}();
|
|
24995
|
+
var UpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
24996
|
+
_inherits(UpdateTickData, TickData);
|
|
24997
|
+
function UpdateTickData() {
|
|
24998
|
+
return TickData.apply(this, arguments);
|
|
24999
|
+
}
|
|
25000
|
+
var _proto = UpdateTickData.prototype;
|
|
25001
|
+
_proto.tickComponents = function tickComponents(components, dt) {
|
|
25002
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(components), _step; !(_step = _iterator()).done;){
|
|
25003
|
+
var component = _step.value;
|
|
25004
|
+
component.onUpdate(dt);
|
|
25005
|
+
}
|
|
25006
|
+
};
|
|
25007
|
+
return UpdateTickData;
|
|
25008
|
+
}(TickData);
|
|
25009
|
+
var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
25010
|
+
_inherits(LateUpdateTickData, TickData);
|
|
25011
|
+
function LateUpdateTickData() {
|
|
25012
|
+
return TickData.apply(this, arguments);
|
|
25013
|
+
}
|
|
25014
|
+
var _proto = LateUpdateTickData.prototype;
|
|
25015
|
+
_proto.tickComponents = function tickComponents(components, dt) {
|
|
25016
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(components), _step; !(_step = _iterator()).done;){
|
|
25017
|
+
var component = _step.value;
|
|
25018
|
+
component.onLateUpdate(dt);
|
|
25019
|
+
}
|
|
25020
|
+
};
|
|
25021
|
+
return LateUpdateTickData;
|
|
25022
|
+
} // function compareComponents (a: Component, b: Component): number {
|
|
25023
|
+
// const itemA = a.item;
|
|
25024
|
+
// const itemB = b.item;
|
|
25025
|
+
// if (VFXItem.isAncestor(itemA, itemB)) {
|
|
25026
|
+
// return -1;
|
|
25027
|
+
// } else {
|
|
25028
|
+
// return 1;
|
|
25029
|
+
// }
|
|
25030
|
+
// }
|
|
25031
|
+
(TickData);
|
|
25032
|
+
|
|
24864
25033
|
/**
|
|
24865
25034
|
* 合成抽象类:核心对象,通常一个场景只包含一个合成,可能会有多个合成。
|
|
24866
25035
|
* 合成中包含了相关的 Item 元素,支持对 Item 元素的创建、更新和销毁。
|
|
@@ -24870,6 +25039,7 @@ var listOrder = 0;
|
|
|
24870
25039
|
function Composition(props, scene) {
|
|
24871
25040
|
var _this;
|
|
24872
25041
|
_this = EventEmitter.call(this) || this;
|
|
25042
|
+
_this.sceneTicking = new SceneTicking();
|
|
24873
25043
|
/**
|
|
24874
25044
|
* 动画播放速度
|
|
24875
25045
|
*/ _this.speed = 1;
|
|
@@ -24907,9 +25077,12 @@ var listOrder = 0;
|
|
|
24907
25077
|
_this.rootItem = new exports.VFXItem(_this.getEngine(), sourceContent);
|
|
24908
25078
|
_this.rootItem.name = "rootItem";
|
|
24909
25079
|
_this.rootItem.composition = _assert_this_initialized(_this);
|
|
24910
|
-
|
|
25080
|
+
// Spawn rootCompositionComponent
|
|
25081
|
+
_this.rootComposition = new CompositionComponent(_this.getEngine());
|
|
24911
25082
|
_this.rootComposition.startTime = sourceContent.startTime;
|
|
24912
25083
|
_this.rootComposition.data = sourceContent;
|
|
25084
|
+
_this.rootComposition.item = _this.rootItem;
|
|
25085
|
+
_this.rootItem.components.push(_this.rootComposition);
|
|
24913
25086
|
var imageUsage = !reusable && imgUsage;
|
|
24914
25087
|
_this.width = width;
|
|
24915
25088
|
_this.height = height;
|
|
@@ -24943,7 +25116,6 @@ var listOrder = 0;
|
|
|
24943
25116
|
_this.rendererOptions = null;
|
|
24944
25117
|
_this.rootComposition.createContent();
|
|
24945
25118
|
_this.buildItemTree(_this.rootItem);
|
|
24946
|
-
_this.callAwake(_this.rootItem);
|
|
24947
25119
|
_this.rootItem.onEnd = function() {
|
|
24948
25120
|
window.setTimeout(function() {
|
|
24949
25121
|
_this.emit("end", {
|
|
@@ -24955,6 +25127,16 @@ var listOrder = 0;
|
|
|
24955
25127
|
return _this;
|
|
24956
25128
|
}
|
|
24957
25129
|
var _proto = Composition.prototype;
|
|
25130
|
+
_proto.initializeSceneTicking = function initializeSceneTicking(item) {
|
|
25131
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(item.components), _step; !(_step = _iterator()).done;){
|
|
25132
|
+
var component = _step.value;
|
|
25133
|
+
this.sceneTicking.addComponent(component);
|
|
25134
|
+
}
|
|
25135
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.children), _step1; !(_step1 = _iterator1()).done;){
|
|
25136
|
+
var child = _step1.value;
|
|
25137
|
+
this.initializeSceneTicking(child);
|
|
25138
|
+
}
|
|
25139
|
+
};
|
|
24958
25140
|
/**
|
|
24959
25141
|
* 获取合成的时长
|
|
24960
25142
|
*/ _proto.getDuration = function getDuration() {
|
|
@@ -25057,7 +25239,7 @@ var listOrder = 0;
|
|
|
25057
25239
|
this.resume();
|
|
25058
25240
|
}
|
|
25059
25241
|
if (!this.rootComposition.isStartCalled) {
|
|
25060
|
-
this.rootComposition.
|
|
25242
|
+
this.rootComposition.onStart();
|
|
25061
25243
|
this.rootComposition.isStartCalled = true;
|
|
25062
25244
|
}
|
|
25063
25245
|
this.forwardTime(time + this.startTime);
|
|
@@ -25134,9 +25316,12 @@ var listOrder = 0;
|
|
|
25134
25316
|
// 更新 model-tree-plugin
|
|
25135
25317
|
this.updatePluginLoaders(deltaTime);
|
|
25136
25318
|
// scene VFXItem components lifetime function.
|
|
25137
|
-
|
|
25138
|
-
|
|
25139
|
-
|
|
25319
|
+
if (!this.rootItem.isDuringPlay) {
|
|
25320
|
+
this.callAwake(this.rootItem);
|
|
25321
|
+
this.rootItem.beginPlay();
|
|
25322
|
+
}
|
|
25323
|
+
this.sceneTicking.update.tick(time);
|
|
25324
|
+
this.sceneTicking.lateUpdate.tick(time);
|
|
25140
25325
|
this.updateCamera();
|
|
25141
25326
|
this.prepareRender();
|
|
25142
25327
|
if (this.shouldDispose()) {
|
|
@@ -25189,11 +25374,11 @@ var listOrder = 0;
|
|
|
25189
25374
|
return t;
|
|
25190
25375
|
};
|
|
25191
25376
|
_proto.callAwake = function callAwake(item) {
|
|
25192
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.
|
|
25193
|
-
var
|
|
25194
|
-
if (!
|
|
25195
|
-
|
|
25196
|
-
|
|
25377
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(item.components), _step; !(_step = _iterator()).done;){
|
|
25378
|
+
var component = _step.value;
|
|
25379
|
+
if (!component.isAwakeCalled) {
|
|
25380
|
+
component.onAwake();
|
|
25381
|
+
component.isAwakeCalled = true;
|
|
25197
25382
|
}
|
|
25198
25383
|
}
|
|
25199
25384
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.children), _step1; !(_step1 = _iterator1()).done;){
|
|
@@ -25201,72 +25386,6 @@ var listOrder = 0;
|
|
|
25201
25386
|
this.callAwake(child);
|
|
25202
25387
|
}
|
|
25203
25388
|
};
|
|
25204
|
-
_proto.callStart = function callStart(item) {
|
|
25205
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.itemBehaviours), _step; !(_step = _iterator()).done;){
|
|
25206
|
-
var itemBehaviour = _step.value;
|
|
25207
|
-
if (itemBehaviour.isActiveAndEnabled && !itemBehaviour.isStartCalled) {
|
|
25208
|
-
itemBehaviour.start();
|
|
25209
|
-
itemBehaviour.isStartCalled = true;
|
|
25210
|
-
}
|
|
25211
|
-
}
|
|
25212
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.rendererComponents), _step1; !(_step1 = _iterator1()).done;){
|
|
25213
|
-
var rendererComponent = _step1.value;
|
|
25214
|
-
if (rendererComponent.isActiveAndEnabled && !rendererComponent.isStartCalled) {
|
|
25215
|
-
rendererComponent.start();
|
|
25216
|
-
rendererComponent.isStartCalled = true;
|
|
25217
|
-
}
|
|
25218
|
-
}
|
|
25219
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(item.children), _step2; !(_step2 = _iterator2()).done;){
|
|
25220
|
-
var child = _step2.value;
|
|
25221
|
-
this.callStart(child);
|
|
25222
|
-
}
|
|
25223
|
-
};
|
|
25224
|
-
_proto.callUpdate = function callUpdate(item, dt) {
|
|
25225
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.itemBehaviours), _step; !(_step = _iterator()).done;){
|
|
25226
|
-
var itemBehaviour = _step.value;
|
|
25227
|
-
if (itemBehaviour.isActiveAndEnabled && itemBehaviour.isStartCalled) {
|
|
25228
|
-
itemBehaviour.update(dt);
|
|
25229
|
-
}
|
|
25230
|
-
}
|
|
25231
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.rendererComponents), _step1; !(_step1 = _iterator1()).done;){
|
|
25232
|
-
var rendererComponent = _step1.value;
|
|
25233
|
-
if (rendererComponent.isActiveAndEnabled && rendererComponent.isStartCalled) {
|
|
25234
|
-
rendererComponent.update(dt);
|
|
25235
|
-
}
|
|
25236
|
-
}
|
|
25237
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(item.children), _step2; !(_step2 = _iterator2()).done;){
|
|
25238
|
-
var child = _step2.value;
|
|
25239
|
-
if (exports.VFXItem.isComposition(child)) {
|
|
25240
|
-
if (child.ended && child.endBehavior === EndBehavior.restart) {
|
|
25241
|
-
child.ended = false;
|
|
25242
|
-
// TODO K帧动画在元素重建后需要 tick ,否则会导致元素位置和 k 帧第一帧位置不一致
|
|
25243
|
-
this.callUpdate(child, 0);
|
|
25244
|
-
} else {
|
|
25245
|
-
this.callUpdate(child, dt);
|
|
25246
|
-
}
|
|
25247
|
-
} else {
|
|
25248
|
-
this.callUpdate(child, dt);
|
|
25249
|
-
}
|
|
25250
|
-
}
|
|
25251
|
-
};
|
|
25252
|
-
_proto.callLateUpdate = function callLateUpdate(item, dt) {
|
|
25253
|
-
for(var _iterator = _create_for_of_iterator_helper_loose(item.itemBehaviours), _step; !(_step = _iterator()).done;){
|
|
25254
|
-
var itemBehaviour = _step.value;
|
|
25255
|
-
if (itemBehaviour.isActiveAndEnabled && itemBehaviour.isStartCalled) {
|
|
25256
|
-
itemBehaviour.lateUpdate(dt);
|
|
25257
|
-
}
|
|
25258
|
-
}
|
|
25259
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(item.rendererComponents), _step1; !(_step1 = _iterator1()).done;){
|
|
25260
|
-
var rendererComponent = _step1.value;
|
|
25261
|
-
if (rendererComponent.isActiveAndEnabled && rendererComponent.isStartCalled) {
|
|
25262
|
-
rendererComponent.lateUpdate(dt);
|
|
25263
|
-
}
|
|
25264
|
-
}
|
|
25265
|
-
for(var _iterator2 = _create_for_of_iterator_helper_loose(item.children), _step2; !(_step2 = _iterator2()).done;){
|
|
25266
|
-
var child = _step2.value;
|
|
25267
|
-
this.callLateUpdate(child, dt);
|
|
25268
|
-
}
|
|
25269
|
-
};
|
|
25270
25389
|
/**
|
|
25271
25390
|
* 构建父子树,同时保存到 itemCacheMap 中便于查找
|
|
25272
25391
|
*/ _proto.buildItemTree = function buildItemTree(compVFXItem) {
|
|
@@ -27548,11 +27667,12 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
|
|
|
27548
27667
|
return Engine;
|
|
27549
27668
|
}();
|
|
27550
27669
|
|
|
27670
|
+
var DEFAULT_FPS = 60;
|
|
27551
27671
|
/**
|
|
27552
27672
|
* 定时器类
|
|
27553
27673
|
*/ var Ticker = /*#__PURE__*/ function() {
|
|
27554
27674
|
function Ticker(fps) {
|
|
27555
|
-
if (fps === void 0) fps =
|
|
27675
|
+
if (fps === void 0) fps = DEFAULT_FPS;
|
|
27556
27676
|
this.paused = true;
|
|
27557
27677
|
this.lastTime = 0;
|
|
27558
27678
|
// deltaTime
|
|
@@ -27687,7 +27807,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
|
|
|
27687
27807
|
registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
|
|
27688
27808
|
registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
|
|
27689
27809
|
registerPlugin("interact", InteractLoader, exports.VFXItem, true);
|
|
27690
|
-
var version$1 = "2.0.
|
|
27810
|
+
var version$1 = "2.1.0-alpha.0";
|
|
27691
27811
|
logger.info("Core version: " + version$1 + ".");
|
|
27692
27812
|
|
|
27693
27813
|
var _obj;
|
|
@@ -28620,8 +28740,8 @@ var seed = 1;
|
|
|
28620
28740
|
this.material = mtl;
|
|
28621
28741
|
this.mesh.material = mtl.material;
|
|
28622
28742
|
};
|
|
28623
|
-
_proto.
|
|
28624
|
-
Mesh.prototype.
|
|
28743
|
+
_proto.onStart = function onStart() {
|
|
28744
|
+
Mesh.prototype.onStart.call(this);
|
|
28625
28745
|
this.engine.threeGroup.add(this.mesh);
|
|
28626
28746
|
};
|
|
28627
28747
|
/**
|
|
@@ -29228,8 +29348,8 @@ exports.ThreeSpriteComponent = /*#__PURE__*/ function(SpriteComponent) {
|
|
|
29228
29348
|
}
|
|
29229
29349
|
}
|
|
29230
29350
|
};
|
|
29231
|
-
_proto.
|
|
29232
|
-
SpriteComponent.prototype.
|
|
29351
|
+
_proto.onStart = function onStart() {
|
|
29352
|
+
SpriteComponent.prototype.onStart.call(this);
|
|
29233
29353
|
this.engine.threeGroup.add(this.threeMesh);
|
|
29234
29354
|
};
|
|
29235
29355
|
_proto.render = function render(renderer) {
|
|
@@ -29300,8 +29420,8 @@ exports.ThreeTextComponent = /*#__PURE__*/ function(ThreeSpriteComponent) {
|
|
|
29300
29420
|
return _this;
|
|
29301
29421
|
}
|
|
29302
29422
|
var _proto = ThreeTextComponent.prototype;
|
|
29303
|
-
_proto.
|
|
29304
|
-
ThreeSpriteComponent.prototype.
|
|
29423
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
29424
|
+
ThreeSpriteComponent.prototype.onUpdate.call(this, dt);
|
|
29305
29425
|
this.updateTexture(false);
|
|
29306
29426
|
};
|
|
29307
29427
|
_proto.fromData = function fromData(data) {
|
|
@@ -29368,7 +29488,7 @@ setMaxSpriteMeshItemCount(8);
|
|
|
29368
29488
|
*/ Mesh.create = function(engine, props) {
|
|
29369
29489
|
return new ThreeMesh(engine, props);
|
|
29370
29490
|
};
|
|
29371
|
-
var version = "2.0.
|
|
29491
|
+
var version = "2.1.0-alpha.0";
|
|
29372
29492
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
29373
29493
|
|
|
29374
29494
|
exports.AbstractPlugin = AbstractPlugin;
|
|
@@ -29396,6 +29516,7 @@ exports.Composition = Composition;
|
|
|
29396
29516
|
exports.CompositionComponent = CompositionComponent;
|
|
29397
29517
|
exports.CompositionSourceManager = CompositionSourceManager;
|
|
29398
29518
|
exports.DEFAULT_FONTS = DEFAULT_FONTS;
|
|
29519
|
+
exports.DEFAULT_FPS = DEFAULT_FPS;
|
|
29399
29520
|
exports.Database = Database;
|
|
29400
29521
|
exports.Downloader = Downloader;
|
|
29401
29522
|
exports.EFFECTS_COPY_MESH_NAME = EFFECTS_COPY_MESH_NAME;
|