@galacean/effects-threejs 2.1.5 → 2.2.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.mjs 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.1.5
6
+ * Version: v2.2.0-alpha.0
7
7
  */
8
8
 
9
9
  import * as THREE from 'three';
@@ -61,12 +61,8 @@ function __generator(thisArg, body) {
61
61
  },
62
62
  trys: [],
63
63
  ops: []
64
- }, f, y, t, g;
65
- return g = {
66
- next: verb(0),
67
- "throw": verb(1),
68
- "return": verb(2)
69
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
64
+ }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
65
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
70
66
  return this;
71
67
  }), g;
72
68
  function verb(n) {
@@ -5723,6 +5719,22 @@ var TextureSourceType;
5723
5719
  TextureSourceType[TextureSourceType["mipmaps"] = 7] = "mipmaps";
5724
5720
  })(TextureSourceType || (TextureSourceType = {}));
5725
5721
 
5722
+ var RUNTIME_ENV = "runtime_env";
5723
+ var RENDER_PREFER_LOOKUP_TEXTURE = "lookup_texture";
5724
+ // 文本元素使用 offscreen canvas 绘制
5725
+ var TEMPLATE_USE_OFFSCREEN_CANVAS = "offscreen_canvas";
5726
+ // 后处理配置相关
5727
+ var POST_PROCESS_SETTINGS = "post_process_settings";
5728
+ // 加载图片时是否使用 ImageBitmap
5729
+ var LOAD_PREFER_IMAGE_BITMAP = "load_image_bitmap";
5730
+ var config = {};
5731
+ function getConfig(name) {
5732
+ return config[name];
5733
+ }
5734
+ function setConfig(name, value) {
5735
+ return config[name] = value;
5736
+ }
5737
+
5726
5738
  /**
5727
5739
  * 负责下载各种资源,并提供了一些异步加载和缓存管理的功能
5728
5740
  */ var Downloader = /*#__PURE__*/ function() {
@@ -5811,11 +5823,11 @@ var avifFailed = false;
5811
5823
  * 异步加载一个 WebP 图片文件,如果不支持 WebP,则加载 PNG 图片文件
5812
5824
  * @param png - PNG 图片文件的 URL
5813
5825
  * @param webp - WebP 图片文件的 URL
5814
- */ function loadWebPOptional(png, webp) {
5826
+ */ function loadWebPOptional(png, webp, options) {
5815
5827
  return _loadWebPOptional.apply(this, arguments);
5816
5828
  }
5817
5829
  function _loadWebPOptional() {
5818
- _loadWebPOptional = _async_to_generator(function(png, webp) {
5830
+ _loadWebPOptional = _async_to_generator(function(png, webp, options) {
5819
5831
  var image, image1, image2;
5820
5832
  return __generator(this, function(_state) {
5821
5833
  switch(_state.label){
@@ -5826,7 +5838,7 @@ function _loadWebPOptional() {
5826
5838
  ];
5827
5839
  return [
5828
5840
  4,
5829
- loadImage(png)
5841
+ loadImageBitmap(png, options)
5830
5842
  ];
5831
5843
  case 1:
5832
5844
  image = _state.sent();
@@ -5846,7 +5858,7 @@ function _loadWebPOptional() {
5846
5858
  ]);
5847
5859
  return [
5848
5860
  4,
5849
- loadImage(webp)
5861
+ loadImageBitmap(webp, options)
5850
5862
  ];
5851
5863
  case 3:
5852
5864
  image1 = _state.sent();
@@ -5862,7 +5874,7 @@ function _loadWebPOptional() {
5862
5874
  webPFailed = true;
5863
5875
  return [
5864
5876
  4,
5865
- loadImage(png)
5877
+ loadImageBitmap(png, options)
5866
5878
  ];
5867
5879
  case 5:
5868
5880
  image2 = _state.sent();
@@ -5886,11 +5898,11 @@ function _loadWebPOptional() {
5886
5898
  * 异步加载一个 AVIF 图片文件,如果不支持 AVIF,则加载 PNG 图片文件
5887
5899
  * @param png - PNG 图片文件的 URL
5888
5900
  * @param avif - AVIF 图片文件的 URL
5889
- */ function loadAVIFOptional(png, avif) {
5901
+ */ function loadAVIFOptional(png, avif, options) {
5890
5902
  return _loadAVIFOptional.apply(this, arguments);
5891
5903
  }
5892
5904
  function _loadAVIFOptional() {
5893
- _loadAVIFOptional = _async_to_generator(function(png, avif) {
5905
+ _loadAVIFOptional = _async_to_generator(function(png, avif, options) {
5894
5906
  var image, image1, image2;
5895
5907
  return __generator(this, function(_state) {
5896
5908
  switch(_state.label){
@@ -5901,7 +5913,7 @@ function _loadAVIFOptional() {
5901
5913
  ];
5902
5914
  return [
5903
5915
  4,
5904
- loadImage(png)
5916
+ loadImageBitmap(png, options)
5905
5917
  ];
5906
5918
  case 1:
5907
5919
  image = _state.sent();
@@ -5921,7 +5933,7 @@ function _loadAVIFOptional() {
5921
5933
  ]);
5922
5934
  return [
5923
5935
  4,
5924
- loadImage(avif)
5936
+ loadImageBitmap(avif, options)
5925
5937
  ];
5926
5938
  case 3:
5927
5939
  image1 = _state.sent();
@@ -5937,7 +5949,7 @@ function _loadAVIFOptional() {
5937
5949
  avifFailed = true;
5938
5950
  return [
5939
5951
  4,
5940
- loadImage(png)
5952
+ loadImageBitmap(png, options)
5941
5953
  ];
5942
5954
  case 5:
5943
5955
  image2 = _state.sent();
@@ -6152,6 +6164,80 @@ function _loadMedia() {
6152
6164
  });
6153
6165
  return _loadMedia.apply(this, arguments);
6154
6166
  }
6167
+ var imageBitMapAvailable = typeof createImageBitmap === "function";
6168
+ /**
6169
+ * 异步加载一个图片文件,如果支持 ImageBitmap 则返回 ImageBitmap 对象
6170
+ * @param source
6171
+ * @param options
6172
+ * @returns
6173
+ */ function loadImageBitmap(source, options) {
6174
+ return _loadImageBitmap.apply(this, arguments);
6175
+ }
6176
+ function _loadImageBitmap() {
6177
+ _loadImageBitmap = _async_to_generator(function(source, options) {
6178
+ var blob;
6179
+ return __generator(this, function(_state) {
6180
+ switch(_state.label){
6181
+ case 0:
6182
+ if (!(imageBitMapAvailable && getConfig(LOAD_PREFER_IMAGE_BITMAP))) return [
6183
+ 3,
6184
+ 4
6185
+ ];
6186
+ if (!(typeof source === "string")) return [
6187
+ 3,
6188
+ 2
6189
+ ];
6190
+ return [
6191
+ 4,
6192
+ loadBlob(source)
6193
+ ];
6194
+ case 1:
6195
+ blob = _state.sent();
6196
+ return [
6197
+ 3,
6198
+ 3
6199
+ ];
6200
+ case 2:
6201
+ if (_instanceof1(source, Blob)) {
6202
+ blob = source;
6203
+ } else {
6204
+ return [
6205
+ 2,
6206
+ loadImage(source)
6207
+ ];
6208
+ }
6209
+ _state.label = 3;
6210
+ case 3:
6211
+ return [
6212
+ 2,
6213
+ createImageBitmap(blob, options)
6214
+ ];
6215
+ case 4:
6216
+ return [
6217
+ 2,
6218
+ loadImage(source)
6219
+ ];
6220
+ case 5:
6221
+ return [
6222
+ 2
6223
+ ];
6224
+ }
6225
+ });
6226
+ });
6227
+ return _loadImageBitmap.apply(this, arguments);
6228
+ }
6229
+ /**
6230
+ * 关闭 ImageBitMap,释放内存
6231
+ * @param imgs
6232
+ */ function closeImageBitMap(imgs) {
6233
+ if (imageBitMapAvailable) {
6234
+ if (_instanceof1(imgs, ImageBitmap)) {
6235
+ imgs.close();
6236
+ } else if (_instanceof1(imgs, Array)) {
6237
+ imgs.forEach(closeImageBitMap);
6238
+ }
6239
+ }
6240
+ }
6155
6241
 
6156
6242
  function deserializeMipmapTexture(textureOptions, bins, assets) {
6157
6243
  return _deserializeMipmapTexture.apply(this, arguments);
@@ -12754,8 +12840,8 @@ var BezierCurve = /*#__PURE__*/ function(ValueGetter) {
12754
12840
  return data;
12755
12841
  };
12756
12842
  _proto.getMaxTime = function getMaxTime() {
12757
- var keyTimeData = Object.keys(this.curveMap);
12758
- return Number(keyTimeData[keyTimeData.length - 1].split("&")[1]);
12843
+ var keyTimeData = this.keyTimeData;
12844
+ return this.curveMap[keyTimeData[keyTimeData.length - 1]].timeEnd;
12759
12845
  };
12760
12846
  return BezierCurve;
12761
12847
  }(ValueGetter);
@@ -12833,19 +12919,22 @@ var BezierCurvePath = /*#__PURE__*/ function(ValueGetter) {
12833
12919
  timeInterval: timeInterval,
12834
12920
  valueInterval: valueInterval,
12835
12921
  easingCurve: easingCurve,
12836
- pathCurve: pathCurve
12922
+ pathCurve: pathCurve,
12923
+ timeStart: Number(s.x),
12924
+ timeEnd: Number(e.x)
12837
12925
  };
12838
12926
  }
12927
+ this.keyTimeData = Object.keys(this.curveSegments);
12839
12928
  };
12840
12929
  _proto.getValue = function getValue(time) {
12841
12930
  var t = numberToFix(time, 5);
12842
12931
  var perc = 0, point = new Vector3();
12843
- var keyTimeData = Object.keys(this.curveSegments);
12932
+ var keyTimeData = this.keyTimeData;
12844
12933
  if (!keyTimeData.length) {
12845
12934
  return point;
12846
12935
  }
12847
- var keyTimeStart = Number(keyTimeData[0].split("&")[0]);
12848
- var keyTimeEnd = Number(keyTimeData[keyTimeData.length - 1].split("&")[1]);
12936
+ var keyTimeStart = this.curveSegments[keyTimeData[0]].timeStart;
12937
+ var keyTimeEnd = this.curveSegments[keyTimeData[keyTimeData.length - 1]].timeEnd;
12849
12938
  if (t <= keyTimeStart) {
12850
12939
  var pathCurve = this.curveSegments[keyTimeData[0]].pathCurve;
12851
12940
  point = pathCurve.getPointInPercent(0);
@@ -12857,7 +12946,8 @@ var BezierCurvePath = /*#__PURE__*/ function(ValueGetter) {
12857
12946
  return point;
12858
12947
  }
12859
12948
  for(var i = 0; i < keyTimeData.length; i++){
12860
- var _keyTimeData_i_split = keyTimeData[i].split("&"), xMin = _keyTimeData_i_split[0], xMax = _keyTimeData_i_split[1];
12949
+ var xMin = this.curveSegments[keyTimeData[i]].timeStart;
12950
+ var xMax = this.curveSegments[keyTimeData[i]].timeEnd;
12861
12951
  if (t >= Number(xMin) && t < Number(xMax)) {
12862
12952
  var bezierPath = this.curveSegments[keyTimeData[i]].pathCurve;
12863
12953
  perc = this.getPercValue(keyTimeData[i], t);
@@ -12876,8 +12966,8 @@ var BezierCurvePath = /*#__PURE__*/ function(ValueGetter) {
12876
12966
  return clamp$1(value, 0, 1);
12877
12967
  };
12878
12968
  _proto.getMaxTime = function getMaxTime() {
12879
- var keyTimeData = Object.keys(this.curveSegments);
12880
- return Number(keyTimeData[keyTimeData.length - 1].split("&")[1]);
12969
+ var keyTimeData = this.keyTimeData;
12970
+ return this.curveSegments[keyTimeData[keyTimeData.length - 1]].timeEnd;
12881
12971
  };
12882
12972
  return BezierCurvePath;
12883
12973
  }(ValueGetter);
@@ -13030,15 +13120,18 @@ function createKeyFrameMeta() {
13030
13120
  }
13031
13121
 
13032
13122
  function _is_native_reflect_construct() {
13033
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
13034
- if (Reflect.construct.sham) return false;
13035
- if (typeof Proxy === "function") return true;
13123
+ // Since Reflect.construct can't be properly polyfilled, some
13124
+ // implementations (e.g. core-js@2) don't set the correct internal slots.
13125
+ // Those polyfills don't allow us to subclass built-ins, so we need to
13126
+ // use our fallback implementation.
13036
13127
  try {
13037
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
13038
- return true;
13039
- } catch (e) {
13040
- return false;
13041
- }
13128
+ // If the internal slots aren't set, this throws an error similar to
13129
+ // TypeError: this is not a Boolean object.
13130
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
13131
+ } catch (_) {}
13132
+ return (_is_native_reflect_construct = function _is_native_reflect_construct() {
13133
+ return !!result;
13134
+ })();
13042
13135
  }
13043
13136
 
13044
13137
  function _construct(Parent, args, Class) {
@@ -15902,6 +15995,7 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
15902
15995
  if (this.animated) {
15903
15996
  this.buildPath(this.data);
15904
15997
  this.buildGeometryFromPath(this.path.shapePath);
15998
+ this.animated = false;
15905
15999
  }
15906
16000
  };
15907
16001
  _proto.buildGeometryFromPath = function buildGeometryFromPath(shapePath) {
@@ -17009,14 +17103,10 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17009
17103
  var playableOutput2 = _step2.value;
17010
17104
  this.processFrameWithRoot(playableOutput2);
17011
17105
  }
17012
- // 更新节点时间
17013
- for(var _iterator3 = _create_for_of_iterator_helper_loose(this.playables), _step3; !(_step3 = _iterator3()).done;){
17014
- var playable = _step3.value;
17015
- this.updatePlayableTime(playable, dt / 1000);
17016
- }
17017
- };
17018
- _proto.connect = function connect(source, sourceOutputPort, destination, destinationInputPort) {
17019
- destination.connectInput(destinationInputPort, source, sourceOutputPort);
17106
+ // 更新节点时间
17107
+ // for (const playable of this.playables) {
17108
+ // this.updatePlayableTime(playable, dt / 1000);
17109
+ // }
17020
17110
  };
17021
17111
  _proto.addOutput = function addOutput(output) {
17022
17112
  this.playableOutputs.push(output);
@@ -17025,12 +17115,12 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17025
17115
  this.playables.push(playable);
17026
17116
  };
17027
17117
  _proto.processFrameWithRoot = function processFrameWithRoot(output) {
17028
- output.sourcePlayable.processFrameRecursive(output.context, output.getSourceOutputPort());
17118
+ output.sourcePlayable.processFrame(output.context);
17029
17119
  output.processFrame();
17030
17120
  };
17031
17121
  _proto.prepareFrameWithRoot = function prepareFrameWithRoot(output) {
17032
- output.sourcePlayable.prepareFrameRecursive(output.context, output.getSourceOutputPort());
17033
17122
  output.prepareFrame();
17123
+ output.sourcePlayable.prepareFrame(output.context);
17034
17124
  };
17035
17125
  _proto.updatePlayableTime = function updatePlayableTime(playable, deltaTime) {
17036
17126
  if (playable.getPlayState() !== 0) {
@@ -17045,24 +17135,15 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17045
17135
  * @since 2.0.0
17046
17136
  */ var Playable = /*#__PURE__*/ function() {
17047
17137
  function Playable(graph, inputCount) {
17048
- if (inputCount === void 0) inputCount = 0;
17049
17138
  this.onPlayablePlayFlag = true;
17050
17139
  this.onPlayablePauseFlag = false;
17051
17140
  this.duration = 0;
17052
17141
  this.destroyed = false;
17053
- this.inputs = [];
17054
- this.inputOuputPorts = [];
17055
- this.inputWeight = [];
17056
- this.outputs = [];
17057
17142
  this.playState = 0;
17058
- this.traversalMode = 0;
17059
17143
  /**
17060
17144
  * 当前本地播放的时间
17061
17145
  */ this.time = 0;
17062
17146
  graph.addPlayable(this);
17063
- this.inputs = new Array(inputCount);
17064
- this.inputOuputPorts = new Array(inputCount);
17065
- this.inputWeight = new Array(inputCount);
17066
17147
  }
17067
17148
  var _proto = Playable.prototype;
17068
17149
  _proto.play = function play() {
@@ -17085,56 +17166,6 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17085
17166
  break;
17086
17167
  }
17087
17168
  };
17088
- _proto.connectInput = function connectInput(inputPort, sourcePlayable, sourceOutputPort, weight) {
17089
- if (weight === void 0) weight = 1.0;
17090
- this.setInput(sourcePlayable, inputPort);
17091
- this.setInputWeight(inputPort, weight);
17092
- sourcePlayable.setOutput(this, sourceOutputPort);
17093
- if (this.inputOuputPorts.length < inputPort + 1) {
17094
- this.inputOuputPorts.length = inputPort + 1;
17095
- }
17096
- this.inputOuputPorts[inputPort] = sourceOutputPort;
17097
- };
17098
- _proto.addInput = function addInput(sourcePlayable, sourceOutputPort, weight) {
17099
- if (weight === void 0) weight = 1.0;
17100
- this.connectInput(this.getInputCount(), sourcePlayable, sourceOutputPort, weight);
17101
- };
17102
- _proto.getInputCount = function getInputCount() {
17103
- return this.inputs.length;
17104
- };
17105
- _proto.getInputs = function getInputs() {
17106
- return this.inputs;
17107
- };
17108
- _proto.getInput = function getInput(index) {
17109
- return this.inputs[index];
17110
- };
17111
- _proto.getOutputCount = function getOutputCount() {
17112
- return this.outputs.length;
17113
- };
17114
- _proto.getOutputs = function getOutputs() {
17115
- return this.outputs;
17116
- };
17117
- _proto.getOutput = function getOutput(index) {
17118
- return this.outputs[index];
17119
- };
17120
- _proto.getInputWeight = function getInputWeight(inputIndex) {
17121
- return this.inputWeight[inputIndex];
17122
- };
17123
- _proto.setInputWeight = function setInputWeight(playableOrIndex, weight) {
17124
- if (_instanceof1(playableOrIndex, Playable)) {
17125
- for(var i = 0; i < this.inputs.length; i++){
17126
- if (this.inputs[i] === playableOrIndex) {
17127
- this.inputWeight[i] = weight;
17128
- return;
17129
- }
17130
- }
17131
- } else {
17132
- if (this.inputWeight.length < playableOrIndex + 1) {
17133
- this.inputWeight.length = playableOrIndex + 1;
17134
- }
17135
- this.inputWeight[playableOrIndex] = weight;
17136
- }
17137
- };
17138
17169
  _proto.setTime = function setTime(time) {
17139
17170
  this.time = time;
17140
17171
  };
@@ -17150,18 +17181,14 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17150
17181
  _proto.getPlayState = function getPlayState() {
17151
17182
  return this.playState;
17152
17183
  };
17153
- _proto.setTraversalMode = function setTraversalMode(mode) {
17154
- this.traversalMode = mode;
17155
- };
17156
- _proto.getTraversalMode = function getTraversalMode() {
17157
- return this.traversalMode;
17158
- };
17159
17184
  // onGraphStart () {
17160
17185
  // }
17161
17186
  // onGraphStop () {
17162
17187
  // }
17163
- _proto.onPlayablePlay = function onPlayablePlay(context) {};
17164
- _proto.onPlayablePause = function onPlayablePause(context) {};
17188
+ // onPlayablePlay (context: FrameContext) {
17189
+ // }
17190
+ // onPlayablePause (context: FrameContext) {
17191
+ // }
17165
17192
  _proto.prepareFrame = function prepareFrame(context) {};
17166
17193
  _proto.processFrame = function processFrame(context) {};
17167
17194
  _proto.onPlayableDestroy = function onPlayableDestroy() {};
@@ -17173,76 +17200,6 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17173
17200
  // TODO 将节点从动画图中移除
17174
17201
  this.destroyed = true;
17175
17202
  };
17176
- /**
17177
- * @internal
17178
- */ _proto.prepareFrameRecursive = function prepareFrameRecursive(context, passthroughPort) {
17179
- if (this.destroyed || this.playState !== 0) {
17180
- return;
17181
- }
17182
- if (this.onPlayablePlayFlag) {
17183
- this.onPlayablePlay(context);
17184
- this.onPlayablePlayFlag = false;
17185
- }
17186
- if (this.onPlayablePauseFlag) {
17187
- this.onPlayablePause(context);
17188
- this.onPlayablePauseFlag = false;
17189
- }
17190
- if (passthroughPort === 0) {
17191
- this.prepareFrame(context);
17192
- }
17193
- // 前序遍历,用于设置节点的初始状态,weight etc.
17194
- switch(this.getTraversalMode()){
17195
- case 0:
17196
- for(var i = 0; i < this.getInputCount(); i++){
17197
- var input = this.getInput(i);
17198
- input.prepareFrameRecursive(context, this.inputOuputPorts[i]);
17199
- }
17200
- break;
17201
- case 1:
17202
- {
17203
- var input1 = this.getInput(passthroughPort);
17204
- input1.prepareFrameRecursive(context, this.inputOuputPorts[passthroughPort]);
17205
- break;
17206
- }
17207
- }
17208
- };
17209
- /**
17210
- * @internal
17211
- */ _proto.processFrameRecursive = function processFrameRecursive(context, passthroughPort) {
17212
- if (this.destroyed || this.playState !== 0) {
17213
- return;
17214
- }
17215
- // 后序遍历,保证 playable 拿到的 input 节点的估计数据是最新的
17216
- switch(this.getTraversalMode()){
17217
- case 0:
17218
- {
17219
- for(var i = 0; i < this.getInputCount(); i++){
17220
- var input = this.getInput(i);
17221
- input.processFrameRecursive(context, this.inputOuputPorts[i]);
17222
- }
17223
- break;
17224
- }
17225
- case 1:
17226
- {
17227
- var input1 = this.getInput(passthroughPort);
17228
- input1.processFrameRecursive(context, this.inputOuputPorts[passthroughPort]);
17229
- break;
17230
- }
17231
- }
17232
- this.processFrame(context);
17233
- };
17234
- _proto.setOutput = function setOutput(outputPlayable, outputPort) {
17235
- if (this.outputs.length < outputPort + 1) {
17236
- this.outputs.length = outputPort + 1;
17237
- }
17238
- this.outputs[outputPort] = outputPlayable;
17239
- };
17240
- _proto.setInput = function setInput(inputPlayable, inputPort) {
17241
- if (this.inputs.length < inputPort + 1) {
17242
- this.inputs.length = inputPort + 1;
17243
- }
17244
- this.inputs[inputPort] = inputPlayable;
17245
- };
17246
17203
  return Playable;
17247
17204
  }();
17248
17205
  /**
@@ -17250,20 +17207,14 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17250
17207
  * @since 2.0.0
17251
17208
  */ var PlayableOutput = /*#__PURE__*/ function() {
17252
17209
  function PlayableOutput() {
17253
- this.sourceOutputPort = 0;
17254
17210
  this.context = {
17255
17211
  deltaTime: 0,
17256
17212
  output: this
17257
17213
  };
17258
17214
  }
17259
17215
  var _proto = PlayableOutput.prototype;
17260
- _proto.setSourcePlayable = function setSourcePlayable(playable, port) {
17261
- if (port === void 0) port = 0;
17216
+ _proto.setSourcePlayable = function setSourcePlayable(playable) {
17262
17217
  this.sourcePlayable = playable;
17263
- this.sourceOutputPort = port;
17264
- };
17265
- _proto.getSourceOutputPort = function getSourceOutputPort() {
17266
- return this.sourceOutputPort;
17267
17218
  };
17268
17219
  _proto.setUserData = function setUserData(value) {
17269
17220
  this.userData = value;
@@ -17289,11 +17240,6 @@ var PlayState;
17289
17240
  PlayState[PlayState["Playing"] = 0] = "Playing";
17290
17241
  PlayState[PlayState["Paused"] = 1] = "Paused";
17291
17242
  })(PlayState || (PlayState = {}));
17292
- var PlayableTraversalMode;
17293
- (function(PlayableTraversalMode) {
17294
- PlayableTraversalMode[PlayableTraversalMode["Mix"] = 0] = "Mix";
17295
- PlayableTraversalMode[PlayableTraversalMode["Passthrough"] = 1] = "Passthrough";
17296
- })(PlayableTraversalMode || (PlayableTraversalMode = {}));
17297
17243
 
17298
17244
  var tempQuat$1 = new Quaternion();
17299
17245
  var seed$4 = 1;
@@ -18860,20 +18806,6 @@ SpriteComponent = __decorate([
18860
18806
  effectsClass(DataType.SpriteComponent)
18861
18807
  ], SpriteComponent);
18862
18808
 
18863
- var RUNTIME_ENV = "runtime_env";
18864
- var RENDER_PREFER_LOOKUP_TEXTURE = "lookup_texture";
18865
- // 文本元素使用 offscreen canvas 绘制
18866
- var TEMPLATE_USE_OFFSCREEN_CANVAS = "offscreen_canvas";
18867
- // 后处理配置相关
18868
- var POST_PROCESS_SETTINGS = "post_process_settings";
18869
- var config = {};
18870
- function getConfig(name) {
18871
- return config[name];
18872
- }
18873
- function setConfig(name, value) {
18874
- return config[name] = value;
18875
- }
18876
-
18877
18809
  var Cone = /*#__PURE__*/ function() {
18878
18810
  function Cone(props) {
18879
18811
  var _this = this;
@@ -22798,12 +22730,6 @@ var AnimationStream = /*#__PURE__*/ function() {
22798
22730
  _proto.findCurveValue = function findCurveValue(componentType, propertyName) {
22799
22731
  return this.curveValues[componentType + propertyName];
22800
22732
  };
22801
- _proto.getInputStream = function getInputStream(index) {
22802
- var inputPlayable = this.playable.getInput(index);
22803
- if (_instanceof1(inputPlayable, AnimationPlayable)) {
22804
- return inputPlayable.animationStream;
22805
- }
22806
- };
22807
22733
  return AnimationStream;
22808
22734
  }();
22809
22735
 
@@ -23138,214 +23064,65 @@ var AnimationClipPlayable = /*#__PURE__*/ function(Playable) {
23138
23064
  return AnimationClipPlayable;
23139
23065
  }(Playable);
23140
23066
 
23141
- /**
23142
- * @since 2.0.0
23143
- */ var TimelineClip = /*#__PURE__*/ function() {
23144
- function TimelineClip() {
23145
- this.start = 0;
23146
- this.duration = 0;
23147
- }
23148
- var _proto = TimelineClip.prototype;
23149
- _proto.toLocalTime = function toLocalTime(time) {
23150
- var localTime = time - this.start;
23151
- var duration = this.duration;
23152
- if (localTime - duration > 0) {
23153
- if (this.endBehavior === EndBehavior.restart) {
23154
- localTime = localTime % duration;
23155
- } else if (this.endBehavior === EndBehavior.freeze) {
23156
- localTime = Math.min(duration, localTime);
23157
- }
23158
- }
23159
- return localTime;
23160
- };
23161
- return TimelineClip;
23162
- }();
23163
- var TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
23164
- _inherits(TrackAsset, PlayableAsset);
23165
- function TrackAsset() {
23067
+ var TrackMixerPlayable = /*#__PURE__*/ function(Playable1) {
23068
+ _inherits(TrackMixerPlayable, Playable1);
23069
+ function TrackMixerPlayable() {
23166
23070
  var _this;
23167
- _this = PlayableAsset.apply(this, arguments) || this;
23168
- _this.trackType = 0;
23169
- _this.clipSeed = 0;
23170
- _this.clips = [];
23171
- _this.children = [];
23071
+ _this = Playable1.apply(this, arguments) || this;
23072
+ _this.clipPlayables = [];
23073
+ _this.clipWeights = [];
23172
23074
  return _this;
23173
23075
  }
23174
- var _proto = TrackAsset.prototype;
23175
- /**
23176
- * 重写该方法以获取自定义对象绑定
23177
- */ _proto.updateAnimatedObject = function updateAnimatedObject() {
23178
- if (this.parent) {
23179
- this.boundObject = this.parent.boundObject;
23180
- }
23181
- };
23182
- /**
23183
- * 重写该方法以创建自定义混合器
23184
- */ _proto.createTrackMixer = function createTrackMixer(graph) {
23185
- return new Playable(graph);
23186
- };
23187
- _proto.createOutput = function createOutput() {
23188
- var output = new PlayableOutput();
23189
- return output;
23190
- };
23191
- _proto.createPlayableGraph = function createPlayableGraph(graph, runtimeClips) {
23192
- var mixerPlayable = this.createMixerPlayableGraph(graph, runtimeClips);
23193
- return mixerPlayable;
23194
- };
23195
- _proto.createMixerPlayableGraph = function createMixerPlayableGraph(graph, runtimeClips) {
23196
- var clips = [];
23197
- for(var _iterator = _create_for_of_iterator_helper_loose(this.clips), _step; !(_step = _iterator()).done;){
23198
- var clip = _step.value;
23199
- clips.push(clip);
23200
- }
23201
- var mixerPlayable = this.compileClips(graph, clips, runtimeClips);
23202
- return mixerPlayable;
23203
- };
23204
- _proto.compileClips = function compileClips(graph, timelineClips, runtimeClips) {
23205
- var mixer = this.createTrackMixer(graph);
23206
- for(var _iterator = _create_for_of_iterator_helper_loose(timelineClips), _step; !(_step = _iterator()).done;){
23207
- var timelineClip = _step.value;
23208
- var clipPlayable = this.createClipPlayable(graph, timelineClip);
23209
- clipPlayable.setDuration(timelineClip.duration);
23210
- var clip = new RuntimeClip(timelineClip, clipPlayable, mixer, this);
23211
- runtimeClips.push(clip);
23212
- mixer.addInput(clipPlayable, 0);
23213
- mixer.setInputWeight(clipPlayable, 0.0);
23076
+ var _proto = TrackMixerPlayable.prototype;
23077
+ _proto.processFrame = function processFrame(context) {
23078
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.clipPlayables), _step; !(_step = _iterator()).done;){
23079
+ var clipPlayable = _step.value;
23080
+ clipPlayable.processFrame(context);
23214
23081
  }
23215
- return mixer;
23082
+ this.evaluate(context);
23216
23083
  };
23217
- _proto.createPlayable = function createPlayable(graph) {
23218
- return new Playable(graph);
23219
- };
23220
- _proto.getChildTracks = function getChildTracks() {
23221
- return this.children;
23222
- };
23223
- _proto.addChild = function addChild(child) {
23224
- this.children.push(child);
23225
- child.parent = this;
23226
- };
23227
- _proto.createClip = function createClip(classConstructor, name) {
23228
- var newClip = new TimelineClip();
23229
- newClip.asset = new classConstructor(this.engine);
23230
- newClip.name = name ? name : "TimelineClip" + newClip.id;
23231
- this.addClip(newClip);
23232
- return newClip;
23233
- };
23234
- _proto.getClips = function getClips() {
23235
- return this.clips;
23236
- };
23237
- _proto.findClip = function findClip(name) {
23238
- for(var _iterator = _create_for_of_iterator_helper_loose(this.clips), _step; !(_step = _iterator()).done;){
23239
- var clip = _step.value;
23240
- if (clip.name === name) {
23241
- return clip;
23084
+ _proto.setClipWeight = function setClipWeight(playableOrIndex, weight) {
23085
+ if (_instanceof1(playableOrIndex, Playable)) {
23086
+ for(var i = 0; i < this.clipPlayables.length; i++){
23087
+ if (this.clipPlayables[i] === playableOrIndex) {
23088
+ this.clipWeights[i] = weight;
23089
+ return;
23090
+ }
23091
+ }
23092
+ } else {
23093
+ if (this.clipWeights.length < playableOrIndex + 1) {
23094
+ this.clipWeights.length = playableOrIndex + 1;
23242
23095
  }
23096
+ this.clipWeights[playableOrIndex] = weight;
23243
23097
  }
23244
23098
  };
23245
- _proto.addClip = function addClip(clip) {
23246
- clip.id = (this.clipSeed++).toString();
23247
- this.clips.push(clip);
23099
+ _proto.getClipWeight = function getClipWeight(inputIndex) {
23100
+ return this.clipWeights[inputIndex];
23248
23101
  };
23249
- _proto.createClipPlayable = function createClipPlayable(graph, clip) {
23250
- return clip.asset.createPlayable(graph);
23102
+ _proto.getClipPlayable = function getClipPlayable(index) {
23103
+ return this.clipPlayables[index];
23251
23104
  };
23252
- _proto.fromData = function fromData(data) {
23253
- PlayableAsset.prototype.fromData.call(this, data);
23254
- for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
23255
- var child = _step.value;
23256
- child.parent = this;
23257
- }
23258
- };
23259
- return TrackAsset;
23260
- }(PlayableAsset);
23261
- __decorate([
23262
- serialize(TimelineClip)
23263
- ], TrackAsset.prototype, "clips", void 0);
23264
- __decorate([
23265
- serialize()
23266
- ], TrackAsset.prototype, "children", void 0);
23267
- TrackAsset = __decorate([
23268
- effectsClass(DataType.TrackAsset)
23269
- ], TrackAsset);
23270
- var TrackType;
23271
- (function(TrackType) {
23272
- TrackType[TrackType["MasterTrack"] = 0] = "MasterTrack";
23273
- TrackType[TrackType["ObjectTrack"] = 1] = "ObjectTrack";
23274
- })(TrackType || (TrackType = {}));
23275
- var RuntimeClip = /*#__PURE__*/ function() {
23276
- function RuntimeClip(clip, clipPlayable, parentMixer, track) {
23277
- this.clip = clip;
23278
- this.playable = clipPlayable;
23279
- this.parentMixer = parentMixer;
23280
- this.track = track;
23281
- if (_instanceof1(this.track.boundObject, VFXItem)) {
23282
- this.particleSystem = this.track.boundObject.getComponent(ParticleSystem);
23283
- }
23284
- }
23285
- var _proto = RuntimeClip.prototype;
23286
- _proto.evaluateAt = function evaluateAt(localTime) {
23287
- var clip = this.clip;
23288
- var weight = 1.0;
23289
- var ended = false;
23290
- var started = false;
23291
- var boundObject = this.track.boundObject;
23292
- if (localTime >= clip.start + clip.duration && clip.endBehavior === EndBehavior.destroy) {
23293
- if (_instanceof1(boundObject, VFXItem) && VFXItem.isParticle(boundObject) && this.particleSystem && !this.particleSystem.destroyed) {
23294
- weight = 1.0;
23295
- } else {
23296
- weight = 0.0;
23297
- ended = true;
23298
- }
23299
- } else if (localTime - this.clip.start >= 0) {
23300
- weight = 1.0;
23301
- started = true;
23302
- } else if (localTime < clip.start) {
23303
- weight = 0.0;
23304
- }
23305
- if (started && this.playable.getPlayState() !== PlayState.Playing) {
23306
- this.playable.play();
23307
- }
23308
- this.parentMixer.setInputWeight(this.playable, weight);
23309
- var clipTime = parseFloat(clip.toLocalTime(localTime).toFixed(3));
23310
- this.playable.setTime(clipTime);
23311
- // 判断动画是否结束
23312
- if (ended) {
23313
- if (this.playable.getPlayState() === PlayState.Playing) {
23314
- this.playable.pause();
23315
- }
23316
- }
23105
+ _proto.evaluate = function evaluate(context) {
23106
+ // Override
23317
23107
  };
23318
- _create_class(RuntimeClip, [
23319
- {
23320
- key: "enable",
23321
- set: function set(value) {
23322
- if (value) {
23323
- this.playable.play();
23324
- } else {
23325
- this.parentMixer.setInputWeight(this.playable, 0);
23326
- this.playable.pause();
23327
- }
23328
- }
23329
- }
23330
- ]);
23331
- return RuntimeClip;
23332
- }();
23108
+ return TrackMixerPlayable;
23109
+ }(Playable);
23333
23110
 
23334
- var ActivationMixerPlayable = /*#__PURE__*/ function(Playable) {
23335
- _inherits(ActivationMixerPlayable, Playable);
23111
+ var ActivationMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
23112
+ _inherits(ActivationMixerPlayable, TrackMixerPlayable);
23336
23113
  function ActivationMixerPlayable() {
23337
- return Playable.apply(this, arguments);
23114
+ return TrackMixerPlayable.apply(this, arguments);
23338
23115
  }
23339
23116
  var _proto = ActivationMixerPlayable.prototype;
23340
- _proto.processFrame = function processFrame(context) {
23117
+ _proto.evaluate = function evaluate(context) {
23341
23118
  var boundObject = context.output.getUserData();
23342
23119
  if (!_instanceof1(boundObject, VFXItem)) {
23343
23120
  return;
23344
23121
  }
23345
23122
  var boundItem = boundObject;
23346
23123
  var hasInput = false;
23347
- for(var i = 0; i < this.getInputCount(); i++){
23348
- if (this.getInputWeight(i) > 0) {
23124
+ for(var i = 0; i < this.clipPlayables.length; i++){
23125
+ if (this.getClipWeight(i) > 0) {
23349
23126
  hasInput = true;
23350
23127
  break;
23351
23128
  }
@@ -23359,22 +23136,7 @@ var ActivationMixerPlayable = /*#__PURE__*/ function(Playable) {
23359
23136
  }
23360
23137
  };
23361
23138
  return ActivationMixerPlayable;
23362
- }(Playable);
23363
-
23364
- var ActivationTrack = /*#__PURE__*/ function(TrackAsset) {
23365
- _inherits(ActivationTrack, TrackAsset);
23366
- function ActivationTrack() {
23367
- return TrackAsset.apply(this, arguments);
23368
- }
23369
- var _proto = ActivationTrack.prototype;
23370
- _proto.createTrackMixer = function createTrackMixer(graph) {
23371
- return new ActivationMixerPlayable(graph);
23372
- };
23373
- return ActivationTrack;
23374
- }(TrackAsset);
23375
- ActivationTrack = __decorate([
23376
- effectsClass(DataType.ActivationTrack)
23377
- ], ActivationTrack);
23139
+ }(TrackMixerPlayable);
23378
23140
 
23379
23141
  var PropertyClipPlayable = /*#__PURE__*/ function(Playable) {
23380
23142
  _inherits(PropertyClipPlayable, Playable);
@@ -23388,16 +23150,61 @@ var PropertyClipPlayable = /*#__PURE__*/ function(Playable) {
23388
23150
  return PropertyClipPlayable;
23389
23151
  }(Playable);
23390
23152
 
23391
- var FloatPropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
23392
- _inherits(FloatPropertyMixerPlayable, Playable);
23153
+ var ColorPropertyMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
23154
+ _inherits(ColorPropertyMixerPlayable, TrackMixerPlayable);
23155
+ function ColorPropertyMixerPlayable() {
23156
+ var _this;
23157
+ _this = TrackMixerPlayable.apply(this, arguments) || this;
23158
+ _this.propertyName = "";
23159
+ return _this;
23160
+ }
23161
+ var _proto = ColorPropertyMixerPlayable.prototype;
23162
+ _proto.evaluate = function evaluate(context) {
23163
+ var boundObject = context.output.getUserData();
23164
+ if (!boundObject) {
23165
+ return;
23166
+ }
23167
+ var hasInput = false;
23168
+ var value = boundObject[this.propertyName];
23169
+ if (!_instanceof1(value, Color)) {
23170
+ return;
23171
+ }
23172
+ value.setZero();
23173
+ // evaluate the curve
23174
+ for(var i = 0; i < this.clipPlayables.length; i++){
23175
+ var weight = this.getClipWeight(i);
23176
+ if (weight > 0) {
23177
+ var propertyClipPlayable = this.getClipPlayable(i);
23178
+ if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
23179
+ console.error("ColorPropertyMixerPlayable received incompatible input");
23180
+ continue;
23181
+ }
23182
+ var curveValue = propertyClipPlayable.value;
23183
+ value.r += curveValue.r * weight;
23184
+ value.g += curveValue.g * weight;
23185
+ value.b += curveValue.b * weight;
23186
+ value.a += curveValue.a * weight;
23187
+ hasInput = true;
23188
+ }
23189
+ }
23190
+ // set value
23191
+ if (hasInput) {
23192
+ boundObject[this.propertyName] = value;
23193
+ }
23194
+ };
23195
+ return ColorPropertyMixerPlayable;
23196
+ }(TrackMixerPlayable);
23197
+
23198
+ var FloatPropertyMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
23199
+ _inherits(FloatPropertyMixerPlayable, TrackMixerPlayable);
23393
23200
  function FloatPropertyMixerPlayable() {
23394
23201
  var _this;
23395
- _this = Playable.apply(this, arguments) || this;
23202
+ _this = TrackMixerPlayable.apply(this, arguments) || this;
23396
23203
  _this.propertyName = "";
23397
23204
  return _this;
23398
23205
  }
23399
23206
  var _proto = FloatPropertyMixerPlayable.prototype;
23400
- _proto.processFrame = function processFrame(context) {
23207
+ _proto.evaluate = function evaluate(context) {
23401
23208
  var boundObject = context.output.getUserData();
23402
23209
  if (!boundObject) {
23403
23210
  return;
@@ -23405,10 +23212,10 @@ var FloatPropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
23405
23212
  var hasInput = false;
23406
23213
  var value = 0;
23407
23214
  // evaluate the curve
23408
- for(var i = 0; i < this.getInputCount(); i++){
23409
- var weight = this.getInputWeight(i);
23215
+ for(var i = 0; i < this.clipPlayables.length; i++){
23216
+ var weight = this.getClipWeight(i);
23410
23217
  if (weight > 0) {
23411
- var propertyClipPlayable = this.getInput(i);
23218
+ var propertyClipPlayable = this.getClipPlayable(i);
23412
23219
  if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
23413
23220
  console.error("FloatPropertyTrack added non-FloatPropertyPlayableAsset");
23414
23221
  continue;
@@ -23424,7 +23231,27 @@ var FloatPropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
23424
23231
  }
23425
23232
  };
23426
23233
  return FloatPropertyMixerPlayable;
23427
- }(Playable);
23234
+ }(TrackMixerPlayable);
23235
+
23236
+ var ParticleMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
23237
+ _inherits(ParticleMixerPlayable, TrackMixerPlayable);
23238
+ function ParticleMixerPlayable() {
23239
+ return TrackMixerPlayable.apply(this, arguments);
23240
+ }
23241
+ var _proto = ParticleMixerPlayable.prototype;
23242
+ _proto.evaluate = function evaluate(context) {};
23243
+ return ParticleMixerPlayable;
23244
+ }(TrackMixerPlayable);
23245
+
23246
+ var SpriteColorMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
23247
+ _inherits(SpriteColorMixerPlayable, TrackMixerPlayable);
23248
+ function SpriteColorMixerPlayable() {
23249
+ return TrackMixerPlayable.apply(this, arguments);
23250
+ }
23251
+ var _proto = SpriteColorMixerPlayable.prototype;
23252
+ _proto.evaluate = function evaluate(context) {};
23253
+ return SpriteColorMixerPlayable;
23254
+ }(TrackMixerPlayable);
23428
23255
 
23429
23256
  var SerializationHelper = /*#__PURE__*/ function() {
23430
23257
  function SerializationHelper() {}
@@ -23916,7 +23743,8 @@ var SerializationHelper = /*#__PURE__*/ function() {
23916
23743
  this.timelinePlayable.setTime(time);
23917
23744
  // The properties of the object may change dynamically,
23918
23745
  // so reset the track binding to avoid invalidation of the previously obtained binding object.
23919
- this.resolveBindings();
23746
+ // this.resolveBindings();
23747
+ this.timelinePlayable.evaluate();
23920
23748
  this.graph.evaluate(dt);
23921
23749
  };
23922
23750
  _proto.createContent = function createContent() {
@@ -24095,21 +23923,21 @@ var SubCompositionClipPlayable = /*#__PURE__*/ function(Playable) {
24095
23923
  return SubCompositionClipPlayable;
24096
23924
  }(Playable);
24097
23925
 
24098
- var SubCompositionMixerPlayable = /*#__PURE__*/ function(Playable) {
24099
- _inherits(SubCompositionMixerPlayable, Playable);
23926
+ var SubCompositionMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
23927
+ _inherits(SubCompositionMixerPlayable, TrackMixerPlayable);
24100
23928
  function SubCompositionMixerPlayable() {
24101
- return Playable.apply(this, arguments);
23929
+ return TrackMixerPlayable.apply(this, arguments);
24102
23930
  }
24103
23931
  var _proto = SubCompositionMixerPlayable.prototype;
24104
- _proto.processFrame = function processFrame(context) {
23932
+ _proto.evaluate = function evaluate(context) {
24105
23933
  var boundObject = context.output.getUserData();
24106
23934
  if (!_instanceof1(boundObject, CompositionComponent)) {
24107
23935
  return;
24108
23936
  }
24109
23937
  var compositionComponent = boundObject;
24110
23938
  var hasInput = false;
24111
- for(var i = 0; i < this.getInputCount(); i++){
24112
- if (this.getInputWeight(i) > 0) {
23939
+ for(var i = 0; i < this.clipPlayables.length; i++){
23940
+ if (this.getClipWeight(i) > 0) {
24113
23941
  hasInput = true;
24114
23942
  break;
24115
23943
  }
@@ -24121,18 +23949,28 @@ var SubCompositionMixerPlayable = /*#__PURE__*/ function(Playable) {
24121
23949
  }
24122
23950
  };
24123
23951
  return SubCompositionMixerPlayable;
24124
- }(Playable);
23952
+ }(TrackMixerPlayable);
24125
23953
 
24126
- var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
24127
- _inherits(Vector4PropertyMixerPlayable, Playable);
23954
+ var TransformMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
23955
+ _inherits(TransformMixerPlayable, TrackMixerPlayable);
23956
+ function TransformMixerPlayable() {
23957
+ return TrackMixerPlayable.apply(this, arguments);
23958
+ }
23959
+ var _proto = TransformMixerPlayable.prototype;
23960
+ _proto.evaluate = function evaluate(context) {};
23961
+ return TransformMixerPlayable;
23962
+ }(TrackMixerPlayable);
23963
+
23964
+ var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
23965
+ _inherits(Vector4PropertyMixerPlayable, TrackMixerPlayable);
24128
23966
  function Vector4PropertyMixerPlayable() {
24129
23967
  var _this;
24130
- _this = Playable.apply(this, arguments) || this;
23968
+ _this = TrackMixerPlayable.apply(this, arguments) || this;
24131
23969
  _this.propertyName = "";
24132
23970
  return _this;
24133
23971
  }
24134
23972
  var _proto = Vector4PropertyMixerPlayable.prototype;
24135
- _proto.processFrame = function processFrame(context) {
23973
+ _proto.evaluate = function evaluate(context) {
24136
23974
  var boundObject = context.output.getUserData();
24137
23975
  if (!boundObject) {
24138
23976
  return;
@@ -24144,10 +23982,10 @@ var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
24144
23982
  }
24145
23983
  value.setZero();
24146
23984
  // evaluate the curve
24147
- for(var i = 0; i < this.getInputCount(); i++){
24148
- var weight = this.getInputWeight(i);
23985
+ for(var i = 0; i < this.clipPlayables.length; i++){
23986
+ var weight = this.getClipWeight(i);
24149
23987
  if (weight > 0) {
24150
- var propertyClipPlayable = this.getInput(i);
23988
+ var propertyClipPlayable = this.getClipPlayable(i);
24151
23989
  if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
24152
23990
  console.error("Vector4PropertyTrack added non-Vector4PropertyPlayableAsset");
24153
23991
  continue;
@@ -24166,52 +24004,215 @@ var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
24166
24004
  }
24167
24005
  };
24168
24006
  return Vector4PropertyMixerPlayable;
24169
- }(Playable);
24007
+ }(TrackMixerPlayable);
24170
24008
 
24171
- var ColorPropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
24172
- _inherits(ColorPropertyMixerPlayable, Playable);
24173
- function ColorPropertyMixerPlayable() {
24009
+ /**
24010
+ * @since 2.0.0
24011
+ */ var TimelineClip = /*#__PURE__*/ function() {
24012
+ function TimelineClip() {
24013
+ this.start = 0;
24014
+ this.duration = 0;
24015
+ }
24016
+ var _proto = TimelineClip.prototype;
24017
+ _proto.toLocalTime = function toLocalTime(time) {
24018
+ var localTime = time - this.start;
24019
+ var duration = this.duration;
24020
+ if (localTime - duration > 0) {
24021
+ if (this.endBehavior === EndBehavior.restart) {
24022
+ localTime = localTime % duration;
24023
+ } else if (this.endBehavior === EndBehavior.freeze) {
24024
+ localTime = Math.min(duration, localTime);
24025
+ }
24026
+ }
24027
+ return localTime;
24028
+ };
24029
+ return TimelineClip;
24030
+ }();
24031
+ var TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
24032
+ _inherits(TrackAsset, PlayableAsset);
24033
+ function TrackAsset() {
24174
24034
  var _this;
24175
- _this = Playable.apply(this, arguments) || this;
24176
- _this.propertyName = "";
24035
+ _this = PlayableAsset.apply(this, arguments) || this;
24036
+ _this.trackType = 0;
24037
+ _this.clipSeed = 0;
24038
+ _this.clips = [];
24039
+ _this.children = [];
24177
24040
  return _this;
24178
24041
  }
24179
- var _proto = ColorPropertyMixerPlayable.prototype;
24180
- _proto.processFrame = function processFrame(context) {
24181
- var boundObject = context.output.getUserData();
24182
- if (!boundObject) {
24183
- return;
24042
+ var _proto = TrackAsset.prototype;
24043
+ /**
24044
+ * 重写该方法以获取自定义对象绑定
24045
+ */ _proto.updateAnimatedObject = function updateAnimatedObject() {
24046
+ if (this.parent) {
24047
+ this.boundObject = this.parent.boundObject;
24184
24048
  }
24185
- var hasInput = false;
24186
- var value = boundObject[this.propertyName];
24187
- if (!_instanceof1(value, Color)) {
24188
- return;
24049
+ };
24050
+ /**
24051
+ * 重写该方法以创建自定义混合器
24052
+ */ _proto.createTrackMixer = function createTrackMixer(graph) {
24053
+ return new TrackMixerPlayable(graph);
24054
+ };
24055
+ _proto.createOutput = function createOutput() {
24056
+ var output = new PlayableOutput();
24057
+ return output;
24058
+ };
24059
+ _proto.createPlayableGraph = function createPlayableGraph(graph, runtimeClips) {
24060
+ var mixerPlayable = this.createMixerPlayableGraph(graph, runtimeClips);
24061
+ return mixerPlayable;
24062
+ };
24063
+ _proto.createMixerPlayableGraph = function createMixerPlayableGraph(graph, runtimeClips) {
24064
+ var clips = [];
24065
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.clips), _step; !(_step = _iterator()).done;){
24066
+ var clip = _step.value;
24067
+ clips.push(clip);
24189
24068
  }
24190
- value.setZero();
24191
- // evaluate the curve
24192
- for(var i = 0; i < this.getInputCount(); i++){
24193
- var weight = this.getInputWeight(i);
24194
- if (weight > 0) {
24195
- var propertyClipPlayable = this.getInput(i);
24196
- if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
24197
- console.error("ColorPropertyMixerPlayable received incompatible input");
24198
- continue;
24199
- }
24200
- var curveValue = propertyClipPlayable.value;
24201
- value.r += curveValue.r * weight;
24202
- value.g += curveValue.g * weight;
24203
- value.b += curveValue.b * weight;
24204
- value.a += curveValue.a * weight;
24205
- hasInput = true;
24069
+ var mixerPlayable = this.compileClips(graph, clips, runtimeClips);
24070
+ return mixerPlayable;
24071
+ };
24072
+ _proto.compileClips = function compileClips(graph, timelineClips, runtimeClips) {
24073
+ var mixer = this.createTrackMixer(graph);
24074
+ for(var _iterator = _create_for_of_iterator_helper_loose(timelineClips), _step; !(_step = _iterator()).done;){
24075
+ var timelineClip = _step.value;
24076
+ var clipPlayable = this.createClipPlayable(graph, timelineClip);
24077
+ clipPlayable.setDuration(timelineClip.duration);
24078
+ var clip = new RuntimeClip(timelineClip, clipPlayable, mixer, this);
24079
+ runtimeClips.push(clip);
24080
+ mixer.clipPlayables.push(clipPlayable);
24081
+ mixer.setClipWeight(clipPlayable, 0.0);
24082
+ }
24083
+ return mixer;
24084
+ };
24085
+ _proto.createPlayable = function createPlayable(graph) {
24086
+ return new Playable(graph);
24087
+ };
24088
+ _proto.getChildTracks = function getChildTracks() {
24089
+ return this.children;
24090
+ };
24091
+ _proto.addChild = function addChild(child) {
24092
+ this.children.push(child);
24093
+ child.parent = this;
24094
+ };
24095
+ _proto.createClip = function createClip(classConstructor, name) {
24096
+ var newClip = new TimelineClip();
24097
+ newClip.asset = new classConstructor(this.engine);
24098
+ newClip.name = name ? name : "TimelineClip" + newClip.id;
24099
+ this.addClip(newClip);
24100
+ return newClip;
24101
+ };
24102
+ _proto.getClips = function getClips() {
24103
+ return this.clips;
24104
+ };
24105
+ _proto.findClip = function findClip(name) {
24106
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.clips), _step; !(_step = _iterator()).done;){
24107
+ var clip = _step.value;
24108
+ if (clip.name === name) {
24109
+ return clip;
24206
24110
  }
24207
24111
  }
24208
- // set value
24209
- if (hasInput) {
24210
- boundObject[this.propertyName] = value;
24112
+ };
24113
+ _proto.addClip = function addClip(clip) {
24114
+ clip.id = (this.clipSeed++).toString();
24115
+ this.clips.push(clip);
24116
+ };
24117
+ _proto.createClipPlayable = function createClipPlayable(graph, clip) {
24118
+ return clip.asset.createPlayable(graph);
24119
+ };
24120
+ _proto.fromData = function fromData(data) {
24121
+ PlayableAsset.prototype.fromData.call(this, data);
24122
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
24123
+ var child = _step.value;
24124
+ child.parent = this;
24211
24125
  }
24212
24126
  };
24213
- return ColorPropertyMixerPlayable;
24214
- }(Playable);
24127
+ return TrackAsset;
24128
+ }(PlayableAsset);
24129
+ __decorate([
24130
+ serialize(TimelineClip)
24131
+ ], TrackAsset.prototype, "clips", void 0);
24132
+ __decorate([
24133
+ serialize()
24134
+ ], TrackAsset.prototype, "children", void 0);
24135
+ TrackAsset = __decorate([
24136
+ effectsClass(DataType.TrackAsset)
24137
+ ], TrackAsset);
24138
+ var TrackType;
24139
+ (function(TrackType) {
24140
+ TrackType[TrackType["MasterTrack"] = 0] = "MasterTrack";
24141
+ TrackType[TrackType["ObjectTrack"] = 1] = "ObjectTrack";
24142
+ })(TrackType || (TrackType = {}));
24143
+ var RuntimeClip = /*#__PURE__*/ function() {
24144
+ function RuntimeClip(clip, clipPlayable, parentMixer, track) {
24145
+ this.clip = clip;
24146
+ this.playable = clipPlayable;
24147
+ this.parentMixer = parentMixer;
24148
+ this.track = track;
24149
+ if (_instanceof1(this.track.boundObject, VFXItem)) {
24150
+ this.particleSystem = this.track.boundObject.getComponent(ParticleSystem);
24151
+ }
24152
+ }
24153
+ var _proto = RuntimeClip.prototype;
24154
+ _proto.evaluateAt = function evaluateAt(localTime) {
24155
+ var clip = this.clip;
24156
+ var weight = 1.0;
24157
+ var ended = false;
24158
+ var started = false;
24159
+ var boundObject = this.track.boundObject;
24160
+ if (localTime >= clip.start + clip.duration && clip.endBehavior === EndBehavior.destroy) {
24161
+ if (_instanceof1(boundObject, VFXItem) && VFXItem.isParticle(boundObject) && this.particleSystem && !this.particleSystem.destroyed) {
24162
+ weight = 1.0;
24163
+ } else {
24164
+ weight = 0.0;
24165
+ ended = true;
24166
+ }
24167
+ } else if (localTime - this.clip.start >= 0) {
24168
+ weight = 1.0;
24169
+ started = true;
24170
+ } else if (localTime < clip.start) {
24171
+ weight = 0.0;
24172
+ }
24173
+ if (started && this.playable.getPlayState() !== PlayState.Playing) {
24174
+ this.playable.play();
24175
+ }
24176
+ this.parentMixer.setClipWeight(this.playable, weight);
24177
+ var clipTime = parseFloat(clip.toLocalTime(localTime).toFixed(3));
24178
+ this.playable.setTime(clipTime);
24179
+ // 判断动画是否结束
24180
+ if (ended) {
24181
+ if (this.playable.getPlayState() === PlayState.Playing) {
24182
+ this.playable.pause();
24183
+ }
24184
+ }
24185
+ };
24186
+ _create_class(RuntimeClip, [
24187
+ {
24188
+ key: "enable",
24189
+ set: function set(value) {
24190
+ if (value) {
24191
+ this.playable.play();
24192
+ } else {
24193
+ this.parentMixer.setClipWeight(this.playable, 0);
24194
+ this.playable.pause();
24195
+ }
24196
+ }
24197
+ }
24198
+ ]);
24199
+ return RuntimeClip;
24200
+ }();
24201
+
24202
+ var ActivationTrack = /*#__PURE__*/ function(TrackAsset) {
24203
+ _inherits(ActivationTrack, TrackAsset);
24204
+ function ActivationTrack() {
24205
+ return TrackAsset.apply(this, arguments);
24206
+ }
24207
+ var _proto = ActivationTrack.prototype;
24208
+ _proto.createTrackMixer = function createTrackMixer(graph) {
24209
+ return new ActivationMixerPlayable(graph);
24210
+ };
24211
+ return ActivationTrack;
24212
+ }(TrackAsset);
24213
+ ActivationTrack = __decorate([
24214
+ effectsClass(DataType.ActivationTrack)
24215
+ ], ActivationTrack);
24215
24216
 
24216
24217
  var PropertyTrack = /*#__PURE__*/ function(TrackAsset) {
24217
24218
  _inherits(PropertyTrack, TrackAsset);
@@ -24284,6 +24285,10 @@ var SpriteColorTrack = /*#__PURE__*/ function(TrackAsset) {
24284
24285
  function SpriteColorTrack() {
24285
24286
  return TrackAsset.apply(this, arguments);
24286
24287
  }
24288
+ var _proto = SpriteColorTrack.prototype;
24289
+ _proto.createTrackMixer = function createTrackMixer(graph) {
24290
+ return new SpriteColorMixerPlayable(graph);
24291
+ };
24287
24292
  return SpriteColorTrack;
24288
24293
  }(TrackAsset);
24289
24294
  SpriteColorTrack = __decorate([
@@ -24316,6 +24321,10 @@ var TransformTrack = /*#__PURE__*/ function(TrackAsset) {
24316
24321
  function TransformTrack() {
24317
24322
  return TrackAsset.apply(this, arguments);
24318
24323
  }
24324
+ var _proto = TransformTrack.prototype;
24325
+ _proto.createTrackMixer = function createTrackMixer(graph) {
24326
+ return new TransformMixerPlayable(graph);
24327
+ };
24319
24328
  return TransformTrack;
24320
24329
  }(TrackAsset);
24321
24330
  TransformTrack = __decorate([
@@ -24344,6 +24353,18 @@ MaterialTrack = __decorate([
24344
24353
  effectsClass("MaterialTrack")
24345
24354
  ], MaterialTrack);
24346
24355
 
24356
+ var ParticleTrack = /*#__PURE__*/ function(TrackAsset) {
24357
+ _inherits(ParticleTrack, TrackAsset);
24358
+ function ParticleTrack() {
24359
+ return TrackAsset.apply(this, arguments);
24360
+ }
24361
+ var _proto = ParticleTrack.prototype;
24362
+ _proto.createTrackMixer = function createTrackMixer(graph) {
24363
+ return new ParticleMixerPlayable(graph);
24364
+ };
24365
+ return ParticleTrack;
24366
+ }(TrackAsset);
24367
+
24347
24368
  var Vector4PropertyTrack = /*#__PURE__*/ function(PropertyTrack) {
24348
24369
  _inherits(Vector4PropertyTrack, PropertyTrack);
24349
24370
  function Vector4PropertyTrack() {
@@ -24472,7 +24493,6 @@ var TimelineAsset = /*#__PURE__*/ function(PlayableAsset) {
24472
24493
  var _proto = TimelineAsset.prototype;
24473
24494
  _proto.createPlayable = function createPlayable(graph) {
24474
24495
  var timelinePlayable = new TimelinePlayable(graph);
24475
- timelinePlayable.setTraversalMode(PlayableTraversalMode.Passthrough);
24476
24496
  for(var _iterator = _create_for_of_iterator_helper_loose(this.tracks), _step; !(_step = _iterator()).done;){
24477
24497
  var track = _step.value;
24478
24498
  if (_instanceof1(track, ObjectBindingTrack)) {
@@ -24553,9 +24573,7 @@ var TimelinePlayable = /*#__PURE__*/ function(Playable) {
24553
24573
  return _this;
24554
24574
  }
24555
24575
  var _proto = TimelinePlayable.prototype;
24556
- _proto.prepareFrame = function prepareFrame(context) {
24557
- this.evaluate();
24558
- };
24576
+ _proto.prepareFrame = function prepareFrame(context) {};
24559
24577
  _proto.evaluate = function evaluate() {
24560
24578
  var time = this.getTime();
24561
24579
  // TODO search active clips
@@ -24572,11 +24590,10 @@ var TimelinePlayable = /*#__PURE__*/ function(Playable) {
24572
24590
  var track = _step.value;
24573
24591
  // create track mixer and track output
24574
24592
  var trackMixPlayable = track.createPlayableGraph(graph, this.clips);
24575
- this.addInput(trackMixPlayable, 0);
24576
24593
  var trackOutput = track.createOutput();
24577
24594
  trackOutput.setUserData(track.boundObject);
24578
24595
  graph.addOutput(trackOutput);
24579
- trackOutput.setSourcePlayable(this, this.getInputCount() - 1);
24596
+ trackOutput.setSourcePlayable(trackMixPlayable);
24580
24597
  // create track instance
24581
24598
  var trackInstance = new TrackInstance(track, trackMixPlayable, trackOutput);
24582
24599
  trackInstanceMap[track.getInstanceId()] = trackInstance;
@@ -24637,10 +24654,10 @@ Vector4PropertyPlayableAsset = __decorate([
24637
24654
  effectsClass("Vector4PropertyPlayableAsset")
24638
24655
  ], Vector4PropertyPlayableAsset);
24639
24656
 
24640
- var ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
24641
- _inherits(ObjectBindingTrack, TrackAsset1);
24657
+ var ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset) {
24658
+ _inherits(ObjectBindingTrack, TrackAsset);
24642
24659
  function ObjectBindingTrack() {
24643
- return TrackAsset1.apply(this, arguments);
24660
+ return TrackAsset.apply(this, arguments);
24644
24661
  }
24645
24662
  var _proto = ObjectBindingTrack.prototype;
24646
24663
  _proto.updateAnimatedObject = function updateAnimatedObject() {};
@@ -24651,7 +24668,7 @@ var ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
24651
24668
  var boundItem = this.boundObject;
24652
24669
  // 添加粒子动画 clip // TODO 待移除
24653
24670
  if (boundItem.getComponent(ParticleSystem)) {
24654
- var particleTrack = timelineAsset.createTrack(TrackAsset, this, "ParticleTrack");
24671
+ var particleTrack = timelineAsset.createTrack(ParticleTrack, this, "ParticleTrack");
24655
24672
  particleTrack.boundObject = this.boundObject;
24656
24673
  var particleClip = particleTrack.createClip(ParticleBehaviourPlayableAsset);
24657
24674
  particleClip.start = boundItem.start;
@@ -24681,7 +24698,7 @@ var TextLayout = /*#__PURE__*/ function() {
24681
24698
  this.width = textWidth;
24682
24699
  this.height = textHeight;
24683
24700
  this.letterSpace = letterSpace;
24684
- this.overFlow = textOverflow;
24701
+ this.overflow = textOverflow;
24685
24702
  this.textBaseline = textBaseline;
24686
24703
  this.textAlign = textAlign;
24687
24704
  this.lineHeight = lineHeight;
@@ -27296,6 +27313,7 @@ var seed$1 = 1;
27296
27313
  this.downloader = downloader;
27297
27314
  this.assets = {};
27298
27315
  this.sourceFrom = {};
27316
+ this.imageBitmapOptions = {};
27299
27317
  this.id = seed$1++;
27300
27318
  this.timers = [];
27301
27319
  this.updateOptions(options);
@@ -27553,12 +27571,12 @@ var seed$1 = 1;
27553
27571
  _proto.processJSON = function processJSON(json) {
27554
27572
  var _this = this;
27555
27573
  return _async_to_generator(function() {
27556
- var jsonScene, _jsonScene_plugins, plugins, pluginSystem;
27574
+ var jsonScene, _jsonScene_plugins, plugins, textures, pluginSystem;
27557
27575
  return __generator(this, function(_state) {
27558
27576
  switch(_state.label){
27559
27577
  case 0:
27560
27578
  jsonScene = getStandardJSON(json);
27561
- _jsonScene_plugins = jsonScene.plugins, plugins = _jsonScene_plugins === void 0 ? [] : _jsonScene_plugins;
27579
+ _jsonScene_plugins = jsonScene.plugins, plugins = _jsonScene_plugins === void 0 ? [] : _jsonScene_plugins, textures = jsonScene.textures;
27562
27580
  pluginSystem = new PluginSystem(plugins);
27563
27581
  return [
27564
27582
  4,
@@ -27566,6 +27584,7 @@ var seed$1 = 1;
27566
27584
  ];
27567
27585
  case 1:
27568
27586
  _state.sent();
27587
+ _this.assignImageBitmapOptions(textures);
27569
27588
  return [
27570
27589
  2,
27571
27590
  {
@@ -27671,11 +27690,11 @@ var seed$1 = 1;
27671
27690
  if (compressedTexture === void 0) compressedTexture = 0;
27672
27691
  var _this = this;
27673
27692
  return _async_to_generator(function() {
27674
- var _this_options, useCompressedTexture, variables, baseUrl, jobs, loadedImages;
27693
+ var _this_options, useCompressedTexture, variables, disableWebP, disableAVIF, baseUrl, jobs, loadedImages;
27675
27694
  return __generator(this, function(_state) {
27676
27695
  switch(_state.label){
27677
27696
  case 0:
27678
- _this_options = _this.options, useCompressedTexture = _this_options.useCompressedTexture, variables = _this_options.variables;
27697
+ _this_options = _this.options, useCompressedTexture = _this_options.useCompressedTexture, variables = _this_options.variables, disableWebP = _this_options.disableWebP, disableAVIF = _this_options.disableAVIF;
27679
27698
  baseUrl = _this.baseUrl;
27680
27699
  jobs = images.map(/*#__PURE__*/ _async_to_generator(function(img, idx) {
27681
27700
  var png, webp, avif, imageURL, webpURL, avifURL, id, template, background, url, isVideo, loadFn, resultImage, e, compressed, src, bufferURL, _ref, url1, image, _tmp;
@@ -27686,9 +27705,9 @@ var seed$1 = 1;
27686
27705
  // eslint-disable-next-line compat/compat
27687
27706
  imageURL = new URL(png, baseUrl).href;
27688
27707
  // eslint-disable-next-line compat/compat
27689
- webpURL = webp && new URL(webp, baseUrl).href;
27708
+ webpURL = !disableWebP && webp ? new URL(webp, baseUrl).href : undefined;
27690
27709
  // eslint-disable-next-line compat/compat
27691
- avifURL = avif && new URL(avif, baseUrl).href;
27710
+ avifURL = !disableAVIF && avif ? new URL(avif, baseUrl).href : undefined;
27692
27711
  id = img.id;
27693
27712
  if (!("template" in img)) return [
27694
27713
  3,
@@ -27797,7 +27816,7 @@ var seed$1 = 1;
27797
27816
  ];
27798
27817
  return [
27799
27818
  4,
27800
- loadAVIFOptional(imageURL, avifURL)
27819
+ loadAVIFOptional(imageURL, avifURL, _this.imageBitmapOptions[id])
27801
27820
  ];
27802
27821
  case 10:
27803
27822
  _tmp = _state.sent();
@@ -27808,7 +27827,7 @@ var seed$1 = 1;
27808
27827
  case 11:
27809
27828
  return [
27810
27829
  4,
27811
- loadWebPOptional(imageURL, webpURL)
27830
+ loadWebPOptional(imageURL, webpURL, _this.imageBitmapOptions[id])
27812
27831
  ];
27813
27832
  case 12:
27814
27833
  _tmp = _state.sent();
@@ -28020,6 +28039,21 @@ var seed$1 = 1;
28020
28039
  this.assets[images[i].id] = loadedImages[i];
28021
28040
  }
28022
28041
  };
28042
+ _proto.assignImageBitmapOptions = function assignImageBitmapOptions(textures) {
28043
+ var _this = this;
28044
+ if (textures === void 0) textures = [];
28045
+ textures.forEach(function(texture) {
28046
+ if (!(_instanceof1(texture, Texture) || "mipmaps" in texture)) {
28047
+ var source = texture.source;
28048
+ if (isObject(source)) {
28049
+ _this.imageBitmapOptions[source.id] = {
28050
+ imageOrientation: texture.flipY ? "flipY" : "none",
28051
+ premultiplyAlpha: texture.premultiplyAlpha ? "premultiply" : "none"
28052
+ };
28053
+ }
28054
+ }
28055
+ });
28056
+ };
28023
28057
  _proto.removeTimer = function removeTimer(id) {
28024
28058
  var index = this.timers.indexOf(id);
28025
28059
  if (index !== -1) {
@@ -28029,11 +28063,15 @@ var seed$1 = 1;
28029
28063
  /**
28030
28064
  * 销毁方法
28031
28065
  */ _proto.dispose = function dispose() {
28066
+ var _this = this;
28032
28067
  if (this.timers.length) {
28033
28068
  this.timers.map(function(id) {
28034
28069
  return window.clearTimeout(id);
28035
28070
  });
28036
28071
  }
28072
+ closeImageBitMap(Object.keys(this.assets).map(function(key) {
28073
+ return _this.assets[key];
28074
+ }));
28037
28075
  this.assets = {};
28038
28076
  this.sourceFrom = {};
28039
28077
  this.timers = [];
@@ -28050,7 +28088,7 @@ function createTextureOptionsBySource(image, sourceFrom, id) {
28050
28088
  };
28051
28089
  if (_instanceof1(image, Texture)) {
28052
28090
  return _extends({}, image.source, options);
28053
- } else if (_instanceof1(image, HTMLImageElement) || isCanvas(image)) {
28091
+ } else if (_instanceof1(image, HTMLImageElement) || _instanceof1(image, ImageBitmap) || isCanvas(image)) {
28054
28092
  return _extends({
28055
28093
  image: image,
28056
28094
  sourceType: TextureSourceType.image,
@@ -31383,7 +31421,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
31383
31421
  registerPlugin("particle", ParticleLoader, VFXItem, true);
31384
31422
  registerPlugin("cal", CalculateLoader, VFXItem, true);
31385
31423
  registerPlugin("interact", InteractLoader, VFXItem, true);
31386
- var version$1 = "2.1.5";
31424
+ var version$1 = "2.2.0-alpha.0";
31387
31425
  logger.info("Core version: " + version$1 + ".");
31388
31426
 
31389
31427
  var _obj;
@@ -33010,8 +33048,8 @@ setMaxSpriteMeshItemCount(8);
33010
33048
  */ Mesh.create = function(engine, props) {
33011
33049
  return new ThreeMesh(engine, props);
33012
33050
  };
33013
- var version = "2.1.5";
33051
+ var version = "2.2.0-alpha.0";
33014
33052
  logger.info("THREEJS plugin version: " + version + ".");
33015
33053
 
33016
- export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, Asset, AssetLoader, AssetManager, BYTES_TYPE_MAP, BaseRenderComponent, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, ColorCurve, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, DEFAULT_FPS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Engine, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatPropertyPlayableAsset, FloatPropertyTrack, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, MaterialTrack, Mesh, MeshCollider, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, PostProcessVolume, PropertyTrack, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TEXTURE_UNIFORM_MAP, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTextComponent, ThreeTexture, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, Vector4Curve, Vector4PropertyPlayableAsset, Vector4PropertyTrack, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, decimalEqual, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemFrameFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, setUniformValue, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
33054
+ export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, Asset, AssetLoader, AssetManager, BYTES_TYPE_MAP, BaseRenderComponent, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, ColorCurve, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, DEFAULT_FPS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Engine, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatPropertyPlayableAsset, FloatPropertyTrack, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, KTXTexture, LOAD_PREFER_IMAGE_BITMAP, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, MaterialTrack, Mesh, MeshCollider, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, ParticleTrack, PassTextureCache, PathSegments, PluginSystem, PostProcessVolume, PropertyTrack, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TEXTURE_UNIFORM_MAP, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTextComponent, ThreeTexture, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, Vector4Curve, Vector4PropertyPlayableAsset, Vector4PropertyTrack, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, closeImageBitMap, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, decimalEqual, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemFrameFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadImageBitmap, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, setUniformValue, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
33017
33055
  //# sourceMappingURL=index.mjs.map