@galacean/effects-threejs 0.0.1-alpha.1 → 0.0.1-alpha.3
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/README.md +15 -17
- package/dist/index.js +158 -62
- 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 +158 -62
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
# Galacean Effects
|
|
1
|
+
# Galacean Effects THREE.JS Plugin
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
With this plugin, you can load and render Galacean Effects animations within the THREE.JS environment.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Version Information
|
|
6
6
|
|
|
7
7
|
- Three.js 
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Usage
|
|
10
10
|
|
|
11
|
-
### 1、THREE.JS
|
|
11
|
+
### 1、THREE.JS Scene Initialization
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
o implement Galacean Effects in THREE.JS, you need to first create a THREE.JS scene:
|
|
14
14
|
|
|
15
15
|
``` ts
|
|
16
16
|
import * as THREE from 'three';
|
|
17
17
|
|
|
18
|
-
//
|
|
18
|
+
// Create a renderer
|
|
19
19
|
const renderer = new THREE.WebGLRenderer({
|
|
20
20
|
alpha: true,
|
|
21
21
|
stencil: true,
|
|
@@ -23,11 +23,11 @@ const renderer = new THREE.WebGLRenderer({
|
|
|
23
23
|
depth: true,
|
|
24
24
|
premultipliedAlpha: true,
|
|
25
25
|
});
|
|
26
|
-
//
|
|
26
|
+
// Create a scene
|
|
27
27
|
const scene = new THREE.Scene();
|
|
28
28
|
const container = document.getElementById('J-container');
|
|
29
29
|
const { width, height } = container.getBoundingClientRect();
|
|
30
|
-
//
|
|
30
|
+
// Create a camera
|
|
31
31
|
const camera = new THREE.PerspectiveCamera(80, width / height, 0.1, 1000);
|
|
32
32
|
|
|
33
33
|
camera.position.set(0, 0, 8);
|
|
@@ -39,26 +39,26 @@ renderer.setSize(width, height);
|
|
|
39
39
|
container.appendChild(renderer.domElement);
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
### 2、ThreeDisplayObject
|
|
42
|
+
### 2、ThreeDisplayObject Instantiation and Resource Loading
|
|
43
43
|
|
|
44
44
|
``` ts
|
|
45
45
|
import { ThreeDisplayObject } from '@galacean/effects-threejs';
|
|
46
46
|
|
|
47
47
|
const displayObject = new ThreeDisplayObject(renderer.getContext(), { width, height });
|
|
48
|
-
//
|
|
48
|
+
// Load Galacean Effects output
|
|
49
49
|
await displayObject.loadScene('./xxx.json');
|
|
50
|
-
//
|
|
50
|
+
// Add the rendering object to the THREE scene
|
|
51
51
|
scene.add(displayObject);
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
### 3
|
|
54
|
+
### 3、Perform THREE.JS Renderingts
|
|
55
55
|
|
|
56
56
|
``` ts
|
|
57
57
|
const { currentComposition } = displayObject;
|
|
58
58
|
let lastTime = performance.now();
|
|
59
59
|
|
|
60
60
|
function render () {
|
|
61
|
-
//
|
|
61
|
+
// Check if the current composition has been destroyed
|
|
62
62
|
if (!currentComposition.isDestroyed) {
|
|
63
63
|
displayObject.update(performance.now() - lastTime);
|
|
64
64
|
}
|
|
@@ -72,6 +72,4 @@ function render () {
|
|
|
72
72
|
render();
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
## API
|
|
76
|
-
|
|
77
|
-
TODO
|
|
75
|
+
## [API Documentation](https://galacean.antgroup.com/effects/#/api/modules_galacean_effects_threejs)
|
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.3
|
|
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
|
/*********************************************/
|
|
@@ -9774,6 +9774,7 @@ var VFXItem = /** @class */ (function () {
|
|
|
9774
9774
|
this.endBehavior = endBehavior;
|
|
9775
9775
|
this.lifetime = -(this.delayInms / this.durInms);
|
|
9776
9776
|
this.listIndex = listIndex;
|
|
9777
|
+
this.speed = 1;
|
|
9777
9778
|
this.onConstructed(props);
|
|
9778
9779
|
if (duration <= 0) {
|
|
9779
9780
|
throw Error("Item duration can't be less than 0, see ".concat(HELP_LINK['Item duration can\'t be less than 0']));
|
|
@@ -9852,6 +9853,20 @@ var VFXItem = /** @class */ (function () {
|
|
|
9852
9853
|
enumerable: false,
|
|
9853
9854
|
configurable: true
|
|
9854
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
|
+
};
|
|
9855
9870
|
/**
|
|
9856
9871
|
* 重置元素状态属性
|
|
9857
9872
|
*/
|
|
@@ -9907,11 +9922,12 @@ var VFXItem = /** @class */ (function () {
|
|
|
9907
9922
|
};
|
|
9908
9923
|
/**
|
|
9909
9924
|
* 内部使用的更新回调,请不要重写此方法,重写 `onItemUpdate` 方法
|
|
9910
|
-
* @param
|
|
9925
|
+
* @param deltaTime
|
|
9911
9926
|
*/
|
|
9912
|
-
VFXItem.prototype.onUpdate = function (
|
|
9927
|
+
VFXItem.prototype.onUpdate = function (deltaTime) {
|
|
9913
9928
|
var _a, _b;
|
|
9914
9929
|
if (this.started && !this.frozen && this.composition) {
|
|
9930
|
+
var dt = deltaTime * this.speed;
|
|
9915
9931
|
var time = (this.timeInms += dt);
|
|
9916
9932
|
this.time += dt / 1000;
|
|
9917
9933
|
var now = time - this.delayInms;
|
|
@@ -9923,7 +9939,6 @@ var VFXItem = /** @class */ (function () {
|
|
|
9923
9939
|
this.composition.itemLifetimeEvent(this, true);
|
|
9924
9940
|
}
|
|
9925
9941
|
if (!this.delaying) {
|
|
9926
|
-
var endBehavior = this.endBehavior;
|
|
9927
9942
|
var lifetime = now / this.durInms;
|
|
9928
9943
|
var ended = this.isEnded(now);
|
|
9929
9944
|
var shouldUpdate = true;
|
|
@@ -9935,36 +9950,37 @@ var VFXItem = /** @class */ (function () {
|
|
|
9935
9950
|
this.composition.itemLifetimeEvent(this, false);
|
|
9936
9951
|
this.onEnd();
|
|
9937
9952
|
}
|
|
9938
|
-
|
|
9953
|
+
// 注意:不要定义私有变量替换 this.endBehavior,直接使用 this 上的!!!(Chrome 下会出现 endBehavior 为 5 时,能进入以下判断)
|
|
9954
|
+
if (this.endBehavior !== END_BEHAVIOR_FORWARD$1 && this.endBehavior !== END_BEHAVIOR_RESTART$1) {
|
|
9939
9955
|
this.ended = true;
|
|
9940
9956
|
this.transform.setValid(false);
|
|
9941
|
-
if (endBehavior === END_BEHAVIOR_PAUSE$1 ||
|
|
9942
|
-
endBehavior === END_BEHAVIOR_PAUSE_AND_DESTROY$1) {
|
|
9957
|
+
if (this.endBehavior === END_BEHAVIOR_PAUSE$1 ||
|
|
9958
|
+
this.endBehavior === END_BEHAVIOR_PAUSE_AND_DESTROY$1) {
|
|
9943
9959
|
(_b = (_a = this.composition).handlePlayerPause) === null || _b === void 0 ? void 0 : _b.call(_a, this);
|
|
9944
9960
|
}
|
|
9945
|
-
else if (endBehavior === END_BEHAVIOR_FREEZE$1) {
|
|
9961
|
+
else if (this.endBehavior === END_BEHAVIOR_FREEZE$1) {
|
|
9946
9962
|
this.transform.setValid(true);
|
|
9947
9963
|
shouldUpdate = true;
|
|
9948
9964
|
lifetime = 1;
|
|
9949
9965
|
}
|
|
9950
9966
|
if (!this.reusable) {
|
|
9951
|
-
if (endBehavior === END_BEHAVIOR_DESTROY$1 ||
|
|
9952
|
-
endBehavior === END_BEHAVIOR_PAUSE_AND_DESTROY$1 ||
|
|
9953
|
-
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) {
|
|
9954
9970
|
return this.dispose();
|
|
9955
9971
|
}
|
|
9956
|
-
else if (endBehavior === END_BEHAVIOR_PAUSE$1) {
|
|
9972
|
+
else if (this.endBehavior === END_BEHAVIOR_PAUSE$1) {
|
|
9957
9973
|
this.endBehavior = END_BEHAVIOR_FORWARD$1;
|
|
9958
9974
|
}
|
|
9959
9975
|
}
|
|
9960
|
-
else if (endBehavior === END_BEHAVIOR_DESTROY$1) {
|
|
9976
|
+
else if (this.endBehavior === END_BEHAVIOR_DESTROY$1) {
|
|
9961
9977
|
this.setVisible(false);
|
|
9962
9978
|
}
|
|
9963
9979
|
lifetime = Math.min(lifetime, 1);
|
|
9964
9980
|
}
|
|
9965
9981
|
else {
|
|
9966
9982
|
shouldUpdate = true;
|
|
9967
|
-
if (endBehavior === END_BEHAVIOR_RESTART$1) {
|
|
9983
|
+
if (this.endBehavior === END_BEHAVIOR_RESTART$1) {
|
|
9968
9984
|
this.ended = true;
|
|
9969
9985
|
lifetime = lifetime % 1;
|
|
9970
9986
|
}
|
|
@@ -10013,8 +10029,20 @@ var VFXItem = /** @class */ (function () {
|
|
|
10013
10029
|
VFXItem.prototype.onEnd = function () {
|
|
10014
10030
|
// OVERRIDE
|
|
10015
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
|
+
*/
|
|
10016
10040
|
VFXItem.prototype.setColor = function (r, g, b, a) {
|
|
10017
10041
|
};
|
|
10042
|
+
/**
|
|
10043
|
+
* 设置元素的透明度
|
|
10044
|
+
* @param opacity - 透明度值,范围 [0,1]
|
|
10045
|
+
*/
|
|
10018
10046
|
VFXItem.prototype.setOpacity = function (opacity) {
|
|
10019
10047
|
};
|
|
10020
10048
|
/**
|
|
@@ -10090,9 +10118,16 @@ var VFXItem = /** @class */ (function () {
|
|
|
10090
10118
|
this.transform.scaleBy(x, y, z);
|
|
10091
10119
|
};
|
|
10092
10120
|
/**
|
|
10093
|
-
*
|
|
10121
|
+
* 设置元素的在画布上的像素位置
|
|
10094
10122
|
*/
|
|
10095
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
|
+
}
|
|
10096
10131
|
};
|
|
10097
10132
|
/**
|
|
10098
10133
|
* 设置元素在 3D 坐标轴的位置
|
|
@@ -10168,9 +10203,11 @@ var VFXItem = /** @class */ (function () {
|
|
|
10168
10203
|
};
|
|
10169
10204
|
VFXItem.prototype.translateByPixel = function (x, y) {
|
|
10170
10205
|
if (this.composition) {
|
|
10171
|
-
var
|
|
10172
|
-
camera.
|
|
10173
|
-
|
|
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);
|
|
10174
10211
|
}
|
|
10175
10212
|
};
|
|
10176
10213
|
/**
|
|
@@ -11233,7 +11270,7 @@ function generateHalfFloatTexture(engine, data, width, height) {
|
|
|
11233
11270
|
}
|
|
11234
11271
|
|
|
11235
11272
|
var RUNTIME_ENV = 'runtime_env';
|
|
11236
|
-
var LOG_TYPE = '
|
|
11273
|
+
var LOG_TYPE = 'galacean-effects';
|
|
11237
11274
|
var RENDER_PREFER_LOOKUP_TEXTURE = 'lookup_texture';
|
|
11238
11275
|
// 数据模板使用 offscreen canvas 绘制
|
|
11239
11276
|
var TEMPLATE_USE_OFFSCREEN_CANVAS = 'offscreen_canvas';
|
|
@@ -14335,14 +14372,10 @@ var SpriteMesh = /** @class */ (function () {
|
|
|
14335
14372
|
var uSize = [1, 1, 1, 0];
|
|
14336
14373
|
var uQuat = [0, 0, 1, 1];
|
|
14337
14374
|
var uColor = selfData.color || [mainDataArray[uColorStart], mainDataArray[uColorStart + 1], mainDataArray[uColorStart + 2], mainDataArray[uColorStart + 3]];
|
|
14338
|
-
|
|
14339
|
-
|
|
14340
|
-
|
|
14375
|
+
if (!isNaN(item.getCustomOpacity())) {
|
|
14376
|
+
uColor[3] = item.getCustomOpacity();
|
|
14377
|
+
}
|
|
14341
14378
|
selfData.transform.assignWorldTRS(uPos, uQuat, uSize);
|
|
14342
|
-
// TODO 兼容改变锚点,位置不移动
|
|
14343
|
-
// if (selfData.startSize) {
|
|
14344
|
-
// selfData.transform.scaleBy(selfData.startSize[0], selfData.startSize[1], 1);
|
|
14345
|
-
// }
|
|
14346
14379
|
/* 要过包含父节点颜色/透明度变化的动画的帧对比 打开这段兼容代码 */
|
|
14347
14380
|
// vecMulCombine(uColor, selfData.color, parentData.color);
|
|
14348
14381
|
/***********************/
|
|
@@ -15249,7 +15282,7 @@ var SpriteGroup = /** @class */ (function () {
|
|
|
15249
15282
|
for (var i = startIndex; i <= endIndex; i++) {
|
|
15250
15283
|
var item = items[i];
|
|
15251
15284
|
// 不可见的元素跳过 不参与合并
|
|
15252
|
-
if (!init && (!item.
|
|
15285
|
+
if (!init && (!item.started || item.lifetime < 0)) {
|
|
15253
15286
|
continue;
|
|
15254
15287
|
}
|
|
15255
15288
|
if (!isSprite(item)) {
|
|
@@ -15523,6 +15556,9 @@ var CalculateItem = /** @class */ (function () {
|
|
|
15523
15556
|
get: function () {
|
|
15524
15557
|
return this.basicTransform.scale;
|
|
15525
15558
|
},
|
|
15559
|
+
set: function (scale) {
|
|
15560
|
+
this.basicTransform.scale = scale;
|
|
15561
|
+
},
|
|
15526
15562
|
enumerable: false,
|
|
15527
15563
|
configurable: true
|
|
15528
15564
|
});
|
|
@@ -15721,11 +15757,20 @@ var SpriteItem = /** @class */ (function (_super) {
|
|
|
15721
15757
|
}
|
|
15722
15758
|
return ret;
|
|
15723
15759
|
};
|
|
15760
|
+
/**
|
|
15761
|
+
* @internal
|
|
15762
|
+
*/
|
|
15724
15763
|
SpriteItem.prototype.setColor = function (r, g, b, a) {
|
|
15725
|
-
this.
|
|
15764
|
+
this.customColor = [r, g, b, a];
|
|
15726
15765
|
};
|
|
15727
15766
|
SpriteItem.prototype.setOpacity = function (opacity) {
|
|
15728
|
-
this.
|
|
15767
|
+
this.customOpacity = opacity;
|
|
15768
|
+
};
|
|
15769
|
+
/**
|
|
15770
|
+
* @internal
|
|
15771
|
+
*/
|
|
15772
|
+
SpriteItem.prototype.getCustomOpacity = function () {
|
|
15773
|
+
return this.customOpacity;
|
|
15729
15774
|
};
|
|
15730
15775
|
SpriteItem.prototype.getRenderData = function (_time, init) {
|
|
15731
15776
|
var ret = _super.prototype.getRenderData.call(this, _time, init);
|
|
@@ -15734,18 +15779,23 @@ var SpriteItem = /** @class */ (function (_super) {
|
|
|
15734
15779
|
var time = _time < 0 ? _time : Math.max(_time, 0.);
|
|
15735
15780
|
var duration = this.options.duration;
|
|
15736
15781
|
var life = time / duration < 0 ? 0 : (time / duration > 1 ? 1 : time / duration);
|
|
15737
|
-
|
|
15738
|
-
|
|
15739
|
-
if (colorOverLifetime) {
|
|
15740
|
-
colorInc = getColorFromGradientStops(colorOverLifetime, life, true);
|
|
15741
|
-
colorChanged = true;
|
|
15782
|
+
if (this.customColor) {
|
|
15783
|
+
ret.color = this.customColor;
|
|
15742
15784
|
}
|
|
15743
|
-
|
|
15744
|
-
|
|
15745
|
-
|
|
15746
|
-
|
|
15747
|
-
|
|
15748
|
-
|
|
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
|
+
}
|
|
15749
15799
|
}
|
|
15750
15800
|
var ta = this.textureSheetAnimation;
|
|
15751
15801
|
if (ta) {
|
|
@@ -15850,6 +15900,9 @@ var SpriteVFXItem = /** @class */ (function (_super) {
|
|
|
15850
15900
|
this.transform.assignWorldTRS(pos);
|
|
15851
15901
|
return pos;
|
|
15852
15902
|
};
|
|
15903
|
+
/**
|
|
15904
|
+
* @internal
|
|
15905
|
+
*/
|
|
15853
15906
|
SpriteVFXItem.prototype.setColor = function (r, g, b, a) {
|
|
15854
15907
|
this.content.setColor(r, g, b, a);
|
|
15855
15908
|
};
|
|
@@ -18540,19 +18593,29 @@ var ParticleSystem = /** @class */ (function () {
|
|
|
18540
18593
|
};
|
|
18541
18594
|
ParticleSystem.prototype.setOpacity = function (opacity) {
|
|
18542
18595
|
var material = this.particleMesh.mesh.material;
|
|
18543
|
-
|
|
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
|
+
}
|
|
18544
18603
|
};
|
|
18604
|
+
/**
|
|
18605
|
+
* @internal
|
|
18606
|
+
*/
|
|
18545
18607
|
ParticleSystem.prototype.setColor = function (r, g, b, a) {
|
|
18546
18608
|
var material = this.particleMesh.mesh.material;
|
|
18547
18609
|
var geometry = this.particleMesh.mesh.geometry;
|
|
18548
|
-
var
|
|
18549
|
-
|
|
18550
|
-
|
|
18551
|
-
|
|
18552
|
-
data[
|
|
18553
|
-
data[
|
|
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;
|
|
18554
18618
|
}
|
|
18555
|
-
material.setVector4('uOpacityOverLifetimeValue', [r, g, b, a]);
|
|
18556
18619
|
};
|
|
18557
18620
|
ParticleSystem.prototype.setParentTransform = function (transform) {
|
|
18558
18621
|
this.parentTransform = transform;
|
|
@@ -19104,6 +19167,9 @@ var ParticleVFXItem = /** @class */ (function (_super) {
|
|
|
19104
19167
|
content.meshes.forEach(function (mesh) { return mesh.dispose({ material: { textures: exports.DestroyOptions.keep } }); });
|
|
19105
19168
|
}
|
|
19106
19169
|
};
|
|
19170
|
+
/**
|
|
19171
|
+
* @internal
|
|
19172
|
+
*/
|
|
19107
19173
|
ParticleVFXItem.prototype.setColor = function (r, g, b, a) {
|
|
19108
19174
|
this.content.setColor(r, g, b, a);
|
|
19109
19175
|
};
|
|
@@ -19418,6 +19484,13 @@ var CalculateVFXItem = /** @class */ (function (_super) {
|
|
|
19418
19484
|
/********************/
|
|
19419
19485
|
}
|
|
19420
19486
|
};
|
|
19487
|
+
CalculateVFXItem.prototype.setScale = function (x, y, z) {
|
|
19488
|
+
this.content.startSize = [x, y, z];
|
|
19489
|
+
};
|
|
19490
|
+
CalculateVFXItem.prototype.scale = function (x, y, z) {
|
|
19491
|
+
var startSize = this.content.startSize.slice();
|
|
19492
|
+
this.content.startSize = [x * startSize[0], y * startSize[1], z * startSize[2]];
|
|
19493
|
+
};
|
|
19421
19494
|
CalculateVFXItem.prototype.getHitTestParams = function (force) {
|
|
19422
19495
|
};
|
|
19423
19496
|
CalculateVFXItem.prototype.getRenderData = function () {
|
|
@@ -22180,12 +22253,13 @@ var Camera = /** @class */ (function () {
|
|
|
22180
22253
|
};
|
|
22181
22254
|
/**
|
|
22182
22255
|
* 获取归一化坐标和 3D 世界坐标的换算比例
|
|
22256
|
+
* @param z - 当前的位置 z
|
|
22183
22257
|
*/
|
|
22184
|
-
Camera.prototype.getInverseVPRatio = function () {
|
|
22258
|
+
Camera.prototype.getInverseVPRatio = function (z) {
|
|
22185
22259
|
var pos = [0, 0, 0];
|
|
22186
|
-
var nz = vec3MulMat4(pos, [0, 0,
|
|
22260
|
+
var nz = vec3MulMat4(pos, [0, 0, z], this.getViewProjectionMatrix())[2];
|
|
22187
22261
|
vec3MulMat4(pos, [1, 1, nz], this.getInverseViewProjectionMatrix());
|
|
22188
|
-
return
|
|
22262
|
+
return pos;
|
|
22189
22263
|
};
|
|
22190
22264
|
/**
|
|
22191
22265
|
* 设置相机的旋转四元数
|
|
@@ -22377,7 +22451,7 @@ var filters = {
|
|
|
22377
22451
|
* Name: @galacean/effects-specification
|
|
22378
22452
|
* Description: Galacean Effects JSON Specification
|
|
22379
22453
|
* Author: Ant Group CO., Ltd.
|
|
22380
|
-
* Version:
|
|
22454
|
+
* Version: v1.0.0
|
|
22381
22455
|
*/
|
|
22382
22456
|
|
|
22383
22457
|
/*********************************************/
|
|
@@ -23094,7 +23168,12 @@ function __read(o, n) {
|
|
|
23094
23168
|
finally { if (e) throw e.error; }
|
|
23095
23169
|
}
|
|
23096
23170
|
return ar;
|
|
23097
|
-
}
|
|
23171
|
+
}
|
|
23172
|
+
|
|
23173
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
23174
|
+
var e = new Error(message);
|
|
23175
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
23176
|
+
};
|
|
23098
23177
|
|
|
23099
23178
|
function arrAdd(arr, item) {
|
|
23100
23179
|
if (!arr.includes(item)) {
|
|
@@ -25152,6 +25231,12 @@ var Composition = /** @class */ (function () {
|
|
|
25152
25231
|
enumerable: false,
|
|
25153
25232
|
configurable: true
|
|
25154
25233
|
});
|
|
25234
|
+
/**
|
|
25235
|
+
* 获取合成的时长
|
|
25236
|
+
*/
|
|
25237
|
+
Composition.prototype.getDuration = function () {
|
|
25238
|
+
return this.content.duration;
|
|
25239
|
+
};
|
|
25155
25240
|
Object.defineProperty(Composition.prototype, "isDestroyed", {
|
|
25156
25241
|
/**
|
|
25157
25242
|
* 获取销毁状态
|
|
@@ -25189,6 +25274,20 @@ var Composition = /** @class */ (function () {
|
|
|
25189
25274
|
Composition.prototype.getIndex = function () {
|
|
25190
25275
|
return this.renderOrder;
|
|
25191
25276
|
};
|
|
25277
|
+
/**
|
|
25278
|
+
* 设置合成的动画速度
|
|
25279
|
+
* @param speed - 速度
|
|
25280
|
+
*/
|
|
25281
|
+
Composition.prototype.setSpeed = function (speed) {
|
|
25282
|
+
this.speed = speed;
|
|
25283
|
+
};
|
|
25284
|
+
/**
|
|
25285
|
+
* 获取合成的动画速度
|
|
25286
|
+
* @returns
|
|
25287
|
+
*/
|
|
25288
|
+
Composition.prototype.getSpeed = function () {
|
|
25289
|
+
return this.speed;
|
|
25290
|
+
};
|
|
25192
25291
|
Composition.prototype.play = function () {
|
|
25193
25292
|
if (this.content.ended && this.reusable) {
|
|
25194
25293
|
this.restart();
|
|
@@ -25647,10 +25746,7 @@ var Composition = /** @class */ (function () {
|
|
|
25647
25746
|
console.warn('Can not translate position when container not assigned');
|
|
25648
25747
|
return;
|
|
25649
25748
|
}
|
|
25650
|
-
|
|
25651
|
-
var width = this.renderer.getWidth();
|
|
25652
|
-
var height = this.renderer.getHeight();
|
|
25653
|
-
this.content.translate(2 * x * rx / width, -2 * y * ry / height, 0);
|
|
25749
|
+
this.content.translateByPixel(x, y);
|
|
25654
25750
|
};
|
|
25655
25751
|
/**
|
|
25656
25752
|
* 设置合成在 3D 坐标轴上相对移动
|
|
@@ -27458,9 +27554,9 @@ Geometry.create = function (engine, options) {
|
|
|
27458
27554
|
Mesh.create = function (engine, props) {
|
|
27459
27555
|
return new ThreeMesh(engine, props);
|
|
27460
27556
|
};
|
|
27461
|
-
var version = "0.0.1-alpha.
|
|
27557
|
+
var version = "0.0.1-alpha.3";
|
|
27462
27558
|
console.info({
|
|
27463
|
-
content: '[Galacean Effects THREEJS] version: ' + "0.0.1-alpha.
|
|
27559
|
+
content: '[Galacean Effects THREEJS] version: ' + "0.0.1-alpha.3",
|
|
27464
27560
|
type: LOG_TYPE,
|
|
27465
27561
|
});
|
|
27466
27562
|
|