@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.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime threejs plugin for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.1.5
6
+ * Version: v2.2.0-alpha.0
7
7
  */
8
8
 
9
9
  'use strict';
@@ -85,12 +85,8 @@ function __generator(thisArg, body) {
85
85
  },
86
86
  trys: [],
87
87
  ops: []
88
- }, f, y, t, g;
89
- return g = {
90
- next: verb(0),
91
- "throw": verb(1),
92
- "return": verb(2)
93
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
88
+ }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
89
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
94
90
  return this;
95
91
  }), g;
96
92
  function verb(n) {
@@ -5747,6 +5743,22 @@ exports.TextureSourceType = void 0;
5747
5743
  TextureSourceType[TextureSourceType["mipmaps"] = 7] = "mipmaps";
5748
5744
  })(exports.TextureSourceType || (exports.TextureSourceType = {}));
5749
5745
 
5746
+ var RUNTIME_ENV = "runtime_env";
5747
+ var RENDER_PREFER_LOOKUP_TEXTURE = "lookup_texture";
5748
+ // 文本元素使用 offscreen canvas 绘制
5749
+ var TEMPLATE_USE_OFFSCREEN_CANVAS = "offscreen_canvas";
5750
+ // 后处理配置相关
5751
+ var POST_PROCESS_SETTINGS = "post_process_settings";
5752
+ // 加载图片时是否使用 ImageBitmap
5753
+ var LOAD_PREFER_IMAGE_BITMAP = "load_image_bitmap";
5754
+ var config = {};
5755
+ function getConfig(name) {
5756
+ return config[name];
5757
+ }
5758
+ function setConfig(name, value) {
5759
+ return config[name] = value;
5760
+ }
5761
+
5750
5762
  /**
5751
5763
  * 负责下载各种资源,并提供了一些异步加载和缓存管理的功能
5752
5764
  */ var Downloader = /*#__PURE__*/ function() {
@@ -5835,11 +5847,11 @@ var avifFailed = false;
5835
5847
  * 异步加载一个 WebP 图片文件,如果不支持 WebP,则加载 PNG 图片文件
5836
5848
  * @param png - PNG 图片文件的 URL
5837
5849
  * @param webp - WebP 图片文件的 URL
5838
- */ function loadWebPOptional(png, webp) {
5850
+ */ function loadWebPOptional(png, webp, options) {
5839
5851
  return _loadWebPOptional.apply(this, arguments);
5840
5852
  }
5841
5853
  function _loadWebPOptional() {
5842
- _loadWebPOptional = _async_to_generator(function(png, webp) {
5854
+ _loadWebPOptional = _async_to_generator(function(png, webp, options) {
5843
5855
  var image, image1, image2;
5844
5856
  return __generator(this, function(_state) {
5845
5857
  switch(_state.label){
@@ -5850,7 +5862,7 @@ function _loadWebPOptional() {
5850
5862
  ];
5851
5863
  return [
5852
5864
  4,
5853
- loadImage(png)
5865
+ loadImageBitmap(png, options)
5854
5866
  ];
5855
5867
  case 1:
5856
5868
  image = _state.sent();
@@ -5870,7 +5882,7 @@ function _loadWebPOptional() {
5870
5882
  ]);
5871
5883
  return [
5872
5884
  4,
5873
- loadImage(webp)
5885
+ loadImageBitmap(webp, options)
5874
5886
  ];
5875
5887
  case 3:
5876
5888
  image1 = _state.sent();
@@ -5886,7 +5898,7 @@ function _loadWebPOptional() {
5886
5898
  webPFailed = true;
5887
5899
  return [
5888
5900
  4,
5889
- loadImage(png)
5901
+ loadImageBitmap(png, options)
5890
5902
  ];
5891
5903
  case 5:
5892
5904
  image2 = _state.sent();
@@ -5910,11 +5922,11 @@ function _loadWebPOptional() {
5910
5922
  * 异步加载一个 AVIF 图片文件,如果不支持 AVIF,则加载 PNG 图片文件
5911
5923
  * @param png - PNG 图片文件的 URL
5912
5924
  * @param avif - AVIF 图片文件的 URL
5913
- */ function loadAVIFOptional(png, avif) {
5925
+ */ function loadAVIFOptional(png, avif, options) {
5914
5926
  return _loadAVIFOptional.apply(this, arguments);
5915
5927
  }
5916
5928
  function _loadAVIFOptional() {
5917
- _loadAVIFOptional = _async_to_generator(function(png, avif) {
5929
+ _loadAVIFOptional = _async_to_generator(function(png, avif, options) {
5918
5930
  var image, image1, image2;
5919
5931
  return __generator(this, function(_state) {
5920
5932
  switch(_state.label){
@@ -5925,7 +5937,7 @@ function _loadAVIFOptional() {
5925
5937
  ];
5926
5938
  return [
5927
5939
  4,
5928
- loadImage(png)
5940
+ loadImageBitmap(png, options)
5929
5941
  ];
5930
5942
  case 1:
5931
5943
  image = _state.sent();
@@ -5945,7 +5957,7 @@ function _loadAVIFOptional() {
5945
5957
  ]);
5946
5958
  return [
5947
5959
  4,
5948
- loadImage(avif)
5960
+ loadImageBitmap(avif, options)
5949
5961
  ];
5950
5962
  case 3:
5951
5963
  image1 = _state.sent();
@@ -5961,7 +5973,7 @@ function _loadAVIFOptional() {
5961
5973
  avifFailed = true;
5962
5974
  return [
5963
5975
  4,
5964
- loadImage(png)
5976
+ loadImageBitmap(png, options)
5965
5977
  ];
5966
5978
  case 5:
5967
5979
  image2 = _state.sent();
@@ -6176,6 +6188,80 @@ function _loadMedia() {
6176
6188
  });
6177
6189
  return _loadMedia.apply(this, arguments);
6178
6190
  }
6191
+ var imageBitMapAvailable = typeof createImageBitmap === "function";
6192
+ /**
6193
+ * 异步加载一个图片文件,如果支持 ImageBitmap 则返回 ImageBitmap 对象
6194
+ * @param source
6195
+ * @param options
6196
+ * @returns
6197
+ */ function loadImageBitmap(source, options) {
6198
+ return _loadImageBitmap.apply(this, arguments);
6199
+ }
6200
+ function _loadImageBitmap() {
6201
+ _loadImageBitmap = _async_to_generator(function(source, options) {
6202
+ var blob;
6203
+ return __generator(this, function(_state) {
6204
+ switch(_state.label){
6205
+ case 0:
6206
+ if (!(imageBitMapAvailable && getConfig(LOAD_PREFER_IMAGE_BITMAP))) return [
6207
+ 3,
6208
+ 4
6209
+ ];
6210
+ if (!(typeof source === "string")) return [
6211
+ 3,
6212
+ 2
6213
+ ];
6214
+ return [
6215
+ 4,
6216
+ loadBlob(source)
6217
+ ];
6218
+ case 1:
6219
+ blob = _state.sent();
6220
+ return [
6221
+ 3,
6222
+ 3
6223
+ ];
6224
+ case 2:
6225
+ if (_instanceof1(source, Blob)) {
6226
+ blob = source;
6227
+ } else {
6228
+ return [
6229
+ 2,
6230
+ loadImage(source)
6231
+ ];
6232
+ }
6233
+ _state.label = 3;
6234
+ case 3:
6235
+ return [
6236
+ 2,
6237
+ createImageBitmap(blob, options)
6238
+ ];
6239
+ case 4:
6240
+ return [
6241
+ 2,
6242
+ loadImage(source)
6243
+ ];
6244
+ case 5:
6245
+ return [
6246
+ 2
6247
+ ];
6248
+ }
6249
+ });
6250
+ });
6251
+ return _loadImageBitmap.apply(this, arguments);
6252
+ }
6253
+ /**
6254
+ * 关闭 ImageBitMap,释放内存
6255
+ * @param imgs
6256
+ */ function closeImageBitMap(imgs) {
6257
+ if (imageBitMapAvailable) {
6258
+ if (_instanceof1(imgs, ImageBitmap)) {
6259
+ imgs.close();
6260
+ } else if (_instanceof1(imgs, Array)) {
6261
+ imgs.forEach(closeImageBitMap);
6262
+ }
6263
+ }
6264
+ }
6179
6265
 
6180
6266
  function deserializeMipmapTexture(textureOptions, bins, assets) {
6181
6267
  return _deserializeMipmapTexture.apply(this, arguments);
@@ -12778,8 +12864,8 @@ var BezierCurve = /*#__PURE__*/ function(ValueGetter) {
12778
12864
  return data;
12779
12865
  };
12780
12866
  _proto.getMaxTime = function getMaxTime() {
12781
- var keyTimeData = Object.keys(this.curveMap);
12782
- return Number(keyTimeData[keyTimeData.length - 1].split("&")[1]);
12867
+ var keyTimeData = this.keyTimeData;
12868
+ return this.curveMap[keyTimeData[keyTimeData.length - 1]].timeEnd;
12783
12869
  };
12784
12870
  return BezierCurve;
12785
12871
  }(ValueGetter);
@@ -12857,19 +12943,22 @@ var BezierCurvePath = /*#__PURE__*/ function(ValueGetter) {
12857
12943
  timeInterval: timeInterval,
12858
12944
  valueInterval: valueInterval,
12859
12945
  easingCurve: easingCurve,
12860
- pathCurve: pathCurve
12946
+ pathCurve: pathCurve,
12947
+ timeStart: Number(s.x),
12948
+ timeEnd: Number(e.x)
12861
12949
  };
12862
12950
  }
12951
+ this.keyTimeData = Object.keys(this.curveSegments);
12863
12952
  };
12864
12953
  _proto.getValue = function getValue(time) {
12865
12954
  var t = numberToFix(time, 5);
12866
12955
  var perc = 0, point = new Vector3();
12867
- var keyTimeData = Object.keys(this.curveSegments);
12956
+ var keyTimeData = this.keyTimeData;
12868
12957
  if (!keyTimeData.length) {
12869
12958
  return point;
12870
12959
  }
12871
- var keyTimeStart = Number(keyTimeData[0].split("&")[0]);
12872
- var keyTimeEnd = Number(keyTimeData[keyTimeData.length - 1].split("&")[1]);
12960
+ var keyTimeStart = this.curveSegments[keyTimeData[0]].timeStart;
12961
+ var keyTimeEnd = this.curveSegments[keyTimeData[keyTimeData.length - 1]].timeEnd;
12873
12962
  if (t <= keyTimeStart) {
12874
12963
  var pathCurve = this.curveSegments[keyTimeData[0]].pathCurve;
12875
12964
  point = pathCurve.getPointInPercent(0);
@@ -12881,7 +12970,8 @@ var BezierCurvePath = /*#__PURE__*/ function(ValueGetter) {
12881
12970
  return point;
12882
12971
  }
12883
12972
  for(var i = 0; i < keyTimeData.length; i++){
12884
- var _keyTimeData_i_split = keyTimeData[i].split("&"), xMin = _keyTimeData_i_split[0], xMax = _keyTimeData_i_split[1];
12973
+ var xMin = this.curveSegments[keyTimeData[i]].timeStart;
12974
+ var xMax = this.curveSegments[keyTimeData[i]].timeEnd;
12885
12975
  if (t >= Number(xMin) && t < Number(xMax)) {
12886
12976
  var bezierPath = this.curveSegments[keyTimeData[i]].pathCurve;
12887
12977
  perc = this.getPercValue(keyTimeData[i], t);
@@ -12900,8 +12990,8 @@ var BezierCurvePath = /*#__PURE__*/ function(ValueGetter) {
12900
12990
  return clamp$1(value, 0, 1);
12901
12991
  };
12902
12992
  _proto.getMaxTime = function getMaxTime() {
12903
- var keyTimeData = Object.keys(this.curveSegments);
12904
- return Number(keyTimeData[keyTimeData.length - 1].split("&")[1]);
12993
+ var keyTimeData = this.keyTimeData;
12994
+ return this.curveSegments[keyTimeData[keyTimeData.length - 1]].timeEnd;
12905
12995
  };
12906
12996
  return BezierCurvePath;
12907
12997
  }(ValueGetter);
@@ -13054,15 +13144,18 @@ function createKeyFrameMeta() {
13054
13144
  }
13055
13145
 
13056
13146
  function _is_native_reflect_construct() {
13057
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
13058
- if (Reflect.construct.sham) return false;
13059
- if (typeof Proxy === "function") return true;
13147
+ // Since Reflect.construct can't be properly polyfilled, some
13148
+ // implementations (e.g. core-js@2) don't set the correct internal slots.
13149
+ // Those polyfills don't allow us to subclass built-ins, so we need to
13150
+ // use our fallback implementation.
13060
13151
  try {
13061
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
13062
- return true;
13063
- } catch (e) {
13064
- return false;
13065
- }
13152
+ // If the internal slots aren't set, this throws an error similar to
13153
+ // TypeError: this is not a Boolean object.
13154
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
13155
+ } catch (_) {}
13156
+ return (_is_native_reflect_construct = function _is_native_reflect_construct() {
13157
+ return !!result;
13158
+ })();
13066
13159
  }
13067
13160
 
13068
13161
  function _construct(Parent, args, Class) {
@@ -15926,6 +16019,7 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
15926
16019
  if (this.animated) {
15927
16020
  this.buildPath(this.data);
15928
16021
  this.buildGeometryFromPath(this.path.shapePath);
16022
+ this.animated = false;
15929
16023
  }
15930
16024
  };
15931
16025
  _proto.buildGeometryFromPath = function buildGeometryFromPath(shapePath) {
@@ -17033,14 +17127,10 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17033
17127
  var playableOutput2 = _step2.value;
17034
17128
  this.processFrameWithRoot(playableOutput2);
17035
17129
  }
17036
- // 更新节点时间
17037
- for(var _iterator3 = _create_for_of_iterator_helper_loose(this.playables), _step3; !(_step3 = _iterator3()).done;){
17038
- var playable = _step3.value;
17039
- this.updatePlayableTime(playable, dt / 1000);
17040
- }
17041
- };
17042
- _proto.connect = function connect(source, sourceOutputPort, destination, destinationInputPort) {
17043
- destination.connectInput(destinationInputPort, source, sourceOutputPort);
17130
+ // 更新节点时间
17131
+ // for (const playable of this.playables) {
17132
+ // this.updatePlayableTime(playable, dt / 1000);
17133
+ // }
17044
17134
  };
17045
17135
  _proto.addOutput = function addOutput(output) {
17046
17136
  this.playableOutputs.push(output);
@@ -17049,12 +17139,12 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17049
17139
  this.playables.push(playable);
17050
17140
  };
17051
17141
  _proto.processFrameWithRoot = function processFrameWithRoot(output) {
17052
- output.sourcePlayable.processFrameRecursive(output.context, output.getSourceOutputPort());
17142
+ output.sourcePlayable.processFrame(output.context);
17053
17143
  output.processFrame();
17054
17144
  };
17055
17145
  _proto.prepareFrameWithRoot = function prepareFrameWithRoot(output) {
17056
- output.sourcePlayable.prepareFrameRecursive(output.context, output.getSourceOutputPort());
17057
17146
  output.prepareFrame();
17147
+ output.sourcePlayable.prepareFrame(output.context);
17058
17148
  };
17059
17149
  _proto.updatePlayableTime = function updatePlayableTime(playable, deltaTime) {
17060
17150
  if (playable.getPlayState() !== 0) {
@@ -17069,24 +17159,15 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17069
17159
  * @since 2.0.0
17070
17160
  */ var Playable = /*#__PURE__*/ function() {
17071
17161
  function Playable(graph, inputCount) {
17072
- if (inputCount === void 0) inputCount = 0;
17073
17162
  this.onPlayablePlayFlag = true;
17074
17163
  this.onPlayablePauseFlag = false;
17075
17164
  this.duration = 0;
17076
17165
  this.destroyed = false;
17077
- this.inputs = [];
17078
- this.inputOuputPorts = [];
17079
- this.inputWeight = [];
17080
- this.outputs = [];
17081
17166
  this.playState = 0;
17082
- this.traversalMode = 0;
17083
17167
  /**
17084
17168
  * 当前本地播放的时间
17085
17169
  */ this.time = 0;
17086
17170
  graph.addPlayable(this);
17087
- this.inputs = new Array(inputCount);
17088
- this.inputOuputPorts = new Array(inputCount);
17089
- this.inputWeight = new Array(inputCount);
17090
17171
  }
17091
17172
  var _proto = Playable.prototype;
17092
17173
  _proto.play = function play() {
@@ -17109,56 +17190,6 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17109
17190
  break;
17110
17191
  }
17111
17192
  };
17112
- _proto.connectInput = function connectInput(inputPort, sourcePlayable, sourceOutputPort, weight) {
17113
- if (weight === void 0) weight = 1.0;
17114
- this.setInput(sourcePlayable, inputPort);
17115
- this.setInputWeight(inputPort, weight);
17116
- sourcePlayable.setOutput(this, sourceOutputPort);
17117
- if (this.inputOuputPorts.length < inputPort + 1) {
17118
- this.inputOuputPorts.length = inputPort + 1;
17119
- }
17120
- this.inputOuputPorts[inputPort] = sourceOutputPort;
17121
- };
17122
- _proto.addInput = function addInput(sourcePlayable, sourceOutputPort, weight) {
17123
- if (weight === void 0) weight = 1.0;
17124
- this.connectInput(this.getInputCount(), sourcePlayable, sourceOutputPort, weight);
17125
- };
17126
- _proto.getInputCount = function getInputCount() {
17127
- return this.inputs.length;
17128
- };
17129
- _proto.getInputs = function getInputs() {
17130
- return this.inputs;
17131
- };
17132
- _proto.getInput = function getInput(index) {
17133
- return this.inputs[index];
17134
- };
17135
- _proto.getOutputCount = function getOutputCount() {
17136
- return this.outputs.length;
17137
- };
17138
- _proto.getOutputs = function getOutputs() {
17139
- return this.outputs;
17140
- };
17141
- _proto.getOutput = function getOutput(index) {
17142
- return this.outputs[index];
17143
- };
17144
- _proto.getInputWeight = function getInputWeight(inputIndex) {
17145
- return this.inputWeight[inputIndex];
17146
- };
17147
- _proto.setInputWeight = function setInputWeight(playableOrIndex, weight) {
17148
- if (_instanceof1(playableOrIndex, Playable)) {
17149
- for(var i = 0; i < this.inputs.length; i++){
17150
- if (this.inputs[i] === playableOrIndex) {
17151
- this.inputWeight[i] = weight;
17152
- return;
17153
- }
17154
- }
17155
- } else {
17156
- if (this.inputWeight.length < playableOrIndex + 1) {
17157
- this.inputWeight.length = playableOrIndex + 1;
17158
- }
17159
- this.inputWeight[playableOrIndex] = weight;
17160
- }
17161
- };
17162
17193
  _proto.setTime = function setTime(time) {
17163
17194
  this.time = time;
17164
17195
  };
@@ -17174,18 +17205,14 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17174
17205
  _proto.getPlayState = function getPlayState() {
17175
17206
  return this.playState;
17176
17207
  };
17177
- _proto.setTraversalMode = function setTraversalMode(mode) {
17178
- this.traversalMode = mode;
17179
- };
17180
- _proto.getTraversalMode = function getTraversalMode() {
17181
- return this.traversalMode;
17182
- };
17183
17208
  // onGraphStart () {
17184
17209
  // }
17185
17210
  // onGraphStop () {
17186
17211
  // }
17187
- _proto.onPlayablePlay = function onPlayablePlay(context) {};
17188
- _proto.onPlayablePause = function onPlayablePause(context) {};
17212
+ // onPlayablePlay (context: FrameContext) {
17213
+ // }
17214
+ // onPlayablePause (context: FrameContext) {
17215
+ // }
17189
17216
  _proto.prepareFrame = function prepareFrame(context) {};
17190
17217
  _proto.processFrame = function processFrame(context) {};
17191
17218
  _proto.onPlayableDestroy = function onPlayableDestroy() {};
@@ -17197,76 +17224,6 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17197
17224
  // TODO 将节点从动画图中移除
17198
17225
  this.destroyed = true;
17199
17226
  };
17200
- /**
17201
- * @internal
17202
- */ _proto.prepareFrameRecursive = function prepareFrameRecursive(context, passthroughPort) {
17203
- if (this.destroyed || this.playState !== 0) {
17204
- return;
17205
- }
17206
- if (this.onPlayablePlayFlag) {
17207
- this.onPlayablePlay(context);
17208
- this.onPlayablePlayFlag = false;
17209
- }
17210
- if (this.onPlayablePauseFlag) {
17211
- this.onPlayablePause(context);
17212
- this.onPlayablePauseFlag = false;
17213
- }
17214
- if (passthroughPort === 0) {
17215
- this.prepareFrame(context);
17216
- }
17217
- // 前序遍历,用于设置节点的初始状态,weight etc.
17218
- switch(this.getTraversalMode()){
17219
- case 0:
17220
- for(var i = 0; i < this.getInputCount(); i++){
17221
- var input = this.getInput(i);
17222
- input.prepareFrameRecursive(context, this.inputOuputPorts[i]);
17223
- }
17224
- break;
17225
- case 1:
17226
- {
17227
- var input1 = this.getInput(passthroughPort);
17228
- input1.prepareFrameRecursive(context, this.inputOuputPorts[passthroughPort]);
17229
- break;
17230
- }
17231
- }
17232
- };
17233
- /**
17234
- * @internal
17235
- */ _proto.processFrameRecursive = function processFrameRecursive(context, passthroughPort) {
17236
- if (this.destroyed || this.playState !== 0) {
17237
- return;
17238
- }
17239
- // 后序遍历,保证 playable 拿到的 input 节点的估计数据是最新的
17240
- switch(this.getTraversalMode()){
17241
- case 0:
17242
- {
17243
- for(var i = 0; i < this.getInputCount(); i++){
17244
- var input = this.getInput(i);
17245
- input.processFrameRecursive(context, this.inputOuputPorts[i]);
17246
- }
17247
- break;
17248
- }
17249
- case 1:
17250
- {
17251
- var input1 = this.getInput(passthroughPort);
17252
- input1.processFrameRecursive(context, this.inputOuputPorts[passthroughPort]);
17253
- break;
17254
- }
17255
- }
17256
- this.processFrame(context);
17257
- };
17258
- _proto.setOutput = function setOutput(outputPlayable, outputPort) {
17259
- if (this.outputs.length < outputPort + 1) {
17260
- this.outputs.length = outputPort + 1;
17261
- }
17262
- this.outputs[outputPort] = outputPlayable;
17263
- };
17264
- _proto.setInput = function setInput(inputPlayable, inputPort) {
17265
- if (this.inputs.length < inputPort + 1) {
17266
- this.inputs.length = inputPort + 1;
17267
- }
17268
- this.inputs[inputPort] = inputPlayable;
17269
- };
17270
17227
  return Playable;
17271
17228
  }();
17272
17229
  /**
@@ -17274,20 +17231,14 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17274
17231
  * @since 2.0.0
17275
17232
  */ var PlayableOutput = /*#__PURE__*/ function() {
17276
17233
  function PlayableOutput() {
17277
- this.sourceOutputPort = 0;
17278
17234
  this.context = {
17279
17235
  deltaTime: 0,
17280
17236
  output: this
17281
17237
  };
17282
17238
  }
17283
17239
  var _proto = PlayableOutput.prototype;
17284
- _proto.setSourcePlayable = function setSourcePlayable(playable, port) {
17285
- if (port === void 0) port = 0;
17240
+ _proto.setSourcePlayable = function setSourcePlayable(playable) {
17286
17241
  this.sourcePlayable = playable;
17287
- this.sourceOutputPort = port;
17288
- };
17289
- _proto.getSourceOutputPort = function getSourceOutputPort() {
17290
- return this.sourceOutputPort;
17291
17242
  };
17292
17243
  _proto.setUserData = function setUserData(value) {
17293
17244
  this.userData = value;
@@ -17313,11 +17264,6 @@ var PlayState;
17313
17264
  PlayState[PlayState["Playing"] = 0] = "Playing";
17314
17265
  PlayState[PlayState["Paused"] = 1] = "Paused";
17315
17266
  })(PlayState || (PlayState = {}));
17316
- var PlayableTraversalMode;
17317
- (function(PlayableTraversalMode) {
17318
- PlayableTraversalMode[PlayableTraversalMode["Mix"] = 0] = "Mix";
17319
- PlayableTraversalMode[PlayableTraversalMode["Passthrough"] = 1] = "Passthrough";
17320
- })(PlayableTraversalMode || (PlayableTraversalMode = {}));
17321
17267
 
17322
17268
  var tempQuat$1 = new Quaternion();
17323
17269
  var seed$4 = 1;
@@ -18884,20 +18830,6 @@ exports.SpriteComponent = __decorate([
18884
18830
  effectsClass(DataType.SpriteComponent)
18885
18831
  ], exports.SpriteComponent);
18886
18832
 
18887
- var RUNTIME_ENV = "runtime_env";
18888
- var RENDER_PREFER_LOOKUP_TEXTURE = "lookup_texture";
18889
- // 文本元素使用 offscreen canvas 绘制
18890
- var TEMPLATE_USE_OFFSCREEN_CANVAS = "offscreen_canvas";
18891
- // 后处理配置相关
18892
- var POST_PROCESS_SETTINGS = "post_process_settings";
18893
- var config = {};
18894
- function getConfig(name) {
18895
- return config[name];
18896
- }
18897
- function setConfig(name, value) {
18898
- return config[name] = value;
18899
- }
18900
-
18901
18833
  var Cone = /*#__PURE__*/ function() {
18902
18834
  function Cone(props) {
18903
18835
  var _this = this;
@@ -22822,12 +22754,6 @@ var AnimationStream = /*#__PURE__*/ function() {
22822
22754
  _proto.findCurveValue = function findCurveValue(componentType, propertyName) {
22823
22755
  return this.curveValues[componentType + propertyName];
22824
22756
  };
22825
- _proto.getInputStream = function getInputStream(index) {
22826
- var inputPlayable = this.playable.getInput(index);
22827
- if (_instanceof1(inputPlayable, AnimationPlayable)) {
22828
- return inputPlayable.animationStream;
22829
- }
22830
- };
22831
22757
  return AnimationStream;
22832
22758
  }();
22833
22759
 
@@ -23162,214 +23088,65 @@ var AnimationClipPlayable = /*#__PURE__*/ function(Playable) {
23162
23088
  return AnimationClipPlayable;
23163
23089
  }(Playable);
23164
23090
 
23165
- /**
23166
- * @since 2.0.0
23167
- */ var TimelineClip = /*#__PURE__*/ function() {
23168
- function TimelineClip() {
23169
- this.start = 0;
23170
- this.duration = 0;
23171
- }
23172
- var _proto = TimelineClip.prototype;
23173
- _proto.toLocalTime = function toLocalTime(time) {
23174
- var localTime = time - this.start;
23175
- var duration = this.duration;
23176
- if (localTime - duration > 0) {
23177
- if (this.endBehavior === EndBehavior.restart) {
23178
- localTime = localTime % duration;
23179
- } else if (this.endBehavior === EndBehavior.freeze) {
23180
- localTime = Math.min(duration, localTime);
23181
- }
23182
- }
23183
- return localTime;
23184
- };
23185
- return TimelineClip;
23186
- }();
23187
- exports.TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
23188
- _inherits(TrackAsset, PlayableAsset);
23189
- function TrackAsset() {
23091
+ var TrackMixerPlayable = /*#__PURE__*/ function(Playable1) {
23092
+ _inherits(TrackMixerPlayable, Playable1);
23093
+ function TrackMixerPlayable() {
23190
23094
  var _this;
23191
- _this = PlayableAsset.apply(this, arguments) || this;
23192
- _this.trackType = 0;
23193
- _this.clipSeed = 0;
23194
- _this.clips = [];
23195
- _this.children = [];
23095
+ _this = Playable1.apply(this, arguments) || this;
23096
+ _this.clipPlayables = [];
23097
+ _this.clipWeights = [];
23196
23098
  return _this;
23197
23099
  }
23198
- var _proto = TrackAsset.prototype;
23199
- /**
23200
- * 重写该方法以获取自定义对象绑定
23201
- */ _proto.updateAnimatedObject = function updateAnimatedObject() {
23202
- if (this.parent) {
23203
- this.boundObject = this.parent.boundObject;
23204
- }
23205
- };
23206
- /**
23207
- * 重写该方法以创建自定义混合器
23208
- */ _proto.createTrackMixer = function createTrackMixer(graph) {
23209
- return new Playable(graph);
23210
- };
23211
- _proto.createOutput = function createOutput() {
23212
- var output = new PlayableOutput();
23213
- return output;
23214
- };
23215
- _proto.createPlayableGraph = function createPlayableGraph(graph, runtimeClips) {
23216
- var mixerPlayable = this.createMixerPlayableGraph(graph, runtimeClips);
23217
- return mixerPlayable;
23218
- };
23219
- _proto.createMixerPlayableGraph = function createMixerPlayableGraph(graph, runtimeClips) {
23220
- var clips = [];
23221
- for(var _iterator = _create_for_of_iterator_helper_loose(this.clips), _step; !(_step = _iterator()).done;){
23222
- var clip = _step.value;
23223
- clips.push(clip);
23224
- }
23225
- var mixerPlayable = this.compileClips(graph, clips, runtimeClips);
23226
- return mixerPlayable;
23227
- };
23228
- _proto.compileClips = function compileClips(graph, timelineClips, runtimeClips) {
23229
- var mixer = this.createTrackMixer(graph);
23230
- for(var _iterator = _create_for_of_iterator_helper_loose(timelineClips), _step; !(_step = _iterator()).done;){
23231
- var timelineClip = _step.value;
23232
- var clipPlayable = this.createClipPlayable(graph, timelineClip);
23233
- clipPlayable.setDuration(timelineClip.duration);
23234
- var clip = new RuntimeClip(timelineClip, clipPlayable, mixer, this);
23235
- runtimeClips.push(clip);
23236
- mixer.addInput(clipPlayable, 0);
23237
- mixer.setInputWeight(clipPlayable, 0.0);
23100
+ var _proto = TrackMixerPlayable.prototype;
23101
+ _proto.processFrame = function processFrame(context) {
23102
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.clipPlayables), _step; !(_step = _iterator()).done;){
23103
+ var clipPlayable = _step.value;
23104
+ clipPlayable.processFrame(context);
23238
23105
  }
23239
- return mixer;
23106
+ this.evaluate(context);
23240
23107
  };
23241
- _proto.createPlayable = function createPlayable(graph) {
23242
- return new Playable(graph);
23243
- };
23244
- _proto.getChildTracks = function getChildTracks() {
23245
- return this.children;
23246
- };
23247
- _proto.addChild = function addChild(child) {
23248
- this.children.push(child);
23249
- child.parent = this;
23250
- };
23251
- _proto.createClip = function createClip(classConstructor, name) {
23252
- var newClip = new TimelineClip();
23253
- newClip.asset = new classConstructor(this.engine);
23254
- newClip.name = name ? name : "TimelineClip" + newClip.id;
23255
- this.addClip(newClip);
23256
- return newClip;
23257
- };
23258
- _proto.getClips = function getClips() {
23259
- return this.clips;
23260
- };
23261
- _proto.findClip = function findClip(name) {
23262
- for(var _iterator = _create_for_of_iterator_helper_loose(this.clips), _step; !(_step = _iterator()).done;){
23263
- var clip = _step.value;
23264
- if (clip.name === name) {
23265
- return clip;
23108
+ _proto.setClipWeight = function setClipWeight(playableOrIndex, weight) {
23109
+ if (_instanceof1(playableOrIndex, Playable)) {
23110
+ for(var i = 0; i < this.clipPlayables.length; i++){
23111
+ if (this.clipPlayables[i] === playableOrIndex) {
23112
+ this.clipWeights[i] = weight;
23113
+ return;
23114
+ }
23115
+ }
23116
+ } else {
23117
+ if (this.clipWeights.length < playableOrIndex + 1) {
23118
+ this.clipWeights.length = playableOrIndex + 1;
23266
23119
  }
23120
+ this.clipWeights[playableOrIndex] = weight;
23267
23121
  }
23268
23122
  };
23269
- _proto.addClip = function addClip(clip) {
23270
- clip.id = (this.clipSeed++).toString();
23271
- this.clips.push(clip);
23123
+ _proto.getClipWeight = function getClipWeight(inputIndex) {
23124
+ return this.clipWeights[inputIndex];
23272
23125
  };
23273
- _proto.createClipPlayable = function createClipPlayable(graph, clip) {
23274
- return clip.asset.createPlayable(graph);
23126
+ _proto.getClipPlayable = function getClipPlayable(index) {
23127
+ return this.clipPlayables[index];
23275
23128
  };
23276
- _proto.fromData = function fromData(data) {
23277
- PlayableAsset.prototype.fromData.call(this, data);
23278
- for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
23279
- var child = _step.value;
23280
- child.parent = this;
23281
- }
23282
- };
23283
- return TrackAsset;
23284
- }(PlayableAsset);
23285
- __decorate([
23286
- serialize(TimelineClip)
23287
- ], exports.TrackAsset.prototype, "clips", void 0);
23288
- __decorate([
23289
- serialize()
23290
- ], exports.TrackAsset.prototype, "children", void 0);
23291
- exports.TrackAsset = __decorate([
23292
- effectsClass(DataType.TrackAsset)
23293
- ], exports.TrackAsset);
23294
- exports.TrackType = void 0;
23295
- (function(TrackType) {
23296
- TrackType[TrackType["MasterTrack"] = 0] = "MasterTrack";
23297
- TrackType[TrackType["ObjectTrack"] = 1] = "ObjectTrack";
23298
- })(exports.TrackType || (exports.TrackType = {}));
23299
- var RuntimeClip = /*#__PURE__*/ function() {
23300
- function RuntimeClip(clip, clipPlayable, parentMixer, track) {
23301
- this.clip = clip;
23302
- this.playable = clipPlayable;
23303
- this.parentMixer = parentMixer;
23304
- this.track = track;
23305
- if (_instanceof1(this.track.boundObject, exports.VFXItem)) {
23306
- this.particleSystem = this.track.boundObject.getComponent(exports.ParticleSystem);
23307
- }
23308
- }
23309
- var _proto = RuntimeClip.prototype;
23310
- _proto.evaluateAt = function evaluateAt(localTime) {
23311
- var clip = this.clip;
23312
- var weight = 1.0;
23313
- var ended = false;
23314
- var started = false;
23315
- var boundObject = this.track.boundObject;
23316
- if (localTime >= clip.start + clip.duration && clip.endBehavior === EndBehavior.destroy) {
23317
- if (_instanceof1(boundObject, exports.VFXItem) && exports.VFXItem.isParticle(boundObject) && this.particleSystem && !this.particleSystem.destroyed) {
23318
- weight = 1.0;
23319
- } else {
23320
- weight = 0.0;
23321
- ended = true;
23322
- }
23323
- } else if (localTime - this.clip.start >= 0) {
23324
- weight = 1.0;
23325
- started = true;
23326
- } else if (localTime < clip.start) {
23327
- weight = 0.0;
23328
- }
23329
- if (started && this.playable.getPlayState() !== PlayState.Playing) {
23330
- this.playable.play();
23331
- }
23332
- this.parentMixer.setInputWeight(this.playable, weight);
23333
- var clipTime = parseFloat(clip.toLocalTime(localTime).toFixed(3));
23334
- this.playable.setTime(clipTime);
23335
- // 判断动画是否结束
23336
- if (ended) {
23337
- if (this.playable.getPlayState() === PlayState.Playing) {
23338
- this.playable.pause();
23339
- }
23340
- }
23129
+ _proto.evaluate = function evaluate(context) {
23130
+ // Override
23341
23131
  };
23342
- _create_class(RuntimeClip, [
23343
- {
23344
- key: "enable",
23345
- set: function set(value) {
23346
- if (value) {
23347
- this.playable.play();
23348
- } else {
23349
- this.parentMixer.setInputWeight(this.playable, 0);
23350
- this.playable.pause();
23351
- }
23352
- }
23353
- }
23354
- ]);
23355
- return RuntimeClip;
23356
- }();
23132
+ return TrackMixerPlayable;
23133
+ }(Playable);
23357
23134
 
23358
- var ActivationMixerPlayable = /*#__PURE__*/ function(Playable) {
23359
- _inherits(ActivationMixerPlayable, Playable);
23135
+ var ActivationMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
23136
+ _inherits(ActivationMixerPlayable, TrackMixerPlayable);
23360
23137
  function ActivationMixerPlayable() {
23361
- return Playable.apply(this, arguments);
23138
+ return TrackMixerPlayable.apply(this, arguments);
23362
23139
  }
23363
23140
  var _proto = ActivationMixerPlayable.prototype;
23364
- _proto.processFrame = function processFrame(context) {
23141
+ _proto.evaluate = function evaluate(context) {
23365
23142
  var boundObject = context.output.getUserData();
23366
23143
  if (!_instanceof1(boundObject, exports.VFXItem)) {
23367
23144
  return;
23368
23145
  }
23369
23146
  var boundItem = boundObject;
23370
23147
  var hasInput = false;
23371
- for(var i = 0; i < this.getInputCount(); i++){
23372
- if (this.getInputWeight(i) > 0) {
23148
+ for(var i = 0; i < this.clipPlayables.length; i++){
23149
+ if (this.getClipWeight(i) > 0) {
23373
23150
  hasInput = true;
23374
23151
  break;
23375
23152
  }
@@ -23383,22 +23160,7 @@ var ActivationMixerPlayable = /*#__PURE__*/ function(Playable) {
23383
23160
  }
23384
23161
  };
23385
23162
  return ActivationMixerPlayable;
23386
- }(Playable);
23387
-
23388
- exports.ActivationTrack = /*#__PURE__*/ function(TrackAsset) {
23389
- _inherits(ActivationTrack, TrackAsset);
23390
- function ActivationTrack() {
23391
- return TrackAsset.apply(this, arguments);
23392
- }
23393
- var _proto = ActivationTrack.prototype;
23394
- _proto.createTrackMixer = function createTrackMixer(graph) {
23395
- return new ActivationMixerPlayable(graph);
23396
- };
23397
- return ActivationTrack;
23398
- }(exports.TrackAsset);
23399
- exports.ActivationTrack = __decorate([
23400
- effectsClass(DataType.ActivationTrack)
23401
- ], exports.ActivationTrack);
23163
+ }(TrackMixerPlayable);
23402
23164
 
23403
23165
  var PropertyClipPlayable = /*#__PURE__*/ function(Playable) {
23404
23166
  _inherits(PropertyClipPlayable, Playable);
@@ -23412,16 +23174,61 @@ var PropertyClipPlayable = /*#__PURE__*/ function(Playable) {
23412
23174
  return PropertyClipPlayable;
23413
23175
  }(Playable);
23414
23176
 
23415
- var FloatPropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
23416
- _inherits(FloatPropertyMixerPlayable, Playable);
23177
+ var ColorPropertyMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
23178
+ _inherits(ColorPropertyMixerPlayable, TrackMixerPlayable);
23179
+ function ColorPropertyMixerPlayable() {
23180
+ var _this;
23181
+ _this = TrackMixerPlayable.apply(this, arguments) || this;
23182
+ _this.propertyName = "";
23183
+ return _this;
23184
+ }
23185
+ var _proto = ColorPropertyMixerPlayable.prototype;
23186
+ _proto.evaluate = function evaluate(context) {
23187
+ var boundObject = context.output.getUserData();
23188
+ if (!boundObject) {
23189
+ return;
23190
+ }
23191
+ var hasInput = false;
23192
+ var value = boundObject[this.propertyName];
23193
+ if (!_instanceof1(value, Color)) {
23194
+ return;
23195
+ }
23196
+ value.setZero();
23197
+ // evaluate the curve
23198
+ for(var i = 0; i < this.clipPlayables.length; i++){
23199
+ var weight = this.getClipWeight(i);
23200
+ if (weight > 0) {
23201
+ var propertyClipPlayable = this.getClipPlayable(i);
23202
+ if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
23203
+ console.error("ColorPropertyMixerPlayable received incompatible input");
23204
+ continue;
23205
+ }
23206
+ var curveValue = propertyClipPlayable.value;
23207
+ value.r += curveValue.r * weight;
23208
+ value.g += curveValue.g * weight;
23209
+ value.b += curveValue.b * weight;
23210
+ value.a += curveValue.a * weight;
23211
+ hasInput = true;
23212
+ }
23213
+ }
23214
+ // set value
23215
+ if (hasInput) {
23216
+ boundObject[this.propertyName] = value;
23217
+ }
23218
+ };
23219
+ return ColorPropertyMixerPlayable;
23220
+ }(TrackMixerPlayable);
23221
+
23222
+ var FloatPropertyMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
23223
+ _inherits(FloatPropertyMixerPlayable, TrackMixerPlayable);
23417
23224
  function FloatPropertyMixerPlayable() {
23418
23225
  var _this;
23419
- _this = Playable.apply(this, arguments) || this;
23226
+ _this = TrackMixerPlayable.apply(this, arguments) || this;
23420
23227
  _this.propertyName = "";
23421
23228
  return _this;
23422
23229
  }
23423
23230
  var _proto = FloatPropertyMixerPlayable.prototype;
23424
- _proto.processFrame = function processFrame(context) {
23231
+ _proto.evaluate = function evaluate(context) {
23425
23232
  var boundObject = context.output.getUserData();
23426
23233
  if (!boundObject) {
23427
23234
  return;
@@ -23429,10 +23236,10 @@ var FloatPropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
23429
23236
  var hasInput = false;
23430
23237
  var value = 0;
23431
23238
  // evaluate the curve
23432
- for(var i = 0; i < this.getInputCount(); i++){
23433
- var weight = this.getInputWeight(i);
23239
+ for(var i = 0; i < this.clipPlayables.length; i++){
23240
+ var weight = this.getClipWeight(i);
23434
23241
  if (weight > 0) {
23435
- var propertyClipPlayable = this.getInput(i);
23242
+ var propertyClipPlayable = this.getClipPlayable(i);
23436
23243
  if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
23437
23244
  console.error("FloatPropertyTrack added non-FloatPropertyPlayableAsset");
23438
23245
  continue;
@@ -23448,7 +23255,27 @@ var FloatPropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
23448
23255
  }
23449
23256
  };
23450
23257
  return FloatPropertyMixerPlayable;
23451
- }(Playable);
23258
+ }(TrackMixerPlayable);
23259
+
23260
+ var ParticleMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
23261
+ _inherits(ParticleMixerPlayable, TrackMixerPlayable);
23262
+ function ParticleMixerPlayable() {
23263
+ return TrackMixerPlayable.apply(this, arguments);
23264
+ }
23265
+ var _proto = ParticleMixerPlayable.prototype;
23266
+ _proto.evaluate = function evaluate(context) {};
23267
+ return ParticleMixerPlayable;
23268
+ }(TrackMixerPlayable);
23269
+
23270
+ var SpriteColorMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
23271
+ _inherits(SpriteColorMixerPlayable, TrackMixerPlayable);
23272
+ function SpriteColorMixerPlayable() {
23273
+ return TrackMixerPlayable.apply(this, arguments);
23274
+ }
23275
+ var _proto = SpriteColorMixerPlayable.prototype;
23276
+ _proto.evaluate = function evaluate(context) {};
23277
+ return SpriteColorMixerPlayable;
23278
+ }(TrackMixerPlayable);
23452
23279
 
23453
23280
  var SerializationHelper = /*#__PURE__*/ function() {
23454
23281
  function SerializationHelper() {}
@@ -23940,7 +23767,8 @@ var SerializationHelper = /*#__PURE__*/ function() {
23940
23767
  this.timelinePlayable.setTime(time);
23941
23768
  // The properties of the object may change dynamically,
23942
23769
  // so reset the track binding to avoid invalidation of the previously obtained binding object.
23943
- this.resolveBindings();
23770
+ // this.resolveBindings();
23771
+ this.timelinePlayable.evaluate();
23944
23772
  this.graph.evaluate(dt);
23945
23773
  };
23946
23774
  _proto.createContent = function createContent() {
@@ -24119,21 +23947,21 @@ var SubCompositionClipPlayable = /*#__PURE__*/ function(Playable) {
24119
23947
  return SubCompositionClipPlayable;
24120
23948
  }(Playable);
24121
23949
 
24122
- var SubCompositionMixerPlayable = /*#__PURE__*/ function(Playable) {
24123
- _inherits(SubCompositionMixerPlayable, Playable);
23950
+ var SubCompositionMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
23951
+ _inherits(SubCompositionMixerPlayable, TrackMixerPlayable);
24124
23952
  function SubCompositionMixerPlayable() {
24125
- return Playable.apply(this, arguments);
23953
+ return TrackMixerPlayable.apply(this, arguments);
24126
23954
  }
24127
23955
  var _proto = SubCompositionMixerPlayable.prototype;
24128
- _proto.processFrame = function processFrame(context) {
23956
+ _proto.evaluate = function evaluate(context) {
24129
23957
  var boundObject = context.output.getUserData();
24130
23958
  if (!_instanceof1(boundObject, CompositionComponent)) {
24131
23959
  return;
24132
23960
  }
24133
23961
  var compositionComponent = boundObject;
24134
23962
  var hasInput = false;
24135
- for(var i = 0; i < this.getInputCount(); i++){
24136
- if (this.getInputWeight(i) > 0) {
23963
+ for(var i = 0; i < this.clipPlayables.length; i++){
23964
+ if (this.getClipWeight(i) > 0) {
24137
23965
  hasInput = true;
24138
23966
  break;
24139
23967
  }
@@ -24145,18 +23973,28 @@ var SubCompositionMixerPlayable = /*#__PURE__*/ function(Playable) {
24145
23973
  }
24146
23974
  };
24147
23975
  return SubCompositionMixerPlayable;
24148
- }(Playable);
23976
+ }(TrackMixerPlayable);
24149
23977
 
24150
- var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
24151
- _inherits(Vector4PropertyMixerPlayable, Playable);
23978
+ var TransformMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
23979
+ _inherits(TransformMixerPlayable, TrackMixerPlayable);
23980
+ function TransformMixerPlayable() {
23981
+ return TrackMixerPlayable.apply(this, arguments);
23982
+ }
23983
+ var _proto = TransformMixerPlayable.prototype;
23984
+ _proto.evaluate = function evaluate(context) {};
23985
+ return TransformMixerPlayable;
23986
+ }(TrackMixerPlayable);
23987
+
23988
+ var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
23989
+ _inherits(Vector4PropertyMixerPlayable, TrackMixerPlayable);
24152
23990
  function Vector4PropertyMixerPlayable() {
24153
23991
  var _this;
24154
- _this = Playable.apply(this, arguments) || this;
23992
+ _this = TrackMixerPlayable.apply(this, arguments) || this;
24155
23993
  _this.propertyName = "";
24156
23994
  return _this;
24157
23995
  }
24158
23996
  var _proto = Vector4PropertyMixerPlayable.prototype;
24159
- _proto.processFrame = function processFrame(context) {
23997
+ _proto.evaluate = function evaluate(context) {
24160
23998
  var boundObject = context.output.getUserData();
24161
23999
  if (!boundObject) {
24162
24000
  return;
@@ -24168,10 +24006,10 @@ var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
24168
24006
  }
24169
24007
  value.setZero();
24170
24008
  // evaluate the curve
24171
- for(var i = 0; i < this.getInputCount(); i++){
24172
- var weight = this.getInputWeight(i);
24009
+ for(var i = 0; i < this.clipPlayables.length; i++){
24010
+ var weight = this.getClipWeight(i);
24173
24011
  if (weight > 0) {
24174
- var propertyClipPlayable = this.getInput(i);
24012
+ var propertyClipPlayable = this.getClipPlayable(i);
24175
24013
  if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
24176
24014
  console.error("Vector4PropertyTrack added non-Vector4PropertyPlayableAsset");
24177
24015
  continue;
@@ -24190,52 +24028,215 @@ var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
24190
24028
  }
24191
24029
  };
24192
24030
  return Vector4PropertyMixerPlayable;
24193
- }(Playable);
24031
+ }(TrackMixerPlayable);
24194
24032
 
24195
- var ColorPropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
24196
- _inherits(ColorPropertyMixerPlayable, Playable);
24197
- function ColorPropertyMixerPlayable() {
24033
+ /**
24034
+ * @since 2.0.0
24035
+ */ var TimelineClip = /*#__PURE__*/ function() {
24036
+ function TimelineClip() {
24037
+ this.start = 0;
24038
+ this.duration = 0;
24039
+ }
24040
+ var _proto = TimelineClip.prototype;
24041
+ _proto.toLocalTime = function toLocalTime(time) {
24042
+ var localTime = time - this.start;
24043
+ var duration = this.duration;
24044
+ if (localTime - duration > 0) {
24045
+ if (this.endBehavior === EndBehavior.restart) {
24046
+ localTime = localTime % duration;
24047
+ } else if (this.endBehavior === EndBehavior.freeze) {
24048
+ localTime = Math.min(duration, localTime);
24049
+ }
24050
+ }
24051
+ return localTime;
24052
+ };
24053
+ return TimelineClip;
24054
+ }();
24055
+ exports.TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
24056
+ _inherits(TrackAsset, PlayableAsset);
24057
+ function TrackAsset() {
24198
24058
  var _this;
24199
- _this = Playable.apply(this, arguments) || this;
24200
- _this.propertyName = "";
24059
+ _this = PlayableAsset.apply(this, arguments) || this;
24060
+ _this.trackType = 0;
24061
+ _this.clipSeed = 0;
24062
+ _this.clips = [];
24063
+ _this.children = [];
24201
24064
  return _this;
24202
24065
  }
24203
- var _proto = ColorPropertyMixerPlayable.prototype;
24204
- _proto.processFrame = function processFrame(context) {
24205
- var boundObject = context.output.getUserData();
24206
- if (!boundObject) {
24207
- return;
24066
+ var _proto = TrackAsset.prototype;
24067
+ /**
24068
+ * 重写该方法以获取自定义对象绑定
24069
+ */ _proto.updateAnimatedObject = function updateAnimatedObject() {
24070
+ if (this.parent) {
24071
+ this.boundObject = this.parent.boundObject;
24208
24072
  }
24209
- var hasInput = false;
24210
- var value = boundObject[this.propertyName];
24211
- if (!_instanceof1(value, Color)) {
24212
- return;
24073
+ };
24074
+ /**
24075
+ * 重写该方法以创建自定义混合器
24076
+ */ _proto.createTrackMixer = function createTrackMixer(graph) {
24077
+ return new TrackMixerPlayable(graph);
24078
+ };
24079
+ _proto.createOutput = function createOutput() {
24080
+ var output = new PlayableOutput();
24081
+ return output;
24082
+ };
24083
+ _proto.createPlayableGraph = function createPlayableGraph(graph, runtimeClips) {
24084
+ var mixerPlayable = this.createMixerPlayableGraph(graph, runtimeClips);
24085
+ return mixerPlayable;
24086
+ };
24087
+ _proto.createMixerPlayableGraph = function createMixerPlayableGraph(graph, runtimeClips) {
24088
+ var clips = [];
24089
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.clips), _step; !(_step = _iterator()).done;){
24090
+ var clip = _step.value;
24091
+ clips.push(clip);
24213
24092
  }
24214
- value.setZero();
24215
- // evaluate the curve
24216
- for(var i = 0; i < this.getInputCount(); i++){
24217
- var weight = this.getInputWeight(i);
24218
- if (weight > 0) {
24219
- var propertyClipPlayable = this.getInput(i);
24220
- if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
24221
- console.error("ColorPropertyMixerPlayable received incompatible input");
24222
- continue;
24223
- }
24224
- var curveValue = propertyClipPlayable.value;
24225
- value.r += curveValue.r * weight;
24226
- value.g += curveValue.g * weight;
24227
- value.b += curveValue.b * weight;
24228
- value.a += curveValue.a * weight;
24229
- hasInput = true;
24093
+ var mixerPlayable = this.compileClips(graph, clips, runtimeClips);
24094
+ return mixerPlayable;
24095
+ };
24096
+ _proto.compileClips = function compileClips(graph, timelineClips, runtimeClips) {
24097
+ var mixer = this.createTrackMixer(graph);
24098
+ for(var _iterator = _create_for_of_iterator_helper_loose(timelineClips), _step; !(_step = _iterator()).done;){
24099
+ var timelineClip = _step.value;
24100
+ var clipPlayable = this.createClipPlayable(graph, timelineClip);
24101
+ clipPlayable.setDuration(timelineClip.duration);
24102
+ var clip = new RuntimeClip(timelineClip, clipPlayable, mixer, this);
24103
+ runtimeClips.push(clip);
24104
+ mixer.clipPlayables.push(clipPlayable);
24105
+ mixer.setClipWeight(clipPlayable, 0.0);
24106
+ }
24107
+ return mixer;
24108
+ };
24109
+ _proto.createPlayable = function createPlayable(graph) {
24110
+ return new Playable(graph);
24111
+ };
24112
+ _proto.getChildTracks = function getChildTracks() {
24113
+ return this.children;
24114
+ };
24115
+ _proto.addChild = function addChild(child) {
24116
+ this.children.push(child);
24117
+ child.parent = this;
24118
+ };
24119
+ _proto.createClip = function createClip(classConstructor, name) {
24120
+ var newClip = new TimelineClip();
24121
+ newClip.asset = new classConstructor(this.engine);
24122
+ newClip.name = name ? name : "TimelineClip" + newClip.id;
24123
+ this.addClip(newClip);
24124
+ return newClip;
24125
+ };
24126
+ _proto.getClips = function getClips() {
24127
+ return this.clips;
24128
+ };
24129
+ _proto.findClip = function findClip(name) {
24130
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.clips), _step; !(_step = _iterator()).done;){
24131
+ var clip = _step.value;
24132
+ if (clip.name === name) {
24133
+ return clip;
24230
24134
  }
24231
24135
  }
24232
- // set value
24233
- if (hasInput) {
24234
- boundObject[this.propertyName] = value;
24136
+ };
24137
+ _proto.addClip = function addClip(clip) {
24138
+ clip.id = (this.clipSeed++).toString();
24139
+ this.clips.push(clip);
24140
+ };
24141
+ _proto.createClipPlayable = function createClipPlayable(graph, clip) {
24142
+ return clip.asset.createPlayable(graph);
24143
+ };
24144
+ _proto.fromData = function fromData(data) {
24145
+ PlayableAsset.prototype.fromData.call(this, data);
24146
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
24147
+ var child = _step.value;
24148
+ child.parent = this;
24235
24149
  }
24236
24150
  };
24237
- return ColorPropertyMixerPlayable;
24238
- }(Playable);
24151
+ return TrackAsset;
24152
+ }(PlayableAsset);
24153
+ __decorate([
24154
+ serialize(TimelineClip)
24155
+ ], exports.TrackAsset.prototype, "clips", void 0);
24156
+ __decorate([
24157
+ serialize()
24158
+ ], exports.TrackAsset.prototype, "children", void 0);
24159
+ exports.TrackAsset = __decorate([
24160
+ effectsClass(DataType.TrackAsset)
24161
+ ], exports.TrackAsset);
24162
+ exports.TrackType = void 0;
24163
+ (function(TrackType) {
24164
+ TrackType[TrackType["MasterTrack"] = 0] = "MasterTrack";
24165
+ TrackType[TrackType["ObjectTrack"] = 1] = "ObjectTrack";
24166
+ })(exports.TrackType || (exports.TrackType = {}));
24167
+ var RuntimeClip = /*#__PURE__*/ function() {
24168
+ function RuntimeClip(clip, clipPlayable, parentMixer, track) {
24169
+ this.clip = clip;
24170
+ this.playable = clipPlayable;
24171
+ this.parentMixer = parentMixer;
24172
+ this.track = track;
24173
+ if (_instanceof1(this.track.boundObject, exports.VFXItem)) {
24174
+ this.particleSystem = this.track.boundObject.getComponent(exports.ParticleSystem);
24175
+ }
24176
+ }
24177
+ var _proto = RuntimeClip.prototype;
24178
+ _proto.evaluateAt = function evaluateAt(localTime) {
24179
+ var clip = this.clip;
24180
+ var weight = 1.0;
24181
+ var ended = false;
24182
+ var started = false;
24183
+ var boundObject = this.track.boundObject;
24184
+ if (localTime >= clip.start + clip.duration && clip.endBehavior === EndBehavior.destroy) {
24185
+ if (_instanceof1(boundObject, exports.VFXItem) && exports.VFXItem.isParticle(boundObject) && this.particleSystem && !this.particleSystem.destroyed) {
24186
+ weight = 1.0;
24187
+ } else {
24188
+ weight = 0.0;
24189
+ ended = true;
24190
+ }
24191
+ } else if (localTime - this.clip.start >= 0) {
24192
+ weight = 1.0;
24193
+ started = true;
24194
+ } else if (localTime < clip.start) {
24195
+ weight = 0.0;
24196
+ }
24197
+ if (started && this.playable.getPlayState() !== PlayState.Playing) {
24198
+ this.playable.play();
24199
+ }
24200
+ this.parentMixer.setClipWeight(this.playable, weight);
24201
+ var clipTime = parseFloat(clip.toLocalTime(localTime).toFixed(3));
24202
+ this.playable.setTime(clipTime);
24203
+ // 判断动画是否结束
24204
+ if (ended) {
24205
+ if (this.playable.getPlayState() === PlayState.Playing) {
24206
+ this.playable.pause();
24207
+ }
24208
+ }
24209
+ };
24210
+ _create_class(RuntimeClip, [
24211
+ {
24212
+ key: "enable",
24213
+ set: function set(value) {
24214
+ if (value) {
24215
+ this.playable.play();
24216
+ } else {
24217
+ this.parentMixer.setClipWeight(this.playable, 0);
24218
+ this.playable.pause();
24219
+ }
24220
+ }
24221
+ }
24222
+ ]);
24223
+ return RuntimeClip;
24224
+ }();
24225
+
24226
+ exports.ActivationTrack = /*#__PURE__*/ function(TrackAsset) {
24227
+ _inherits(ActivationTrack, TrackAsset);
24228
+ function ActivationTrack() {
24229
+ return TrackAsset.apply(this, arguments);
24230
+ }
24231
+ var _proto = ActivationTrack.prototype;
24232
+ _proto.createTrackMixer = function createTrackMixer(graph) {
24233
+ return new ActivationMixerPlayable(graph);
24234
+ };
24235
+ return ActivationTrack;
24236
+ }(exports.TrackAsset);
24237
+ exports.ActivationTrack = __decorate([
24238
+ effectsClass(DataType.ActivationTrack)
24239
+ ], exports.ActivationTrack);
24239
24240
 
24240
24241
  var PropertyTrack = /*#__PURE__*/ function(TrackAsset) {
24241
24242
  _inherits(PropertyTrack, TrackAsset);
@@ -24308,6 +24309,10 @@ exports.SpriteColorTrack = /*#__PURE__*/ function(TrackAsset) {
24308
24309
  function SpriteColorTrack() {
24309
24310
  return TrackAsset.apply(this, arguments);
24310
24311
  }
24312
+ var _proto = SpriteColorTrack.prototype;
24313
+ _proto.createTrackMixer = function createTrackMixer(graph) {
24314
+ return new SpriteColorMixerPlayable(graph);
24315
+ };
24311
24316
  return SpriteColorTrack;
24312
24317
  }(exports.TrackAsset);
24313
24318
  exports.SpriteColorTrack = __decorate([
@@ -24340,6 +24345,10 @@ exports.TransformTrack = /*#__PURE__*/ function(TrackAsset) {
24340
24345
  function TransformTrack() {
24341
24346
  return TrackAsset.apply(this, arguments);
24342
24347
  }
24348
+ var _proto = TransformTrack.prototype;
24349
+ _proto.createTrackMixer = function createTrackMixer(graph) {
24350
+ return new TransformMixerPlayable(graph);
24351
+ };
24343
24352
  return TransformTrack;
24344
24353
  }(exports.TrackAsset);
24345
24354
  exports.TransformTrack = __decorate([
@@ -24368,6 +24377,18 @@ exports.MaterialTrack = __decorate([
24368
24377
  effectsClass("MaterialTrack")
24369
24378
  ], exports.MaterialTrack);
24370
24379
 
24380
+ var ParticleTrack = /*#__PURE__*/ function(TrackAsset) {
24381
+ _inherits(ParticleTrack, TrackAsset);
24382
+ function ParticleTrack() {
24383
+ return TrackAsset.apply(this, arguments);
24384
+ }
24385
+ var _proto = ParticleTrack.prototype;
24386
+ _proto.createTrackMixer = function createTrackMixer(graph) {
24387
+ return new ParticleMixerPlayable(graph);
24388
+ };
24389
+ return ParticleTrack;
24390
+ }(exports.TrackAsset);
24391
+
24371
24392
  exports.Vector4PropertyTrack = /*#__PURE__*/ function(PropertyTrack) {
24372
24393
  _inherits(Vector4PropertyTrack, PropertyTrack);
24373
24394
  function Vector4PropertyTrack() {
@@ -24496,7 +24517,6 @@ exports.TimelineAsset = /*#__PURE__*/ function(PlayableAsset) {
24496
24517
  var _proto = TimelineAsset.prototype;
24497
24518
  _proto.createPlayable = function createPlayable(graph) {
24498
24519
  var timelinePlayable = new TimelinePlayable(graph);
24499
- timelinePlayable.setTraversalMode(PlayableTraversalMode.Passthrough);
24500
24520
  for(var _iterator = _create_for_of_iterator_helper_loose(this.tracks), _step; !(_step = _iterator()).done;){
24501
24521
  var track = _step.value;
24502
24522
  if (_instanceof1(track, exports.ObjectBindingTrack)) {
@@ -24577,9 +24597,7 @@ var TimelinePlayable = /*#__PURE__*/ function(Playable) {
24577
24597
  return _this;
24578
24598
  }
24579
24599
  var _proto = TimelinePlayable.prototype;
24580
- _proto.prepareFrame = function prepareFrame(context) {
24581
- this.evaluate();
24582
- };
24600
+ _proto.prepareFrame = function prepareFrame(context) {};
24583
24601
  _proto.evaluate = function evaluate() {
24584
24602
  var time = this.getTime();
24585
24603
  // TODO search active clips
@@ -24596,11 +24614,10 @@ var TimelinePlayable = /*#__PURE__*/ function(Playable) {
24596
24614
  var track = _step.value;
24597
24615
  // create track mixer and track output
24598
24616
  var trackMixPlayable = track.createPlayableGraph(graph, this.clips);
24599
- this.addInput(trackMixPlayable, 0);
24600
24617
  var trackOutput = track.createOutput();
24601
24618
  trackOutput.setUserData(track.boundObject);
24602
24619
  graph.addOutput(trackOutput);
24603
- trackOutput.setSourcePlayable(this, this.getInputCount() - 1);
24620
+ trackOutput.setSourcePlayable(trackMixPlayable);
24604
24621
  // create track instance
24605
24622
  var trackInstance = new TrackInstance(track, trackMixPlayable, trackOutput);
24606
24623
  trackInstanceMap[track.getInstanceId()] = trackInstance;
@@ -24661,10 +24678,10 @@ exports.Vector4PropertyPlayableAsset = __decorate([
24661
24678
  effectsClass("Vector4PropertyPlayableAsset")
24662
24679
  ], exports.Vector4PropertyPlayableAsset);
24663
24680
 
24664
- exports.ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
24665
- _inherits(ObjectBindingTrack, TrackAsset1);
24681
+ exports.ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset) {
24682
+ _inherits(ObjectBindingTrack, TrackAsset);
24666
24683
  function ObjectBindingTrack() {
24667
- return TrackAsset1.apply(this, arguments);
24684
+ return TrackAsset.apply(this, arguments);
24668
24685
  }
24669
24686
  var _proto = ObjectBindingTrack.prototype;
24670
24687
  _proto.updateAnimatedObject = function updateAnimatedObject() {};
@@ -24675,7 +24692,7 @@ exports.ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
24675
24692
  var boundItem = this.boundObject;
24676
24693
  // 添加粒子动画 clip // TODO 待移除
24677
24694
  if (boundItem.getComponent(exports.ParticleSystem)) {
24678
- var particleTrack = timelineAsset.createTrack(exports.TrackAsset, this, "ParticleTrack");
24695
+ var particleTrack = timelineAsset.createTrack(ParticleTrack, this, "ParticleTrack");
24679
24696
  particleTrack.boundObject = this.boundObject;
24680
24697
  var particleClip = particleTrack.createClip(ParticleBehaviourPlayableAsset);
24681
24698
  particleClip.start = boundItem.start;
@@ -24705,7 +24722,7 @@ var TextLayout = /*#__PURE__*/ function() {
24705
24722
  this.width = textWidth;
24706
24723
  this.height = textHeight;
24707
24724
  this.letterSpace = letterSpace;
24708
- this.overFlow = textOverflow;
24725
+ this.overflow = textOverflow;
24709
24726
  this.textBaseline = textBaseline;
24710
24727
  this.textAlign = textAlign;
24711
24728
  this.lineHeight = lineHeight;
@@ -27320,6 +27337,7 @@ var seed$1 = 1;
27320
27337
  this.downloader = downloader;
27321
27338
  this.assets = {};
27322
27339
  this.sourceFrom = {};
27340
+ this.imageBitmapOptions = {};
27323
27341
  this.id = seed$1++;
27324
27342
  this.timers = [];
27325
27343
  this.updateOptions(options);
@@ -27577,12 +27595,12 @@ var seed$1 = 1;
27577
27595
  _proto.processJSON = function processJSON(json) {
27578
27596
  var _this = this;
27579
27597
  return _async_to_generator(function() {
27580
- var jsonScene, _jsonScene_plugins, plugins, pluginSystem;
27598
+ var jsonScene, _jsonScene_plugins, plugins, textures, pluginSystem;
27581
27599
  return __generator(this, function(_state) {
27582
27600
  switch(_state.label){
27583
27601
  case 0:
27584
27602
  jsonScene = getStandardJSON(json);
27585
- _jsonScene_plugins = jsonScene.plugins, plugins = _jsonScene_plugins === void 0 ? [] : _jsonScene_plugins;
27603
+ _jsonScene_plugins = jsonScene.plugins, plugins = _jsonScene_plugins === void 0 ? [] : _jsonScene_plugins, textures = jsonScene.textures;
27586
27604
  pluginSystem = new PluginSystem(plugins);
27587
27605
  return [
27588
27606
  4,
@@ -27590,6 +27608,7 @@ var seed$1 = 1;
27590
27608
  ];
27591
27609
  case 1:
27592
27610
  _state.sent();
27611
+ _this.assignImageBitmapOptions(textures);
27593
27612
  return [
27594
27613
  2,
27595
27614
  {
@@ -27695,11 +27714,11 @@ var seed$1 = 1;
27695
27714
  if (compressedTexture === void 0) compressedTexture = 0;
27696
27715
  var _this = this;
27697
27716
  return _async_to_generator(function() {
27698
- var _this_options, useCompressedTexture, variables, baseUrl, jobs, loadedImages;
27717
+ var _this_options, useCompressedTexture, variables, disableWebP, disableAVIF, baseUrl, jobs, loadedImages;
27699
27718
  return __generator(this, function(_state) {
27700
27719
  switch(_state.label){
27701
27720
  case 0:
27702
- _this_options = _this.options, useCompressedTexture = _this_options.useCompressedTexture, variables = _this_options.variables;
27721
+ _this_options = _this.options, useCompressedTexture = _this_options.useCompressedTexture, variables = _this_options.variables, disableWebP = _this_options.disableWebP, disableAVIF = _this_options.disableAVIF;
27703
27722
  baseUrl = _this.baseUrl;
27704
27723
  jobs = images.map(/*#__PURE__*/ _async_to_generator(function(img, idx) {
27705
27724
  var png, webp, avif, imageURL, webpURL, avifURL, id, template, background, url, isVideo, loadFn, resultImage, e, compressed, src, bufferURL, _ref, url1, image, _tmp;
@@ -27710,9 +27729,9 @@ var seed$1 = 1;
27710
27729
  // eslint-disable-next-line compat/compat
27711
27730
  imageURL = new URL(png, baseUrl).href;
27712
27731
  // eslint-disable-next-line compat/compat
27713
- webpURL = webp && new URL(webp, baseUrl).href;
27732
+ webpURL = !disableWebP && webp ? new URL(webp, baseUrl).href : undefined;
27714
27733
  // eslint-disable-next-line compat/compat
27715
- avifURL = avif && new URL(avif, baseUrl).href;
27734
+ avifURL = !disableAVIF && avif ? new URL(avif, baseUrl).href : undefined;
27716
27735
  id = img.id;
27717
27736
  if (!("template" in img)) return [
27718
27737
  3,
@@ -27821,7 +27840,7 @@ var seed$1 = 1;
27821
27840
  ];
27822
27841
  return [
27823
27842
  4,
27824
- loadAVIFOptional(imageURL, avifURL)
27843
+ loadAVIFOptional(imageURL, avifURL, _this.imageBitmapOptions[id])
27825
27844
  ];
27826
27845
  case 10:
27827
27846
  _tmp = _state.sent();
@@ -27832,7 +27851,7 @@ var seed$1 = 1;
27832
27851
  case 11:
27833
27852
  return [
27834
27853
  4,
27835
- loadWebPOptional(imageURL, webpURL)
27854
+ loadWebPOptional(imageURL, webpURL, _this.imageBitmapOptions[id])
27836
27855
  ];
27837
27856
  case 12:
27838
27857
  _tmp = _state.sent();
@@ -28044,6 +28063,21 @@ var seed$1 = 1;
28044
28063
  this.assets[images[i].id] = loadedImages[i];
28045
28064
  }
28046
28065
  };
28066
+ _proto.assignImageBitmapOptions = function assignImageBitmapOptions(textures) {
28067
+ var _this = this;
28068
+ if (textures === void 0) textures = [];
28069
+ textures.forEach(function(texture) {
28070
+ if (!(_instanceof1(texture, Texture) || "mipmaps" in texture)) {
28071
+ var source = texture.source;
28072
+ if (isObject(source)) {
28073
+ _this.imageBitmapOptions[source.id] = {
28074
+ imageOrientation: texture.flipY ? "flipY" : "none",
28075
+ premultiplyAlpha: texture.premultiplyAlpha ? "premultiply" : "none"
28076
+ };
28077
+ }
28078
+ }
28079
+ });
28080
+ };
28047
28081
  _proto.removeTimer = function removeTimer(id) {
28048
28082
  var index = this.timers.indexOf(id);
28049
28083
  if (index !== -1) {
@@ -28053,11 +28087,15 @@ var seed$1 = 1;
28053
28087
  /**
28054
28088
  * 销毁方法
28055
28089
  */ _proto.dispose = function dispose() {
28090
+ var _this = this;
28056
28091
  if (this.timers.length) {
28057
28092
  this.timers.map(function(id) {
28058
28093
  return window.clearTimeout(id);
28059
28094
  });
28060
28095
  }
28096
+ closeImageBitMap(Object.keys(this.assets).map(function(key) {
28097
+ return _this.assets[key];
28098
+ }));
28061
28099
  this.assets = {};
28062
28100
  this.sourceFrom = {};
28063
28101
  this.timers = [];
@@ -28074,7 +28112,7 @@ function createTextureOptionsBySource(image, sourceFrom, id) {
28074
28112
  };
28075
28113
  if (_instanceof1(image, Texture)) {
28076
28114
  return _extends({}, image.source, options);
28077
- } else if (_instanceof1(image, HTMLImageElement) || isCanvas(image)) {
28115
+ } else if (_instanceof1(image, HTMLImageElement) || _instanceof1(image, ImageBitmap) || isCanvas(image)) {
28078
28116
  return _extends({
28079
28117
  image: image,
28080
28118
  sourceType: exports.TextureSourceType.image,
@@ -31407,7 +31445,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
31407
31445
  registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
31408
31446
  registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
31409
31447
  registerPlugin("interact", InteractLoader, exports.VFXItem, true);
31410
- var version$1 = "2.1.5";
31448
+ var version$1 = "2.2.0-alpha.0";
31411
31449
  logger.info("Core version: " + version$1 + ".");
31412
31450
 
31413
31451
  var _obj;
@@ -33034,7 +33072,7 @@ setMaxSpriteMeshItemCount(8);
33034
33072
  */ Mesh.create = function(engine, props) {
33035
33073
  return new ThreeMesh(engine, props);
33036
33074
  };
33037
- var version = "2.1.5";
33075
+ var version = "2.2.0-alpha.0";
33038
33076
  logger.info("THREEJS plugin version: " + version + ".");
33039
33077
 
33040
33078
  exports.AbstractPlugin = AbstractPlugin;
@@ -33088,6 +33126,7 @@ exports.HELP_LINK = HELP_LINK;
33088
33126
  exports.InteractLoader = InteractLoader;
33089
33127
  exports.InteractMesh = InteractMesh;
33090
33128
  exports.KTXTexture = KTXTexture;
33129
+ exports.LOAD_PREFER_IMAGE_BITMAP = LOAD_PREFER_IMAGE_BITMAP;
33091
33130
  exports.LineSegments = LineSegments;
33092
33131
  exports.LinearValue = LinearValue;
33093
33132
  exports.Material = Material;
@@ -33101,6 +33140,7 @@ exports.ParticleBehaviourPlayableAsset = ParticleBehaviourPlayableAsset;
33101
33140
  exports.ParticleLoader = ParticleLoader;
33102
33141
  exports.ParticleMesh = ParticleMesh;
33103
33142
  exports.ParticleSystemRenderer = ParticleSystemRenderer;
33143
+ exports.ParticleTrack = ParticleTrack;
33104
33144
  exports.PassTextureCache = PassTextureCache;
33105
33145
  exports.PathSegments = PathSegments;
33106
33146
  exports.PluginSystem = PluginSystem;
@@ -33163,6 +33203,7 @@ exports.base64ToFile = base64ToFile;
33163
33203
  exports.blend = blend;
33164
33204
  exports.calculateTranslation = calculateTranslation;
33165
33205
  exports.canvasPool = canvasPool;
33206
+ exports.closeImageBitMap = closeImageBitMap;
33166
33207
  exports.colorGradingFrag = colorGradingFrag;
33167
33208
  exports.colorStopsFromGradient = colorStopsFromGradient;
33168
33209
  exports.colorToArr = colorToArr$1;
@@ -33241,6 +33282,7 @@ exports.loadAVIFOptional = loadAVIFOptional;
33241
33282
  exports.loadBinary = loadBinary;
33242
33283
  exports.loadBlob = loadBlob;
33243
33284
  exports.loadImage = loadImage;
33285
+ exports.loadImageBitmap = loadImageBitmap;
33244
33286
  exports.loadMedia = loadMedia;
33245
33287
  exports.loadVideo = loadVideo;
33246
33288
  exports.loadWebPOptional = loadWebPOptional;