@galacean/effects-core 2.0.3 → 2.0.4
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/asset-manager.d.ts +0 -4
- package/dist/comp-vfx-item.d.ts +2 -0
- package/dist/composition.d.ts +0 -2
- package/dist/index.js +57 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +57 -37
- 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/particle/particle-system.d.ts +1 -0
- package/dist/plugins/particle/particle-vfx-item.d.ts +11 -1
- package/dist/plugins/timeline/playables/sub-composition-mixer-playable.d.ts +5 -0
- package/dist/plugins/timeline/track.d.ts +54 -1
- package/dist/plugins/timeline/tracks/sub-composition-track.d.ts +2 -0
- package/dist/ticker.d.ts +1 -0
- package/package.json +1 -1
package/dist/asset-manager.d.ts
CHANGED
|
@@ -38,10 +38,6 @@ export declare class AssetManager implements Disposable {
|
|
|
38
38
|
*/
|
|
39
39
|
constructor(options?: SceneLoadOptions, downloader?: Downloader);
|
|
40
40
|
updateOptions(options?: SceneLoadOptions): void;
|
|
41
|
-
/**
|
|
42
|
-
* 根据用户传入的参数修改场景数据
|
|
43
|
-
*/
|
|
44
|
-
private updateSceneData;
|
|
45
41
|
/**
|
|
46
42
|
* 场景创建,通过 json 创建出场景对象,并进行提前编译等工作
|
|
47
43
|
* @param url - json 的 URL 链接或者 json 对象
|
package/dist/comp-vfx-item.d.ts
CHANGED
|
@@ -32,6 +32,8 @@ export declare class CompositionComponent extends Behaviour {
|
|
|
32
32
|
getReusable(): boolean;
|
|
33
33
|
update(dt: number): void;
|
|
34
34
|
createContent(): void;
|
|
35
|
+
showItems(): void;
|
|
36
|
+
hideItems(): void;
|
|
35
37
|
onDestroy(): void;
|
|
36
38
|
hitTest(ray: Ray, x: number, y: number, regions: Region[], force?: boolean, options?: CompositionHitTestOptions): Region[];
|
|
37
39
|
fromData(data: unknown): void;
|
package/dist/composition.d.ts
CHANGED
|
@@ -278,7 +278,6 @@ export declare class Composition extends EventEmitter<CompositionEvent<Compositi
|
|
|
278
278
|
/**
|
|
279
279
|
* 前进合成到指定时间
|
|
280
280
|
* @param time - 相对0时刻的时间
|
|
281
|
-
* @param skipRender - 是否跳过渲染
|
|
282
281
|
*/
|
|
283
282
|
private forwardTime;
|
|
284
283
|
/**
|
|
@@ -290,7 +289,6 @@ export declare class Composition extends EventEmitter<CompositionEvent<Compositi
|
|
|
290
289
|
/**
|
|
291
290
|
* 合成更新,针对所有 item 的更新
|
|
292
291
|
* @param deltaTime - 更新的时间步长
|
|
293
|
-
* @param skipRender - 是否需要渲染
|
|
294
292
|
*/
|
|
295
293
|
update(deltaTime: number): void;
|
|
296
294
|
private toLocalTime;
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime core for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.0.
|
|
6
|
+
* Version: v2.0.4
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -8086,7 +8086,7 @@ function _loadVideo() {
|
|
|
8086
8086
|
}, true);
|
|
8087
8087
|
}
|
|
8088
8088
|
video.addEventListener("error", function(e) {
|
|
8089
|
-
reject(
|
|
8089
|
+
reject("Load video fail.");
|
|
8090
8090
|
});
|
|
8091
8091
|
})
|
|
8092
8092
|
];
|
|
@@ -13560,7 +13560,6 @@ function _assert_this_initialized(self) {
|
|
|
13560
13560
|
/**
|
|
13561
13561
|
* 动画图,负责更新所有的动画节点
|
|
13562
13562
|
* @since 2.0.0
|
|
13563
|
-
* @internal
|
|
13564
13563
|
*/ var PlayableGraph = /*#__PURE__*/ function() {
|
|
13565
13564
|
function PlayableGraph() {
|
|
13566
13565
|
this.playableOutputs = [];
|
|
@@ -13620,7 +13619,6 @@ function _assert_this_initialized(self) {
|
|
|
13620
13619
|
/**
|
|
13621
13620
|
* 动画图可播放节点对象
|
|
13622
13621
|
* @since 2.0.0
|
|
13623
|
-
* @internal
|
|
13624
13622
|
*/ var Playable = /*#__PURE__*/ function() {
|
|
13625
13623
|
function Playable(graph, inputCount) {
|
|
13626
13624
|
if (inputCount === void 0) inputCount = 0;
|
|
@@ -13818,7 +13816,6 @@ function _assert_this_initialized(self) {
|
|
|
13818
13816
|
/**
|
|
13819
13817
|
* 动画图输出节点对象,将动画数据采样到绑定的元素属性上
|
|
13820
13818
|
* @since 2.0.0
|
|
13821
|
-
* @internal
|
|
13822
13819
|
*/ var PlayableOutput = /*#__PURE__*/ function() {
|
|
13823
13820
|
function PlayableOutput() {
|
|
13824
13821
|
this.sourceOutputPort = 0;
|
|
@@ -16629,6 +16626,9 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16629
16626
|
_proto.isFrozen = function isFrozen() {
|
|
16630
16627
|
return this.frozen;
|
|
16631
16628
|
};
|
|
16629
|
+
_proto.isEnded = function isEnded() {
|
|
16630
|
+
return this.ended;
|
|
16631
|
+
};
|
|
16632
16632
|
_proto.initEmitterTransform = function initEmitterTransform() {
|
|
16633
16633
|
var position = this.item.transform.position.clone();
|
|
16634
16634
|
var rotation = this.item.transform.rotation.clone();
|
|
@@ -17547,7 +17547,6 @@ function randomArrItem(arr, keepArr) {
|
|
|
17547
17547
|
|
|
17548
17548
|
/**
|
|
17549
17549
|
* @since 2.0.0
|
|
17550
|
-
* @internal
|
|
17551
17550
|
*/ var ParticleBehaviourPlayable = /*#__PURE__*/ function(Playable) {
|
|
17552
17551
|
_inherits(ParticleBehaviourPlayable, Playable);
|
|
17553
17552
|
function ParticleBehaviourPlayable() {
|
|
@@ -17575,11 +17574,8 @@ function randomArrItem(arr, keepArr) {
|
|
|
17575
17574
|
}
|
|
17576
17575
|
var particleSystem = this.particleSystem;
|
|
17577
17576
|
if (particleSystem) {
|
|
17578
|
-
// TODO: [1.31] @十弦 验证 https://github.com/galacean/effects-runtime/commit/3e7d73d37b7d98c2a25e4544e80e928b17801ccd#diff-fae062f28caf3771cfedd3a20dc22f9749bd054c7541bf2fd50a9a5e413153d4
|
|
17579
|
-
// particleSystem.setParentTransform(parentItem.transform);
|
|
17580
|
-
particleSystem.setVisible(true);
|
|
17581
17577
|
var deltaTime = context.deltaTime;
|
|
17582
|
-
if (this.time < particleSystem.item.duration && particleSystem.
|
|
17578
|
+
if (this.time >= 0 && this.time < particleSystem.item.duration && particleSystem.isEnded()) {
|
|
17583
17579
|
particleSystem.reset();
|
|
17584
17580
|
}
|
|
17585
17581
|
if (Math.abs(this.time - this.lastTime) < 0.001) {
|
|
@@ -18607,7 +18603,6 @@ var tempSize = new Vector3(1, 1, 1);
|
|
|
18607
18603
|
var tempPos = new Vector3();
|
|
18608
18604
|
/**
|
|
18609
18605
|
* @since 2.0.0
|
|
18610
|
-
* @internal
|
|
18611
18606
|
*/ var TransformAnimationPlayable = /*#__PURE__*/ function(AnimationPlayable) {
|
|
18612
18607
|
_inherits(TransformAnimationPlayable, AnimationPlayable);
|
|
18613
18608
|
function TransformAnimationPlayable() {
|
|
@@ -18769,7 +18764,6 @@ exports.TransformPlayableAsset = __decorate([
|
|
|
18769
18764
|
], exports.TransformPlayableAsset);
|
|
18770
18765
|
/**
|
|
18771
18766
|
* @since 2.0.0
|
|
18772
|
-
* @internal
|
|
18773
18767
|
*/ var ActivationPlayable = /*#__PURE__*/ function(Playable) {
|
|
18774
18768
|
_inherits(ActivationPlayable, Playable);
|
|
18775
18769
|
function ActivationPlayable() {
|
|
@@ -18920,7 +18914,6 @@ var AnimationClipPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
18920
18914
|
|
|
18921
18915
|
/**
|
|
18922
18916
|
* @since 2.0.0
|
|
18923
|
-
* @internal
|
|
18924
18917
|
*/ var TimelineClip = /*#__PURE__*/ function() {
|
|
18925
18918
|
function TimelineClip() {
|
|
18926
18919
|
this.start = 0;
|
|
@@ -19455,6 +19448,18 @@ function compareTracks(a, b) {
|
|
|
19455
19448
|
}
|
|
19456
19449
|
}
|
|
19457
19450
|
};
|
|
19451
|
+
_proto.showItems = function showItems() {
|
|
19452
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.items), _step; !(_step = _iterator()).done;){
|
|
19453
|
+
var item = _step.value;
|
|
19454
|
+
item.setVisible(true);
|
|
19455
|
+
}
|
|
19456
|
+
};
|
|
19457
|
+
_proto.hideItems = function hideItems() {
|
|
19458
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.items), _step; !(_step = _iterator()).done;){
|
|
19459
|
+
var item = _step.value;
|
|
19460
|
+
item.setVisible(false);
|
|
19461
|
+
}
|
|
19462
|
+
};
|
|
19458
19463
|
_proto.onDestroy = function onDestroy() {
|
|
19459
19464
|
if (this.item.composition) {
|
|
19460
19465
|
if (this.items) {
|
|
@@ -19565,6 +19570,34 @@ function compareTracks(a, b) {
|
|
|
19565
19570
|
return CompositionComponent;
|
|
19566
19571
|
}(Behaviour);
|
|
19567
19572
|
|
|
19573
|
+
var SubCompositionMixerPlayable = /*#__PURE__*/ function(Playable) {
|
|
19574
|
+
_inherits(SubCompositionMixerPlayable, Playable);
|
|
19575
|
+
function SubCompositionMixerPlayable() {
|
|
19576
|
+
return Playable.apply(this, arguments);
|
|
19577
|
+
}
|
|
19578
|
+
var _proto = SubCompositionMixerPlayable.prototype;
|
|
19579
|
+
_proto.processFrame = function processFrame(context) {
|
|
19580
|
+
var boundObject = context.output.getUserData();
|
|
19581
|
+
if (!_instanceof1(boundObject, CompositionComponent)) {
|
|
19582
|
+
return;
|
|
19583
|
+
}
|
|
19584
|
+
var compositionComponent = boundObject;
|
|
19585
|
+
var hasInput = false;
|
|
19586
|
+
for(var i = 0; i < this.getInputCount(); i++){
|
|
19587
|
+
if (this.getInputWeight(i) > 0) {
|
|
19588
|
+
hasInput = true;
|
|
19589
|
+
break;
|
|
19590
|
+
}
|
|
19591
|
+
}
|
|
19592
|
+
if (hasInput) {
|
|
19593
|
+
compositionComponent.showItems();
|
|
19594
|
+
} else {
|
|
19595
|
+
compositionComponent.hideItems();
|
|
19596
|
+
}
|
|
19597
|
+
};
|
|
19598
|
+
return SubCompositionMixerPlayable;
|
|
19599
|
+
}(Playable);
|
|
19600
|
+
|
|
19568
19601
|
exports.SubCompositionTrack = /*#__PURE__*/ function(TrackAsset) {
|
|
19569
19602
|
_inherits(SubCompositionTrack, TrackAsset);
|
|
19570
19603
|
function SubCompositionTrack() {
|
|
@@ -19577,6 +19610,9 @@ exports.SubCompositionTrack = /*#__PURE__*/ function(TrackAsset) {
|
|
|
19577
19610
|
}
|
|
19578
19611
|
return parentBinding.getComponent(CompositionComponent);
|
|
19579
19612
|
};
|
|
19613
|
+
_proto.createTrackMixer = function createTrackMixer(graph) {
|
|
19614
|
+
return new SubCompositionMixerPlayable(graph);
|
|
19615
|
+
};
|
|
19580
19616
|
return SubCompositionTrack;
|
|
19581
19617
|
}(exports.TrackAsset);
|
|
19582
19618
|
exports.SubCompositionTrack = __decorate([
|
|
@@ -23613,22 +23649,6 @@ var seed = 1;
|
|
|
23613
23649
|
this.timeout = timeout;
|
|
23614
23650
|
};
|
|
23615
23651
|
/**
|
|
23616
|
-
* 根据用户传入的参数修改场景数据
|
|
23617
|
-
*/ _proto.updateSceneData = function updateSceneData(items) {
|
|
23618
|
-
var variables = this.options.variables;
|
|
23619
|
-
if (!variables || Object.keys(variables).length === 0) {
|
|
23620
|
-
return;
|
|
23621
|
-
}
|
|
23622
|
-
items.forEach(function(item) {
|
|
23623
|
-
if (item.type === ItemType.text) {
|
|
23624
|
-
var textVariable = variables[item.name];
|
|
23625
|
-
if (textVariable) {
|
|
23626
|
-
item.content.options.text = textVariable;
|
|
23627
|
-
}
|
|
23628
|
-
}
|
|
23629
|
-
});
|
|
23630
|
-
};
|
|
23631
|
-
/**
|
|
23632
23652
|
* 场景创建,通过 json 创建出场景对象,并进行提前编译等工作
|
|
23633
23653
|
* @param url - json 的 URL 链接或者 json 对象
|
|
23634
23654
|
* @param renderer - renderer 对象,用于获取管理、编译 shader 及 GPU 上下文的参数
|
|
@@ -23755,7 +23775,6 @@ var seed = 1;
|
|
|
23755
23775
|
for(i1 = 0; i1 < scene.images.length; i1++){
|
|
23756
23776
|
scene.textureOptions[i1].image = scene.images[i1];
|
|
23757
23777
|
}
|
|
23758
|
-
_this.updateSceneData(scene.jsonScene.items);
|
|
23759
23778
|
_state.label = 5;
|
|
23760
23779
|
case 5:
|
|
23761
23780
|
return [
|
|
@@ -23812,7 +23831,6 @@ var seed = 1;
|
|
|
23812
23831
|
];
|
|
23813
23832
|
case 10:
|
|
23814
23833
|
loadedTextures = _state.sent();
|
|
23815
|
-
_this.updateSceneData(jsonScene.items);
|
|
23816
23834
|
scene = {
|
|
23817
23835
|
timeInfos: timeInfos,
|
|
23818
23836
|
url: url,
|
|
@@ -24104,7 +24122,7 @@ var seed = 1;
|
|
|
24104
24122
|
];
|
|
24105
24123
|
case 6:
|
|
24106
24124
|
e = _state.sent();
|
|
24107
|
-
throw new Error("Failed to load. Check the template or if the URL is " + (isVideo ? "video" : "image") + " type, URL: " + url + ", Error: " + e.message + ".");
|
|
24125
|
+
throw new Error("Failed to load. Check the template or if the URL is " + (isVideo ? "video" : "image") + " type, URL: " + url + ", Error: " + (e.message || e) + ".");
|
|
24108
24126
|
case 7:
|
|
24109
24127
|
return [
|
|
24110
24128
|
3,
|
|
@@ -25030,6 +25048,7 @@ var listOrder = 0;
|
|
|
25030
25048
|
* 跳到指定时间点(不做任何播放行为)
|
|
25031
25049
|
* @param time - 相对 startTime 的时间
|
|
25032
25050
|
*/ _proto.setTime = function setTime(time) {
|
|
25051
|
+
var speed = this.speed;
|
|
25033
25052
|
var pause = this.paused;
|
|
25034
25053
|
if (pause) {
|
|
25035
25054
|
this.resume();
|
|
@@ -25038,7 +25057,9 @@ var listOrder = 0;
|
|
|
25038
25057
|
this.rootComposition.start();
|
|
25039
25058
|
this.rootComposition.isStartCalled = true;
|
|
25040
25059
|
}
|
|
25060
|
+
this.setSpeed(1);
|
|
25041
25061
|
this.forwardTime(time + this.startTime);
|
|
25062
|
+
this.setSpeed(speed);
|
|
25042
25063
|
if (pause) {
|
|
25043
25064
|
this.pause();
|
|
25044
25065
|
}
|
|
@@ -25050,7 +25071,6 @@ var listOrder = 0;
|
|
|
25050
25071
|
/**
|
|
25051
25072
|
* 前进合成到指定时间
|
|
25052
25073
|
* @param time - 相对0时刻的时间
|
|
25053
|
-
* @param skipRender - 是否跳过渲染
|
|
25054
25074
|
*/ _proto.forwardTime = function forwardTime(time) {
|
|
25055
25075
|
var deltaTime = time * 1000 - this.rootComposition.time * 1000;
|
|
25056
25076
|
var reverse = deltaTime < 0;
|
|
@@ -25100,7 +25120,6 @@ var listOrder = 0;
|
|
|
25100
25120
|
/**
|
|
25101
25121
|
* 合成更新,针对所有 item 的更新
|
|
25102
25122
|
* @param deltaTime - 更新的时间步长
|
|
25103
|
-
* @param skipRender - 是否需要渲染
|
|
25104
25123
|
*/ _proto.update = function update(deltaTime) {
|
|
25105
25124
|
if (!this.assigned || this.paused) {
|
|
25106
25125
|
return;
|
|
@@ -27526,11 +27545,12 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
|
|
|
27526
27545
|
return Engine;
|
|
27527
27546
|
}();
|
|
27528
27547
|
|
|
27548
|
+
var DEFAULT_FPS = 60;
|
|
27529
27549
|
/**
|
|
27530
27550
|
* 定时器类
|
|
27531
27551
|
*/ var Ticker = /*#__PURE__*/ function() {
|
|
27532
27552
|
function Ticker(fps) {
|
|
27533
|
-
if (fps === void 0) fps =
|
|
27553
|
+
if (fps === void 0) fps = DEFAULT_FPS;
|
|
27534
27554
|
this.paused = true;
|
|
27535
27555
|
this.lastTime = 0;
|
|
27536
27556
|
// deltaTime
|
|
@@ -27665,7 +27685,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
|
|
|
27665
27685
|
registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
|
|
27666
27686
|
registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
|
|
27667
27687
|
registerPlugin("interact", InteractLoader, exports.VFXItem, true);
|
|
27668
|
-
var version = "2.0.
|
|
27688
|
+
var version = "2.0.4";
|
|
27669
27689
|
logger.info("Core version: " + version + ".");
|
|
27670
27690
|
|
|
27671
27691
|
exports.AbstractPlugin = AbstractPlugin;
|
|
@@ -27689,6 +27709,7 @@ exports.Composition = Composition;
|
|
|
27689
27709
|
exports.CompositionComponent = CompositionComponent;
|
|
27690
27710
|
exports.CompositionSourceManager = CompositionSourceManager;
|
|
27691
27711
|
exports.DEFAULT_FONTS = DEFAULT_FONTS;
|
|
27712
|
+
exports.DEFAULT_FPS = DEFAULT_FPS;
|
|
27692
27713
|
exports.Database = Database;
|
|
27693
27714
|
exports.Downloader = Downloader;
|
|
27694
27715
|
exports.EFFECTS_COPY_MESH_NAME = EFFECTS_COPY_MESH_NAME;
|