@galacean/effects-threejs 0.0.1-alpha.0 → 0.0.1-alpha.2
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/LICENSE +22 -0
- package/README.md +1 -1
- package/dist/index.js +399 -119
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +6 -6
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +399 -119
- package/dist/index.mjs.map +1 -1
- package/dist/three-composition.d.ts +1 -5
- 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: v0.0.1-alpha.
|
|
6
|
+
* Version: v0.0.1-alpha.2
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -6145,8 +6145,8 @@ var PLAYER_OPTIONS_ENV_EDITOR = 'editor';
|
|
|
6145
6145
|
var FILTER_NAME_NONE = 'none';
|
|
6146
6146
|
var DEG2RAD = 0.017453292519943295;
|
|
6147
6147
|
var HELP_LINK = {
|
|
6148
|
-
'Filter not imported': 'https://
|
|
6149
|
-
'Item duration can\'t be less than 0': 'https://
|
|
6148
|
+
'Filter not imported': 'https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg',
|
|
6149
|
+
'Item duration can\'t be less than 0': 'https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg',
|
|
6150
6150
|
};
|
|
6151
6151
|
|
|
6152
6152
|
/**
|
|
@@ -6689,7 +6689,7 @@ function asserts(condition, msg) {
|
|
|
6689
6689
|
* Name: @galacean/effects-specification
|
|
6690
6690
|
* Description: Galacean Effects JSON Specification
|
|
6691
6691
|
* Author: Ant Group CO., Ltd.
|
|
6692
|
-
* Version:
|
|
6692
|
+
* Version: v1.0.0
|
|
6693
6693
|
*/
|
|
6694
6694
|
|
|
6695
6695
|
/*********************************************/
|
|
@@ -7162,7 +7162,7 @@ var ItemEndBehavior$1;
|
|
|
7162
7162
|
(function (ItemEndBehavior) {
|
|
7163
7163
|
ItemEndBehavior[ItemEndBehavior["destroy"] = END_BEHAVIOR_DESTROY$1] = "destroy";
|
|
7164
7164
|
ItemEndBehavior[ItemEndBehavior["loop"] = END_BEHAVIOR_RESTART$1] = "loop";
|
|
7165
|
-
ItemEndBehavior[ItemEndBehavior["
|
|
7165
|
+
ItemEndBehavior[ItemEndBehavior["freeze"] = END_BEHAVIOR_FREEZE$1] = "freeze";
|
|
7166
7166
|
})(ItemEndBehavior$1 || (ItemEndBehavior$1 = {}));
|
|
7167
7167
|
var ParentItemEndBehavior$1;
|
|
7168
7168
|
(function (ParentItemEndBehavior) {
|
|
@@ -9762,12 +9762,11 @@ var VFXItem = /** @class */ (function () {
|
|
|
9762
9762
|
*/
|
|
9763
9763
|
this._frozen = false;
|
|
9764
9764
|
var id = props.id, name = props.name, delay = props.delay, parentId = props.parentId, endBehavior = props.endBehavior, transform = props.transform, _a = props.listIndex, listIndex = _a === void 0 ? 0 : _a, _b = props.duration, duration = _b === void 0 ? 0 : _b;
|
|
9765
|
-
var rootTransform = composition.rootTransform;
|
|
9766
9765
|
this.composition = composition;
|
|
9767
9766
|
this.id = id;
|
|
9768
9767
|
this.name = name;
|
|
9769
9768
|
this.delay = delay;
|
|
9770
|
-
this.transform = new Transform(__assign$1({ name: this.name }, transform),
|
|
9769
|
+
this.transform = new Transform(__assign$1({ name: this.name }, transform), composition.transform);
|
|
9771
9770
|
this.parentId = parentId;
|
|
9772
9771
|
this.duration = duration;
|
|
9773
9772
|
this.delayInms = (delay || 0) * 1000;
|
|
@@ -9775,6 +9774,7 @@ var VFXItem = /** @class */ (function () {
|
|
|
9775
9774
|
this.endBehavior = endBehavior;
|
|
9776
9775
|
this.lifetime = -(this.delayInms / this.durInms);
|
|
9777
9776
|
this.listIndex = listIndex;
|
|
9777
|
+
this.speed = 1;
|
|
9778
9778
|
this.onConstructed(props);
|
|
9779
9779
|
if (duration <= 0) {
|
|
9780
9780
|
throw Error("Item duration can't be less than 0, see ".concat(HELP_LINK['Item duration can\'t be less than 0']));
|
|
@@ -9853,6 +9853,20 @@ var VFXItem = /** @class */ (function () {
|
|
|
9853
9853
|
enumerable: false,
|
|
9854
9854
|
configurable: true
|
|
9855
9855
|
});
|
|
9856
|
+
/**
|
|
9857
|
+
* 设置元素的动画速度
|
|
9858
|
+
* @param speed - 速度
|
|
9859
|
+
*/
|
|
9860
|
+
VFXItem.prototype.setSpeed = function (speed) {
|
|
9861
|
+
this.speed = speed;
|
|
9862
|
+
};
|
|
9863
|
+
/**
|
|
9864
|
+
* 获取元素的动画速度
|
|
9865
|
+
* @returns
|
|
9866
|
+
*/
|
|
9867
|
+
VFXItem.prototype.getSpeed = function () {
|
|
9868
|
+
return this.speed;
|
|
9869
|
+
};
|
|
9856
9870
|
/**
|
|
9857
9871
|
* 重置元素状态属性
|
|
9858
9872
|
*/
|
|
@@ -9908,11 +9922,12 @@ var VFXItem = /** @class */ (function () {
|
|
|
9908
9922
|
};
|
|
9909
9923
|
/**
|
|
9910
9924
|
* 内部使用的更新回调,请不要重写此方法,重写 `onItemUpdate` 方法
|
|
9911
|
-
* @param
|
|
9925
|
+
* @param deltaTime
|
|
9912
9926
|
*/
|
|
9913
|
-
VFXItem.prototype.onUpdate = function (
|
|
9927
|
+
VFXItem.prototype.onUpdate = function (deltaTime) {
|
|
9914
9928
|
var _a, _b;
|
|
9915
9929
|
if (this.started && !this.frozen && this.composition) {
|
|
9930
|
+
var dt = deltaTime * this.speed;
|
|
9916
9931
|
var time = (this.timeInms += dt);
|
|
9917
9932
|
this.time += dt / 1000;
|
|
9918
9933
|
var now = time - this.delayInms;
|
|
@@ -9924,7 +9939,6 @@ var VFXItem = /** @class */ (function () {
|
|
|
9924
9939
|
this.composition.itemLifetimeEvent(this, true);
|
|
9925
9940
|
}
|
|
9926
9941
|
if (!this.delaying) {
|
|
9927
|
-
var endBehavior = this.endBehavior;
|
|
9928
9942
|
var lifetime = now / this.durInms;
|
|
9929
9943
|
var ended = this.isEnded(now);
|
|
9930
9944
|
var shouldUpdate = true;
|
|
@@ -9936,36 +9950,37 @@ var VFXItem = /** @class */ (function () {
|
|
|
9936
9950
|
this.composition.itemLifetimeEvent(this, false);
|
|
9937
9951
|
this.onEnd();
|
|
9938
9952
|
}
|
|
9939
|
-
|
|
9953
|
+
// 注意:不要定义私有变量替换 this.endBehavior,直接使用 this 上的!!!(Chrome 下会出现 endBehavior 为 5 时,能进入以下判断)
|
|
9954
|
+
if (this.endBehavior !== END_BEHAVIOR_FORWARD$1 && this.endBehavior !== END_BEHAVIOR_RESTART$1) {
|
|
9940
9955
|
this.ended = true;
|
|
9941
9956
|
this.transform.setValid(false);
|
|
9942
|
-
if (endBehavior === END_BEHAVIOR_PAUSE$1 ||
|
|
9943
|
-
endBehavior === END_BEHAVIOR_PAUSE_AND_DESTROY$1) {
|
|
9957
|
+
if (this.endBehavior === END_BEHAVIOR_PAUSE$1 ||
|
|
9958
|
+
this.endBehavior === END_BEHAVIOR_PAUSE_AND_DESTROY$1) {
|
|
9944
9959
|
(_b = (_a = this.composition).handlePlayerPause) === null || _b === void 0 ? void 0 : _b.call(_a, this);
|
|
9945
9960
|
}
|
|
9946
|
-
else if (endBehavior === END_BEHAVIOR_FREEZE$1) {
|
|
9961
|
+
else if (this.endBehavior === END_BEHAVIOR_FREEZE$1) {
|
|
9947
9962
|
this.transform.setValid(true);
|
|
9948
9963
|
shouldUpdate = true;
|
|
9949
9964
|
lifetime = 1;
|
|
9950
9965
|
}
|
|
9951
9966
|
if (!this.reusable) {
|
|
9952
|
-
if (endBehavior === END_BEHAVIOR_DESTROY$1 ||
|
|
9953
|
-
endBehavior === END_BEHAVIOR_PAUSE_AND_DESTROY$1 ||
|
|
9954
|
-
endBehavior === END_BEHAVIOR_DESTROY_CHILDREN$1) {
|
|
9967
|
+
if (this.endBehavior === END_BEHAVIOR_DESTROY$1 ||
|
|
9968
|
+
this.endBehavior === END_BEHAVIOR_PAUSE_AND_DESTROY$1 ||
|
|
9969
|
+
this.endBehavior === END_BEHAVIOR_DESTROY_CHILDREN$1) {
|
|
9955
9970
|
return this.dispose();
|
|
9956
9971
|
}
|
|
9957
|
-
else if (endBehavior === END_BEHAVIOR_PAUSE$1) {
|
|
9972
|
+
else if (this.endBehavior === END_BEHAVIOR_PAUSE$1) {
|
|
9958
9973
|
this.endBehavior = END_BEHAVIOR_FORWARD$1;
|
|
9959
9974
|
}
|
|
9960
9975
|
}
|
|
9961
|
-
else if (endBehavior === END_BEHAVIOR_DESTROY$1) {
|
|
9976
|
+
else if (this.endBehavior === END_BEHAVIOR_DESTROY$1) {
|
|
9962
9977
|
this.setVisible(false);
|
|
9963
9978
|
}
|
|
9964
9979
|
lifetime = Math.min(lifetime, 1);
|
|
9965
9980
|
}
|
|
9966
9981
|
else {
|
|
9967
9982
|
shouldUpdate = true;
|
|
9968
|
-
if (endBehavior === END_BEHAVIOR_RESTART$1) {
|
|
9983
|
+
if (this.endBehavior === END_BEHAVIOR_RESTART$1) {
|
|
9969
9984
|
this.ended = true;
|
|
9970
9985
|
lifetime = lifetime % 1;
|
|
9971
9986
|
}
|
|
@@ -10014,6 +10029,22 @@ var VFXItem = /** @class */ (function () {
|
|
|
10014
10029
|
VFXItem.prototype.onEnd = function () {
|
|
10015
10030
|
// OVERRIDE
|
|
10016
10031
|
};
|
|
10032
|
+
/**
|
|
10033
|
+
* 通过指定 r、g、b、a 值设置元素的颜色
|
|
10034
|
+
* @param {number} r
|
|
10035
|
+
* @param {number} g
|
|
10036
|
+
* @param {number} b
|
|
10037
|
+
* @param {number} a
|
|
10038
|
+
* @internal
|
|
10039
|
+
*/
|
|
10040
|
+
VFXItem.prototype.setColor = function (r, g, b, a) {
|
|
10041
|
+
};
|
|
10042
|
+
/**
|
|
10043
|
+
* 设置元素的透明度
|
|
10044
|
+
* @param opacity - 透明度值,范围 [0,1]
|
|
10045
|
+
*/
|
|
10046
|
+
VFXItem.prototype.setOpacity = function (opacity) {
|
|
10047
|
+
};
|
|
10017
10048
|
/**
|
|
10018
10049
|
* 获取元素显隐属性
|
|
10019
10050
|
*/
|
|
@@ -10065,6 +10096,57 @@ var VFXItem = /** @class */ (function () {
|
|
|
10065
10096
|
VFXItem.prototype.getNodeTransform = function (itemId) {
|
|
10066
10097
|
return this.transform;
|
|
10067
10098
|
};
|
|
10099
|
+
/**
|
|
10100
|
+
* 设置元素在 3D 坐标轴上相对移动
|
|
10101
|
+
*/
|
|
10102
|
+
VFXItem.prototype.translate = function (x, y, z) {
|
|
10103
|
+
this.transform.translate(x, y, z);
|
|
10104
|
+
};
|
|
10105
|
+
/**
|
|
10106
|
+
* 设置元素在 3D 坐标轴上相对旋转(角度)
|
|
10107
|
+
*/
|
|
10108
|
+
VFXItem.prototype.rotate = function (x, y, z) {
|
|
10109
|
+
var q = [0, 0, 0, 1];
|
|
10110
|
+
quatFromRotation(q, x, y, z);
|
|
10111
|
+
quatStar(q, q);
|
|
10112
|
+
this.transform.rotateByQuat(q);
|
|
10113
|
+
};
|
|
10114
|
+
/**
|
|
10115
|
+
* 设置元素在 3D 坐标轴上相对缩放
|
|
10116
|
+
*/
|
|
10117
|
+
VFXItem.prototype.scale = function (x, y, z) {
|
|
10118
|
+
this.transform.scaleBy(x, y, z);
|
|
10119
|
+
};
|
|
10120
|
+
/**
|
|
10121
|
+
* 设置元素的在画布上的像素位置
|
|
10122
|
+
*/
|
|
10123
|
+
VFXItem.prototype.setPositionByPixel = function (x, y) {
|
|
10124
|
+
if (this.composition) {
|
|
10125
|
+
var z = this.transform.getWorldPosition()[2];
|
|
10126
|
+
var _a = __read$1(this.composition.camera.getInverseVPRatio(z), 2), rx = _a[0], ry = _a[1];
|
|
10127
|
+
var width = this.composition.renderer.getWidth() / 2;
|
|
10128
|
+
var height = this.composition.renderer.getHeight() / 2;
|
|
10129
|
+
this.transform.setPosition(2 * x * rx / width, -2 * y * ry / height, z);
|
|
10130
|
+
}
|
|
10131
|
+
};
|
|
10132
|
+
/**
|
|
10133
|
+
* 设置元素在 3D 坐标轴的位置
|
|
10134
|
+
*/
|
|
10135
|
+
VFXItem.prototype.setPosition = function (x, y, z) {
|
|
10136
|
+
this.transform.setPosition(x, y, z);
|
|
10137
|
+
};
|
|
10138
|
+
/**
|
|
10139
|
+
* 设置元素在 3D 坐标轴的角度
|
|
10140
|
+
*/
|
|
10141
|
+
VFXItem.prototype.setRotation = function (x, y, z) {
|
|
10142
|
+
this.transform.setRotation(x, y, z);
|
|
10143
|
+
};
|
|
10144
|
+
/**
|
|
10145
|
+
* 设置元素在 3D 坐标轴的缩放
|
|
10146
|
+
*/
|
|
10147
|
+
VFXItem.prototype.setScale = function (x, y, z) {
|
|
10148
|
+
this.transform.setScale(x, y, z);
|
|
10149
|
+
};
|
|
10068
10150
|
/**
|
|
10069
10151
|
* 获取元素包围盒
|
|
10070
10152
|
* @override
|
|
@@ -10119,6 +10201,15 @@ var VFXItem = /** @class */ (function () {
|
|
|
10119
10201
|
}
|
|
10120
10202
|
this.started = false;
|
|
10121
10203
|
};
|
|
10204
|
+
VFXItem.prototype.translateByPixel = function (x, y) {
|
|
10205
|
+
if (this.composition) {
|
|
10206
|
+
var z = this.transform.getWorldPosition()[2];
|
|
10207
|
+
var _a = __read$1(this.composition.camera.getInverseVPRatio(z), 2), rx = _a[0], ry = _a[1];
|
|
10208
|
+
var width = this.composition.renderer.getWidth() / 2;
|
|
10209
|
+
var height = this.composition.renderer.getHeight() / 2;
|
|
10210
|
+
this.transform.translate(2 * x * rx / width, -2 * y * ry / height, 0);
|
|
10211
|
+
}
|
|
10212
|
+
};
|
|
10122
10213
|
/**
|
|
10123
10214
|
* 销毁元素
|
|
10124
10215
|
*/
|
|
@@ -11178,6 +11269,21 @@ function generateHalfFloatTexture(engine, data, width, height) {
|
|
|
11178
11269
|
});
|
|
11179
11270
|
}
|
|
11180
11271
|
|
|
11272
|
+
var RUNTIME_ENV = 'runtime_env';
|
|
11273
|
+
var LOG_TYPE = 'galacean-effects';
|
|
11274
|
+
var RENDER_PREFER_LOOKUP_TEXTURE = 'lookup_texture';
|
|
11275
|
+
// 数据模板使用 offscreen canvas 绘制
|
|
11276
|
+
var TEMPLATE_USE_OFFSCREEN_CANVAS = 'offscreen_canvas';
|
|
11277
|
+
// 后处理配置相关
|
|
11278
|
+
var POST_PROCESS_SETTINGS = 'post_process_settings';
|
|
11279
|
+
var config = {};
|
|
11280
|
+
function getConfig(name) {
|
|
11281
|
+
return config[name];
|
|
11282
|
+
}
|
|
11283
|
+
function setConfig(name, value) {
|
|
11284
|
+
return config[name] = value;
|
|
11285
|
+
}
|
|
11286
|
+
|
|
11181
11287
|
var HEADER_LEN = 12 + 13 * 4; // identifier + header elements (not including key value meta-data pairs)
|
|
11182
11288
|
var COMPRESSED_2D = 0; // uses a gl.compressedTexImage2D()
|
|
11183
11289
|
//const COMPRESSED_3D = 1; // uses a gl.compressedTexImage3D()
|
|
@@ -11226,15 +11332,24 @@ var KTXTexture = /** @class */ (function () {
|
|
|
11226
11332
|
// value of zero is an indication to generate mipmaps @ runtime. Not usually allowed for compressed, so disregard.
|
|
11227
11333
|
this.numberOfMipmapLevels = Math.max(1, this.numberOfMipmapLevels);
|
|
11228
11334
|
if (this.pixelHeight === 0 || this.pixelDepth !== 0) {
|
|
11229
|
-
console.warn(
|
|
11335
|
+
console.warn({
|
|
11336
|
+
content: 'only 2D textures currently supported',
|
|
11337
|
+
type: LOG_TYPE,
|
|
11338
|
+
});
|
|
11230
11339
|
return;
|
|
11231
11340
|
}
|
|
11232
11341
|
if (this.numberOfArrayElements !== 0) {
|
|
11233
|
-
console.warn(
|
|
11342
|
+
console.warn({
|
|
11343
|
+
content: 'texture arrays not currently supported',
|
|
11344
|
+
type: LOG_TYPE,
|
|
11345
|
+
});
|
|
11234
11346
|
return;
|
|
11235
11347
|
}
|
|
11236
11348
|
if (this.numberOfFaces !== facesExpected) {
|
|
11237
|
-
console.warn(
|
|
11349
|
+
console.warn({
|
|
11350
|
+
content: 'number of faces expected' + facesExpected + ', but found ' + this.numberOfFaces,
|
|
11351
|
+
type: LOG_TYPE,
|
|
11352
|
+
});
|
|
11238
11353
|
return;
|
|
11239
11354
|
}
|
|
11240
11355
|
// we now have a completely validated file, so could use existence of loadType as success
|
|
@@ -11921,20 +12036,6 @@ function generateEmptyTypedArray(type) {
|
|
|
11921
12036
|
return new Float32Array(0);
|
|
11922
12037
|
}
|
|
11923
12038
|
|
|
11924
|
-
var RUNTIME_ENV = 'runtime_env';
|
|
11925
|
-
var RENDER_PREFER_LOOKUP_TEXTURE = 'lookup_texture';
|
|
11926
|
-
// 数据模板使用 offscreen canvas 绘制
|
|
11927
|
-
var TEMPLATE_USE_OFFSCREEN_CANVAS = 'offscreen_canvas';
|
|
11928
|
-
// 后处理配置相关
|
|
11929
|
-
var POST_PROCESS_SETTINGS = 'post_process_settings';
|
|
11930
|
-
var config = {};
|
|
11931
|
-
function getConfig(name) {
|
|
11932
|
-
return config[name];
|
|
11933
|
-
}
|
|
11934
|
-
function setConfig(name, value) {
|
|
11935
|
-
return config[name] = value;
|
|
11936
|
-
}
|
|
11937
|
-
|
|
11938
12039
|
var seed$8 = 1;
|
|
11939
12040
|
/**
|
|
11940
12041
|
* Mesh 抽象类
|
|
@@ -14271,14 +14372,10 @@ var SpriteMesh = /** @class */ (function () {
|
|
|
14271
14372
|
var uSize = [1, 1, 1, 0];
|
|
14272
14373
|
var uQuat = [0, 0, 1, 1];
|
|
14273
14374
|
var uColor = selfData.color || [mainDataArray[uColorStart], mainDataArray[uColorStart + 1], mainDataArray[uColorStart + 2], mainDataArray[uColorStart + 3]];
|
|
14274
|
-
|
|
14275
|
-
|
|
14276
|
-
|
|
14375
|
+
if (!isNaN(item.getCustomOpacity())) {
|
|
14376
|
+
uColor[3] = item.getCustomOpacity();
|
|
14377
|
+
}
|
|
14277
14378
|
selfData.transform.assignWorldTRS(uPos, uQuat, uSize);
|
|
14278
|
-
// TODO 兼容改变锚点,位置不移动
|
|
14279
|
-
// if (selfData.startSize) {
|
|
14280
|
-
// selfData.transform.scaleBy(selfData.startSize[0], selfData.startSize[1], 1);
|
|
14281
|
-
// }
|
|
14282
14379
|
/* 要过包含父节点颜色/透明度变化的动画的帧对比 打开这段兼容代码 */
|
|
14283
14380
|
// vecMulCombine(uColor, selfData.color, parentData.color);
|
|
14284
14381
|
/***********************/
|
|
@@ -15459,6 +15556,9 @@ var CalculateItem = /** @class */ (function () {
|
|
|
15459
15556
|
get: function () {
|
|
15460
15557
|
return this.basicTransform.scale;
|
|
15461
15558
|
},
|
|
15559
|
+
set: function (scale) {
|
|
15560
|
+
this.basicTransform.scale = scale;
|
|
15561
|
+
},
|
|
15462
15562
|
enumerable: false,
|
|
15463
15563
|
configurable: true
|
|
15464
15564
|
});
|
|
@@ -15657,6 +15757,21 @@ var SpriteItem = /** @class */ (function (_super) {
|
|
|
15657
15757
|
}
|
|
15658
15758
|
return ret;
|
|
15659
15759
|
};
|
|
15760
|
+
/**
|
|
15761
|
+
* @internal
|
|
15762
|
+
*/
|
|
15763
|
+
SpriteItem.prototype.setColor = function (r, g, b, a) {
|
|
15764
|
+
this.customColor = [r, g, b, a];
|
|
15765
|
+
};
|
|
15766
|
+
SpriteItem.prototype.setOpacity = function (opacity) {
|
|
15767
|
+
this.customOpacity = opacity;
|
|
15768
|
+
};
|
|
15769
|
+
/**
|
|
15770
|
+
* @internal
|
|
15771
|
+
*/
|
|
15772
|
+
SpriteItem.prototype.getCustomOpacity = function () {
|
|
15773
|
+
return this.customOpacity;
|
|
15774
|
+
};
|
|
15660
15775
|
SpriteItem.prototype.getRenderData = function (_time, init) {
|
|
15661
15776
|
var ret = _super.prototype.getRenderData.call(this, _time, init);
|
|
15662
15777
|
var colorInc = vecFill(tempColor, 1);
|
|
@@ -15664,18 +15779,23 @@ var SpriteItem = /** @class */ (function (_super) {
|
|
|
15664
15779
|
var time = _time < 0 ? _time : Math.max(_time, 0.);
|
|
15665
15780
|
var duration = this.options.duration;
|
|
15666
15781
|
var life = time / duration < 0 ? 0 : (time / duration > 1 ? 1 : time / duration);
|
|
15667
|
-
|
|
15668
|
-
|
|
15669
|
-
if (colorOverLifetime) {
|
|
15670
|
-
colorInc = getColorFromGradientStops(colorOverLifetime, life, true);
|
|
15671
|
-
colorChanged = true;
|
|
15672
|
-
}
|
|
15673
|
-
if (opacityOverLifetime) {
|
|
15674
|
-
colorInc[3] *= opacityOverLifetime.getValue(life);
|
|
15675
|
-
colorChanged = true;
|
|
15782
|
+
if (this.customColor) {
|
|
15783
|
+
ret.color = this.customColor;
|
|
15676
15784
|
}
|
|
15677
|
-
|
|
15678
|
-
|
|
15785
|
+
else {
|
|
15786
|
+
var opacityOverLifetime = this.opacityOverLifetime;
|
|
15787
|
+
var colorOverLifetime = this.colorOverLifetime;
|
|
15788
|
+
if (colorOverLifetime) {
|
|
15789
|
+
colorInc = getColorFromGradientStops(colorOverLifetime, life, true);
|
|
15790
|
+
colorChanged = true;
|
|
15791
|
+
}
|
|
15792
|
+
if (opacityOverLifetime) {
|
|
15793
|
+
colorInc[3] *= opacityOverLifetime.getValue(life);
|
|
15794
|
+
colorChanged = true;
|
|
15795
|
+
}
|
|
15796
|
+
if (colorChanged || init) {
|
|
15797
|
+
ret.color = vecMulCombine(this.startColor, colorInc, this.options.startColor);
|
|
15798
|
+
}
|
|
15679
15799
|
}
|
|
15680
15800
|
var ta = this.textureSheetAnimation;
|
|
15681
15801
|
if (ta) {
|
|
@@ -15780,6 +15900,15 @@ var SpriteVFXItem = /** @class */ (function (_super) {
|
|
|
15780
15900
|
this.transform.assignWorldTRS(pos);
|
|
15781
15901
|
return pos;
|
|
15782
15902
|
};
|
|
15903
|
+
/**
|
|
15904
|
+
* @internal
|
|
15905
|
+
*/
|
|
15906
|
+
SpriteVFXItem.prototype.setColor = function (r, g, b, a) {
|
|
15907
|
+
this.content.setColor(r, g, b, a);
|
|
15908
|
+
};
|
|
15909
|
+
SpriteVFXItem.prototype.setOpacity = function (opacity) {
|
|
15910
|
+
this.content.setOpacity(opacity);
|
|
15911
|
+
};
|
|
15783
15912
|
/**
|
|
15784
15913
|
* 获取图层包围盒的类型和世界坐标
|
|
15785
15914
|
* @returns
|
|
@@ -18462,6 +18591,32 @@ var ParticleSystem = /** @class */ (function () {
|
|
|
18462
18591
|
this.trailMesh.mesh.setVisible(visible);
|
|
18463
18592
|
}
|
|
18464
18593
|
};
|
|
18594
|
+
ParticleSystem.prototype.setOpacity = function (opacity) {
|
|
18595
|
+
var material = this.particleMesh.mesh.material;
|
|
18596
|
+
var geometry = this.particleMesh.mesh.geometry;
|
|
18597
|
+
var originalColor = material.getVector4('uOpacityOverLifetimeValue') || [1, 1, 1, 1];
|
|
18598
|
+
material.setVector4('uOpacityOverLifetimeValue', [originalColor[0], originalColor[1], originalColor[2], opacity]);
|
|
18599
|
+
var data = geometry.getAttributeData('aColor') || [];
|
|
18600
|
+
for (var i = 0; i < data.length; i += 32) {
|
|
18601
|
+
data[i * 8 + 7] = opacity;
|
|
18602
|
+
}
|
|
18603
|
+
};
|
|
18604
|
+
/**
|
|
18605
|
+
* @internal
|
|
18606
|
+
*/
|
|
18607
|
+
ParticleSystem.prototype.setColor = function (r, g, b, a) {
|
|
18608
|
+
var material = this.particleMesh.mesh.material;
|
|
18609
|
+
var geometry = this.particleMesh.mesh.geometry;
|
|
18610
|
+
var originalColor = material.getVector4('uOpacityOverLifetimeValue') || [1, 1, 1, 1];
|
|
18611
|
+
material.setVector4('uOpacityOverLifetimeValue', [originalColor[0], originalColor[1], originalColor[2], a]);
|
|
18612
|
+
var data = geometry.getAttributeData('aColor') || [];
|
|
18613
|
+
for (var i = 0; i < data.length; i += 32) {
|
|
18614
|
+
data[i * 8 + 4] = r;
|
|
18615
|
+
data[i * 8 + 5] = g;
|
|
18616
|
+
data[i * 8 + 6] = b;
|
|
18617
|
+
data[i * 8 + 7] = a;
|
|
18618
|
+
}
|
|
18619
|
+
};
|
|
18465
18620
|
ParticleSystem.prototype.setParentTransform = function (transform) {
|
|
18466
18621
|
this.parentTransform = transform;
|
|
18467
18622
|
};
|
|
@@ -19012,6 +19167,15 @@ var ParticleVFXItem = /** @class */ (function (_super) {
|
|
|
19012
19167
|
content.meshes.forEach(function (mesh) { return mesh.dispose({ material: { textures: exports.DestroyOptions.keep } }); });
|
|
19013
19168
|
}
|
|
19014
19169
|
};
|
|
19170
|
+
/**
|
|
19171
|
+
* @internal
|
|
19172
|
+
*/
|
|
19173
|
+
ParticleVFXItem.prototype.setColor = function (r, g, b, a) {
|
|
19174
|
+
this.content.setColor(r, g, b, a);
|
|
19175
|
+
};
|
|
19176
|
+
ParticleVFXItem.prototype.setOpacity = function (opacity) {
|
|
19177
|
+
this.content.setOpacity(opacity);
|
|
19178
|
+
};
|
|
19015
19179
|
ParticleVFXItem.prototype.stopParticleEmission = function () {
|
|
19016
19180
|
if (this.content) {
|
|
19017
19181
|
this.content.emissionStopped = true;
|
|
@@ -19320,6 +19484,9 @@ var CalculateVFXItem = /** @class */ (function (_super) {
|
|
|
19320
19484
|
/********************/
|
|
19321
19485
|
}
|
|
19322
19486
|
};
|
|
19487
|
+
CalculateVFXItem.prototype.setScale = function (x, y, z) {
|
|
19488
|
+
this.content.startSize = [x, y, z];
|
|
19489
|
+
};
|
|
19323
19490
|
CalculateVFXItem.prototype.getHitTestParams = function (force) {
|
|
19324
19491
|
};
|
|
19325
19492
|
CalculateVFXItem.prototype.getRenderData = function () {
|
|
@@ -20903,11 +21070,12 @@ var TextItem = /** @class */ (function (_super) {
|
|
|
20903
21070
|
var layout = this.textLayout;
|
|
20904
21071
|
var fontScale = style.fontScale;
|
|
20905
21072
|
var width = (layout.width + style.fontOffset) * fontScale;
|
|
21073
|
+
var height = layout.height * fontScale;
|
|
20906
21074
|
var fontSize = style.fontSize * fontScale;
|
|
20907
21075
|
var lineHeight = layout.lineHeight * fontScale;
|
|
20908
21076
|
this.char = this.text.split('');
|
|
20909
21077
|
this.canvas.width = width;
|
|
20910
|
-
this.canvas.height =
|
|
21078
|
+
this.canvas.height = height;
|
|
20911
21079
|
context.clearRect(0, 0, width, this.canvas.height);
|
|
20912
21080
|
// fix bug 1/255
|
|
20913
21081
|
context.fillStyle = 'rgba(255, 255, 255, 0.0039)';
|
|
@@ -20972,12 +21140,16 @@ var TextItem = /** @class */ (function (_super) {
|
|
|
20972
21140
|
}
|
|
20973
21141
|
//与 toDataURL() 两种方式都需要像素读取操作
|
|
20974
21142
|
var imageData = context.getImageData(0, 0, this.canvas.width, this.canvas.height);
|
|
20975
|
-
(_a = this.mesh) === null || _a === void 0 ? void 0 : _a.mesh.material.setTexture('uSampler0', Texture.createWithData(this.engine,
|
|
21143
|
+
(_a = this.mesh) === null || _a === void 0 ? void 0 : _a.mesh.material.setTexture('uSampler0', Texture.createWithData(this.engine, {
|
|
21144
|
+
data: new Uint8Array(imageData.data),
|
|
21145
|
+
width: imageData.width,
|
|
21146
|
+
height: imageData.height,
|
|
21147
|
+
}, {
|
|
20976
21148
|
flipY: true,
|
|
20977
21149
|
magFilter: glContext.LINEAR,
|
|
20978
21150
|
minFilter: glContext.LINEAR,
|
|
20979
|
-
wrapS: glContext.
|
|
20980
|
-
wrapT: glContext.
|
|
21151
|
+
wrapS: glContext.CLAMP_TO_EDGE,
|
|
21152
|
+
wrapT: glContext.CLAMP_TO_EDGE,
|
|
20981
21153
|
}));
|
|
20982
21154
|
this.isDirty = false;
|
|
20983
21155
|
};
|
|
@@ -21121,7 +21293,7 @@ var TextLoader = /** @class */ (function (_super) {
|
|
|
21121
21293
|
return _this;
|
|
21122
21294
|
}
|
|
21123
21295
|
TextLoader.prototype.onCompositionDestroyed = function (composition) {
|
|
21124
|
-
if (composition.reusable
|
|
21296
|
+
if (composition.reusable) {
|
|
21125
21297
|
this.addItems.forEach(function (vfxitem) {
|
|
21126
21298
|
var _a;
|
|
21127
21299
|
(_a = vfxitem.content.mesh) === null || _a === void 0 ? void 0 : _a.mesh.dispose({ material: { textures: exports.DestroyOptions.keep } });
|
|
@@ -22075,6 +22247,16 @@ var Camera = /** @class */ (function () {
|
|
|
22075
22247
|
Camera.prototype.getModelViewProjection = function (out, model) {
|
|
22076
22248
|
return mat4multiply(out, this.viewProjectionMatrix, model);
|
|
22077
22249
|
};
|
|
22250
|
+
/**
|
|
22251
|
+
* 获取归一化坐标和 3D 世界坐标的换算比例
|
|
22252
|
+
* @param z - 当前的位置 z
|
|
22253
|
+
*/
|
|
22254
|
+
Camera.prototype.getInverseVPRatio = function (z) {
|
|
22255
|
+
var pos = [0, 0, 0];
|
|
22256
|
+
var nz = vec3MulMat4(pos, [0, 0, z], this.getViewProjectionMatrix())[2];
|
|
22257
|
+
vec3MulMat4(pos, [1, 1, nz], this.getInverseViewProjectionMatrix());
|
|
22258
|
+
return pos;
|
|
22259
|
+
};
|
|
22078
22260
|
/**
|
|
22079
22261
|
* 设置相机的旋转四元数
|
|
22080
22262
|
* @param value - 旋转四元数
|
|
@@ -22265,7 +22447,7 @@ var filters = {
|
|
|
22265
22447
|
* Name: @galacean/effects-specification
|
|
22266
22448
|
* Description: Galacean Effects JSON Specification
|
|
22267
22449
|
* Author: Ant Group CO., Ltd.
|
|
22268
|
-
* Version:
|
|
22450
|
+
* Version: v1.0.0
|
|
22269
22451
|
*/
|
|
22270
22452
|
|
|
22271
22453
|
/*********************************************/
|
|
@@ -22736,7 +22918,7 @@ var ItemEndBehavior;
|
|
|
22736
22918
|
(function (ItemEndBehavior) {
|
|
22737
22919
|
ItemEndBehavior[ItemEndBehavior["destroy"] = END_BEHAVIOR_DESTROY] = "destroy";
|
|
22738
22920
|
ItemEndBehavior[ItemEndBehavior["loop"] = END_BEHAVIOR_RESTART] = "loop";
|
|
22739
|
-
ItemEndBehavior[ItemEndBehavior["
|
|
22921
|
+
ItemEndBehavior[ItemEndBehavior["freeze"] = END_BEHAVIOR_FREEZE] = "freeze";
|
|
22740
22922
|
})(ItemEndBehavior || (ItemEndBehavior = {}));
|
|
22741
22923
|
var ParentItemEndBehavior;
|
|
22742
22924
|
(function (ParentItemEndBehavior) {
|
|
@@ -22982,7 +23164,12 @@ function __read(o, n) {
|
|
|
22982
23164
|
finally { if (e) throw e.error; }
|
|
22983
23165
|
}
|
|
22984
23166
|
return ar;
|
|
22985
|
-
}
|
|
23167
|
+
}
|
|
23168
|
+
|
|
23169
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
23170
|
+
var e = new Error(message);
|
|
23171
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
23172
|
+
};
|
|
22986
23173
|
|
|
22987
23174
|
function arrAdd(arr, item) {
|
|
22988
23175
|
if (!arr.includes(item)) {
|
|
@@ -23604,7 +23791,7 @@ function version21Migration(json) {
|
|
|
23604
23791
|
composition.items.forEach(function (item) {
|
|
23605
23792
|
if (item.type === ItemType.null) {
|
|
23606
23793
|
if (item.endBehavior === ItemEndBehavior.destroy) {
|
|
23607
|
-
item.endBehavior = ItemEndBehavior.
|
|
23794
|
+
item.endBehavior = ItemEndBehavior.freeze;
|
|
23608
23795
|
}
|
|
23609
23796
|
}
|
|
23610
23797
|
});
|
|
@@ -23612,6 +23799,24 @@ function version21Migration(json) {
|
|
|
23612
23799
|
json.version = '2.1';
|
|
23613
23800
|
return json;
|
|
23614
23801
|
}
|
|
23802
|
+
/**
|
|
23803
|
+
* 2.2 以下版本数据适配(mars-player@2.5.0 及以上版本支持 2.2 以下数据的适配)
|
|
23804
|
+
*/
|
|
23805
|
+
function version22Migration(json) {
|
|
23806
|
+
var _a;
|
|
23807
|
+
var singleVersion = (_a = json.version) === null || _a === void 0 ? void 0 : _a.split('.');
|
|
23808
|
+
if (!singleVersion || Number(singleVersion[0]) > 2 || (Number(singleVersion[0]) === 2 && Number(singleVersion[1]) >= 2)) {
|
|
23809
|
+
return json;
|
|
23810
|
+
}
|
|
23811
|
+
json.compositions.forEach(function (composition) {
|
|
23812
|
+
composition.items.forEach(function (item) {
|
|
23813
|
+
if (item.type === ItemType.mesh || item.type === ItemType.light) {
|
|
23814
|
+
item.endBehavior = item.endBehavior === 1 ? ItemEndBehavior.destroy : item.endBehavior;
|
|
23815
|
+
}
|
|
23816
|
+
});
|
|
23817
|
+
});
|
|
23818
|
+
return json;
|
|
23819
|
+
}
|
|
23615
23820
|
|
|
23616
23821
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
23617
23822
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
@@ -23621,6 +23826,8 @@ function getStandardJSON(json) {
|
|
|
23621
23826
|
if (!json || typeof json !== 'object') {
|
|
23622
23827
|
throw Error('expect a json object');
|
|
23623
23828
|
}
|
|
23829
|
+
// 修正老版本数据中,meshItem以及lightItem结束行为错误问题
|
|
23830
|
+
version22Migration(json);
|
|
23624
23831
|
if (v0.test(json.version)) {
|
|
23625
23832
|
reverseParticle = ((_a = (/^(\d+)/).exec(json.version)) === null || _a === void 0 ? void 0 : _a[0]) === '0';
|
|
23626
23833
|
return version21Migration(getStandardJSONFromV0(json));
|
|
@@ -24219,7 +24426,10 @@ var AssetManager = /** @class */ (function () {
|
|
|
24219
24426
|
// 触发插件系统 pluginSystem 的回调 prepareResource
|
|
24220
24427
|
_d.sent();
|
|
24221
24428
|
totalTime = performance.now() - startTime;
|
|
24222
|
-
console.
|
|
24429
|
+
console.info({
|
|
24430
|
+
content: "".concat(timeLabel, ": ").concat(totalTime.toFixed(4), "ms, ").concat(timeInfos.join(' ')),
|
|
24431
|
+
type: LOG_TYPE,
|
|
24432
|
+
});
|
|
24223
24433
|
window.clearTimeout(loadTimer);
|
|
24224
24434
|
scene.totalTime = totalTime;
|
|
24225
24435
|
scene.startTime = startTime;
|
|
@@ -24343,7 +24553,10 @@ var AssetManager = /** @class */ (function () {
|
|
|
24343
24553
|
return [3 /*break*/, 4];
|
|
24344
24554
|
case 3:
|
|
24345
24555
|
_b.sent();
|
|
24346
|
-
console.warn(
|
|
24556
|
+
console.warn({
|
|
24557
|
+
content: "Invalid fonts source: ".concat(font.fontURL),
|
|
24558
|
+
type: LOG_TYPE,
|
|
24559
|
+
});
|
|
24347
24560
|
return [3 /*break*/, 4];
|
|
24348
24561
|
case 4: return [2 /*return*/];
|
|
24349
24562
|
}
|
|
@@ -24750,6 +24963,9 @@ var CompVFXItem = /** @class */ (function (_super) {
|
|
|
24750
24963
|
this.tempQueue.length = 0;
|
|
24751
24964
|
this.itemsToRemove.length = 0;
|
|
24752
24965
|
};
|
|
24966
|
+
CompVFXItem.prototype.handleVisibleChanged = function (visible) {
|
|
24967
|
+
this.items.forEach(function (item) { return item.setVisible(visible); });
|
|
24968
|
+
};
|
|
24753
24969
|
CompVFXItem.prototype.getUpdateTime = function (t) {
|
|
24754
24970
|
var startTime = this.startTimeInms;
|
|
24755
24971
|
var now = this.timeInms;
|
|
@@ -24817,6 +25033,7 @@ var CompVFXItem = /** @class */ (function (_super) {
|
|
|
24817
25033
|
};
|
|
24818
25034
|
/**
|
|
24819
25035
|
* 获取指定元素当前时刻真正起作用的父元素, 需要在元素生命周期内获取
|
|
25036
|
+
* @internal
|
|
24820
25037
|
* @param item - 指定元素
|
|
24821
25038
|
* @return 当父元素生命周期结束时,返回空
|
|
24822
25039
|
*/
|
|
@@ -24927,17 +25144,22 @@ var Composition = /** @class */ (function () {
|
|
|
24927
25144
|
this.paused = false;
|
|
24928
25145
|
this.lastVideoUpdateTime = 0;
|
|
24929
25146
|
this.postLoaders = [];
|
|
24930
|
-
var
|
|
25147
|
+
var _b = props.reusable, reusable = _b === void 0 ? false : _b, _c = props.speed, speed = _c === void 0 ? 1 : _c, _d = props.baseRenderOrder, baseRenderOrder = _d === void 0 ? 0 : _d, renderer = props.renderer, handlePlayerPause = props.handlePlayerPause, handleMessageItem = props.handleMessageItem, handleEnd = props.handleEnd, event = props.event, width = props.width, height = props.height;
|
|
24931
25148
|
this.compositionSourceManager = new CompositionSourceManager(scene, renderer.engine);
|
|
24932
25149
|
scene.jsonScene.imgUsage = undefined;
|
|
24933
|
-
if (
|
|
25150
|
+
if (reusable) {
|
|
25151
|
+
this.keepResource = true;
|
|
24934
25152
|
scene.textures = undefined;
|
|
24935
25153
|
scene.consumed = true;
|
|
24936
25154
|
}
|
|
24937
|
-
var
|
|
25155
|
+
var _e = this.compositionSourceManager, sourceContent = _e.sourceContent, pluginSystem = _e.pluginSystem, imgUsage = _e.imgUsage, totalTime = _e.totalTime, renderLevel = _e.renderLevel;
|
|
24938
25156
|
assertExist(sourceContent);
|
|
24939
25157
|
var vfxItem = new CompVFXItem(sourceContent, this);
|
|
24940
25158
|
var imageUsage = (!reusable && imgUsage);
|
|
25159
|
+
this.transform = new Transform({
|
|
25160
|
+
name: this.name,
|
|
25161
|
+
});
|
|
25162
|
+
vfxItem.transform = this.transform;
|
|
24941
25163
|
this.globalVolume = sourceContent.globalVolume;
|
|
24942
25164
|
this.width = width;
|
|
24943
25165
|
this.height = height;
|
|
@@ -24948,21 +25170,19 @@ var Composition = /** @class */ (function () {
|
|
|
24948
25170
|
this.event = event;
|
|
24949
25171
|
this.statistic = { loadTime: totalTime !== null && totalTime !== void 0 ? totalTime : 0, loadStart: (_a = scene.startTime) !== null && _a !== void 0 ? _a : 0, firstFrameTime: 0 };
|
|
24950
25172
|
this.reusable = reusable;
|
|
25173
|
+
this.speed = speed;
|
|
24951
25174
|
this.renderLevel = renderLevel;
|
|
24952
|
-
this.
|
|
24953
|
-
this.handleMessageItem = handleMessageItem;
|
|
24954
|
-
this.handleEnd = handleEnd;
|
|
24955
|
-
this.rootTransform = new Transform();
|
|
24956
|
-
vfxItem.transform = this.rootTransform;
|
|
24957
|
-
this.autoRefTex = !keepResource && imageUsage && vfxItem.endBehavior !== END_BEHAVIOR_RESTART$1;
|
|
25175
|
+
this.autoRefTex = !this.keepResource && imageUsage && vfxItem.endBehavior !== END_BEHAVIOR_RESTART$1;
|
|
24958
25176
|
this.content = vfxItem;
|
|
24959
25177
|
this.name = vfxItem.name;
|
|
24960
|
-
this.rootTransform.name = this.name;
|
|
24961
25178
|
this.pluginSystem = pluginSystem;
|
|
24962
25179
|
this.pluginSystem.initializeComposition(this, scene);
|
|
24963
25180
|
this.camera = new Camera(this.name, __assign$1(__assign$1({}, sourceContent === null || sourceContent === void 0 ? void 0 : sourceContent.camera), { aspect: width / height }));
|
|
24964
25181
|
this.url = scene.url;
|
|
24965
25182
|
this.assigned = true;
|
|
25183
|
+
this.handlePlayerPause = handlePlayerPause;
|
|
25184
|
+
this.handleMessageItem = handleMessageItem;
|
|
25185
|
+
this.handleEnd = handleEnd;
|
|
24966
25186
|
this.createRenderFrame();
|
|
24967
25187
|
this.reset();
|
|
24968
25188
|
}
|
|
@@ -25007,6 +25227,12 @@ var Composition = /** @class */ (function () {
|
|
|
25007
25227
|
enumerable: false,
|
|
25008
25228
|
configurable: true
|
|
25009
25229
|
});
|
|
25230
|
+
/**
|
|
25231
|
+
* 获取合成的时长
|
|
25232
|
+
*/
|
|
25233
|
+
Composition.prototype.getDuration = function () {
|
|
25234
|
+
return this.content.duration;
|
|
25235
|
+
};
|
|
25010
25236
|
Object.defineProperty(Composition.prototype, "isDestroyed", {
|
|
25011
25237
|
/**
|
|
25012
25238
|
* 获取销毁状态
|
|
@@ -25024,7 +25250,7 @@ var Composition = /** @class */ (function () {
|
|
|
25024
25250
|
this.content.reset();
|
|
25025
25251
|
this.prepareRender();
|
|
25026
25252
|
this.reset();
|
|
25027
|
-
this.
|
|
25253
|
+
this.transform.setValid(true);
|
|
25028
25254
|
this.content.start();
|
|
25029
25255
|
this.forwardTime(this.startTime);
|
|
25030
25256
|
this.content.onUpdate(0);
|
|
@@ -25044,11 +25270,25 @@ var Composition = /** @class */ (function () {
|
|
|
25044
25270
|
Composition.prototype.getIndex = function () {
|
|
25045
25271
|
return this.renderOrder;
|
|
25046
25272
|
};
|
|
25273
|
+
/**
|
|
25274
|
+
* 设置合成的动画速度
|
|
25275
|
+
* @param speed - 速度
|
|
25276
|
+
*/
|
|
25277
|
+
Composition.prototype.setSpeed = function (speed) {
|
|
25278
|
+
this.speed = speed;
|
|
25279
|
+
};
|
|
25280
|
+
/**
|
|
25281
|
+
* 获取合成的动画速度
|
|
25282
|
+
* @returns
|
|
25283
|
+
*/
|
|
25284
|
+
Composition.prototype.getSpeed = function () {
|
|
25285
|
+
return this.speed;
|
|
25286
|
+
};
|
|
25047
25287
|
Composition.prototype.play = function () {
|
|
25048
|
-
if (this.
|
|
25049
|
-
this.
|
|
25288
|
+
if (this.content.ended && this.reusable) {
|
|
25289
|
+
this.restart();
|
|
25050
25290
|
}
|
|
25051
|
-
this.
|
|
25291
|
+
this.gotoAndPlay(this.time);
|
|
25052
25292
|
};
|
|
25053
25293
|
/**
|
|
25054
25294
|
* 暂停合成的播放
|
|
@@ -25063,12 +25303,16 @@ var Composition = /** @class */ (function () {
|
|
|
25063
25303
|
this.paused = false;
|
|
25064
25304
|
};
|
|
25065
25305
|
Composition.prototype.gotoAndPlay = function (time) {
|
|
25306
|
+
this.resume();
|
|
25307
|
+
if (!this.content.started) {
|
|
25308
|
+
this.content.start();
|
|
25309
|
+
this.forwardTime(this.startTime);
|
|
25310
|
+
}
|
|
25311
|
+
this.forwardTime(time);
|
|
25066
25312
|
};
|
|
25067
|
-
Composition.prototype.
|
|
25068
|
-
|
|
25069
|
-
|
|
25070
|
-
Composition.prototype.start = function () {
|
|
25071
|
-
this.content.start();
|
|
25313
|
+
Composition.prototype.gotoAndStop = function (time) {
|
|
25314
|
+
this.gotoAndPlay(time);
|
|
25315
|
+
this.pause();
|
|
25072
25316
|
};
|
|
25073
25317
|
/**
|
|
25074
25318
|
*
|
|
@@ -25085,29 +25329,29 @@ var Composition = /** @class */ (function () {
|
|
|
25085
25329
|
};
|
|
25086
25330
|
/**
|
|
25087
25331
|
* 跳到指定时间点(不做任何播放行为)
|
|
25088
|
-
*
|
|
25089
|
-
* @param time - 时间点(秒),可正可负
|
|
25332
|
+
* @param time - 指定的时间
|
|
25090
25333
|
*/
|
|
25091
25334
|
Composition.prototype.setTime = function (time) {
|
|
25335
|
+
var pause = this.paused;
|
|
25336
|
+
if (pause) {
|
|
25337
|
+
this.resume();
|
|
25338
|
+
}
|
|
25339
|
+
this.forwardTime(time, true);
|
|
25340
|
+
if (pause) {
|
|
25341
|
+
this.pause();
|
|
25342
|
+
}
|
|
25092
25343
|
};
|
|
25093
|
-
|
|
25094
|
-
|
|
25095
|
-
|
|
25096
|
-
|
|
25097
|
-
|
|
25098
|
-
var
|
|
25099
|
-
|
|
25100
|
-
|
|
25101
|
-
|
|
25102
|
-
var t = Math.abs(time);
|
|
25103
|
-
for (var ss = reverse ? -step : step; t > step; t -= step) {
|
|
25104
|
-
this.update(ss);
|
|
25105
|
-
}
|
|
25106
|
-
if (t > 0) {
|
|
25107
|
-
var ss = reverse ? -t : t;
|
|
25108
|
-
this.update(ss);
|
|
25109
|
-
}
|
|
25344
|
+
Composition.prototype.forwardTime = function (time, skipRender) {
|
|
25345
|
+
if (skipRender === void 0) { skipRender = false; }
|
|
25346
|
+
var deltaTime = (this.startTime + Math.max(0, time)) * 1000 - this.content.timeInms;
|
|
25347
|
+
var reverse = deltaTime < 0;
|
|
25348
|
+
var step = 15;
|
|
25349
|
+
var t = Math.abs(deltaTime);
|
|
25350
|
+
var ss = reverse ? -step : step;
|
|
25351
|
+
for (t; t > step; t -= step) {
|
|
25352
|
+
this.update(ss, skipRender);
|
|
25110
25353
|
}
|
|
25354
|
+
this.update(reverse ? -t : t, skipRender);
|
|
25111
25355
|
};
|
|
25112
25356
|
/**
|
|
25113
25357
|
* 重置状态函数
|
|
@@ -25149,14 +25393,19 @@ var Composition = /** @class */ (function () {
|
|
|
25149
25393
|
* @returns 销毁合成标志位
|
|
25150
25394
|
*/
|
|
25151
25395
|
Composition.prototype.shouldDispose = function () {
|
|
25396
|
+
if (this.reusable) {
|
|
25397
|
+
return false;
|
|
25398
|
+
}
|
|
25152
25399
|
var _a = this.content, ended = _a.ended, endBehavior = _a.endBehavior;
|
|
25153
25400
|
return ended && (!endBehavior || endBehavior === END_BEHAVIOR_PAUSE_AND_DESTROY$1);
|
|
25154
25401
|
};
|
|
25155
25402
|
/**
|
|
25156
25403
|
* 合成更新,针对所有 item 的更新
|
|
25157
25404
|
* @param deltaTime - 更新的时间步长
|
|
25405
|
+
* @param skipRender - 是否需要渲染
|
|
25158
25406
|
*/
|
|
25159
|
-
Composition.prototype.update = function (deltaTime) {
|
|
25407
|
+
Composition.prototype.update = function (deltaTime, skipRender) {
|
|
25408
|
+
if (skipRender === void 0) { skipRender = false; }
|
|
25160
25409
|
if (!this.assigned || this.paused) {
|
|
25161
25410
|
return;
|
|
25162
25411
|
}
|
|
@@ -25173,7 +25422,9 @@ var Composition = /** @class */ (function () {
|
|
|
25173
25422
|
this.dispose();
|
|
25174
25423
|
}
|
|
25175
25424
|
else {
|
|
25176
|
-
|
|
25425
|
+
if (!skipRender) {
|
|
25426
|
+
this.prepareRender();
|
|
25427
|
+
}
|
|
25177
25428
|
}
|
|
25178
25429
|
};
|
|
25179
25430
|
/**
|
|
@@ -25461,7 +25712,10 @@ var Composition = /** @class */ (function () {
|
|
|
25461
25712
|
(_a = this.rendererOptions) === null || _a === void 0 ? void 0 : _a.emptyTexture.dispose();
|
|
25462
25713
|
(_b = this.pluginSystem) === null || _b === void 0 ? void 0 : _b.destroyComposition(this);
|
|
25463
25714
|
this.update = function () {
|
|
25464
|
-
console.error(
|
|
25715
|
+
console.error({
|
|
25716
|
+
content: "Update disposed composition: ".concat(_this.name, "."),
|
|
25717
|
+
type: LOG_TYPE,
|
|
25718
|
+
});
|
|
25465
25719
|
};
|
|
25466
25720
|
this.handlePlayerPause = noop;
|
|
25467
25721
|
this.dispose = noop;
|
|
@@ -25480,6 +25734,34 @@ var Composition = /** @class */ (function () {
|
|
|
25480
25734
|
Composition.prototype.setEditorTransform = function (scale, dx, dy) {
|
|
25481
25735
|
this.renderFrame.editorTransform = [scale, scale, dx, dy];
|
|
25482
25736
|
};
|
|
25737
|
+
/**
|
|
25738
|
+
* 合成整体在水平方向移动 x 像素,垂直方向移动 y 像素
|
|
25739
|
+
*/
|
|
25740
|
+
Composition.prototype.translateByPixel = function (x, y) {
|
|
25741
|
+
if (!this.renderer) {
|
|
25742
|
+
console.warn('Can not translate position when container not assigned');
|
|
25743
|
+
return;
|
|
25744
|
+
}
|
|
25745
|
+
this.content.translateByPixel(x, y);
|
|
25746
|
+
};
|
|
25747
|
+
/**
|
|
25748
|
+
* 设置合成在 3D 坐标轴上相对移动
|
|
25749
|
+
*/
|
|
25750
|
+
Composition.prototype.translate = function (x, y, z) {
|
|
25751
|
+
this.content.translate(x, y, z);
|
|
25752
|
+
};
|
|
25753
|
+
/**
|
|
25754
|
+
* 设置合成在 3D 坐标轴上相对旋转(角度)
|
|
25755
|
+
*/
|
|
25756
|
+
Composition.prototype.rotate = function (x, y, z) {
|
|
25757
|
+
this.content.rotate(x, y, z);
|
|
25758
|
+
};
|
|
25759
|
+
/**
|
|
25760
|
+
* 设置合成在 3D 坐标轴上相对缩放
|
|
25761
|
+
*/
|
|
25762
|
+
Composition.prototype.scale = function (x, y, z) {
|
|
25763
|
+
this.content.scale(x, y, z);
|
|
25764
|
+
};
|
|
25483
25765
|
/**
|
|
25484
25766
|
* 卸载贴图纹理方法,减少内存
|
|
25485
25767
|
*/
|
|
@@ -25519,14 +25801,6 @@ var Composition = /** @class */ (function () {
|
|
|
25519
25801
|
};
|
|
25520
25802
|
return Composition;
|
|
25521
25803
|
}());
|
|
25522
|
-
/**
|
|
25523
|
-
* 根据 id 查找对应的合成,可能找不到
|
|
25524
|
-
* @param compositions - 合成列表
|
|
25525
|
-
* @param id - 目标合成 id
|
|
25526
|
-
*/
|
|
25527
|
-
function getComposition(compositions, id) {
|
|
25528
|
-
return compositions.find(function (f) { return f.id === id; });
|
|
25529
|
-
}
|
|
25530
25804
|
|
|
25531
25805
|
/**
|
|
25532
25806
|
* Engine 基类,负责维护所有 GPU 资源的销毁
|
|
@@ -25632,7 +25906,10 @@ var Engine = /** @class */ (function () {
|
|
|
25632
25906
|
info.push("Tex ".concat(this.textures.length));
|
|
25633
25907
|
}
|
|
25634
25908
|
if (info.length > 0) {
|
|
25635
|
-
console.warn(
|
|
25909
|
+
console.warn({
|
|
25910
|
+
content: "Release GPU memory: ".concat(info.join(', ')),
|
|
25911
|
+
type: LOG_TYPE,
|
|
25912
|
+
});
|
|
25636
25913
|
}
|
|
25637
25914
|
this.renderPasses.forEach(function (pass) {
|
|
25638
25915
|
pass.dispose();
|
|
@@ -27273,8 +27550,11 @@ Geometry.create = function (engine, options) {
|
|
|
27273
27550
|
Mesh.create = function (engine, props) {
|
|
27274
27551
|
return new ThreeMesh(engine, props);
|
|
27275
27552
|
};
|
|
27276
|
-
var version = "0.0.1-alpha.
|
|
27277
|
-
console.info(
|
|
27553
|
+
var version = "0.0.1-alpha.2";
|
|
27554
|
+
console.info({
|
|
27555
|
+
content: '[Galacean Effects THREEJS] version: ' + "0.0.1-alpha.2",
|
|
27556
|
+
type: LOG_TYPE,
|
|
27557
|
+
});
|
|
27278
27558
|
|
|
27279
27559
|
exports.AbstractPlugin = AbstractPlugin;
|
|
27280
27560
|
exports.AssetManager = AssetManager;
|
|
@@ -27323,6 +27603,7 @@ exports.InteractLoader = InteractLoader;
|
|
|
27323
27603
|
exports.InteractMesh = InteractMesh;
|
|
27324
27604
|
exports.InteractVFXItem = InteractVFXItem;
|
|
27325
27605
|
exports.KTXTexture = KTXTexture;
|
|
27606
|
+
exports.LOG_TYPE = LOG_TYPE;
|
|
27326
27607
|
exports.LineSegments = LineSegments;
|
|
27327
27608
|
exports.LinearValue = LinearValue;
|
|
27328
27609
|
exports.Material = Material;
|
|
@@ -27442,7 +27723,6 @@ exports.generateEmptyTypedArray = generateEmptyTypedArray;
|
|
|
27442
27723
|
exports.generateHalfFloatTexture = generateHalfFloatTexture;
|
|
27443
27724
|
exports.getBackgroundImage = getBackgroundImage;
|
|
27444
27725
|
exports.getColorFromGradientStops = getColorFromGradientStops;
|
|
27445
|
-
exports.getComposition = getComposition;
|
|
27446
27726
|
exports.getConfig = getConfig;
|
|
27447
27727
|
exports.getDefaultTemplateCanvasPool = getDefaultTemplateCanvasPool;
|
|
27448
27728
|
exports.getDefaultTextureFactory = getDefaultTextureFactory;
|