@galacean/effects-threejs 2.1.5-alpha.0 → 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-alpha.0
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) {
@@ -16604,17 +16698,10 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
16604
16698
  ];
16605
16699
  };
16606
16700
  _proto.onStart = function onStart() {
16607
- var _this = this;
16608
- var _this_item_composition;
16609
16701
  var options = this.item.props.content.options;
16610
16702
  var env = this.item.engine.renderer.env;
16611
16703
  var composition = this.item.composition;
16612
16704
  var _this_interactData_options = this.interactData.options, type = _this_interactData_options.type, showPreview = _this_interactData_options.showPreview;
16613
- (_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.on("goto", function() {
16614
- if (_this.item.time > 0) {
16615
- _this.duringPlay = true;
16616
- }
16617
- });
16618
16705
  if (type === InteractType.CLICK) {
16619
16706
  this.clickable = true;
16620
16707
  if (showPreview && env === PLAYER_OPTIONS_ENV_EDITOR) {
@@ -16655,12 +16742,12 @@ exports.InteractComponent = /*#__PURE__*/ function(RendererComponent) {
16655
16742
  };
16656
16743
  _proto.onUpdate = function onUpdate(dt) {
16657
16744
  var _this_previewContent;
16745
+ this.duringPlay = true;
16658
16746
  // trigger messageBegin when item enter
16659
- if (this.item.time > 0 && !this.duringPlay) {
16747
+ if (this.item.time > 0 && this.item.time - dt / 1000 <= 0) {
16660
16748
  var _this_item_composition;
16661
16749
  var options = this.item.props.content.options;
16662
16750
  (_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.addInteractiveItem(this.item, options.type);
16663
- this.duringPlay = true;
16664
16751
  }
16665
16752
  (_this_previewContent = this.previewContent) == null ? void 0 : _this_previewContent.updateMesh();
16666
16753
  if (!this.dragEvent || !this.bouncingArg) {
@@ -17040,14 +17127,10 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17040
17127
  var playableOutput2 = _step2.value;
17041
17128
  this.processFrameWithRoot(playableOutput2);
17042
17129
  }
17043
- // 更新节点时间
17044
- for(var _iterator3 = _create_for_of_iterator_helper_loose(this.playables), _step3; !(_step3 = _iterator3()).done;){
17045
- var playable = _step3.value;
17046
- this.updatePlayableTime(playable, dt / 1000);
17047
- }
17048
- };
17049
- _proto.connect = function connect(source, sourceOutputPort, destination, destinationInputPort) {
17050
- destination.connectInput(destinationInputPort, source, sourceOutputPort);
17130
+ // 更新节点时间
17131
+ // for (const playable of this.playables) {
17132
+ // this.updatePlayableTime(playable, dt / 1000);
17133
+ // }
17051
17134
  };
17052
17135
  _proto.addOutput = function addOutput(output) {
17053
17136
  this.playableOutputs.push(output);
@@ -17056,12 +17139,12 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17056
17139
  this.playables.push(playable);
17057
17140
  };
17058
17141
  _proto.processFrameWithRoot = function processFrameWithRoot(output) {
17059
- output.sourcePlayable.processFrameRecursive(output.context, output.getSourceOutputPort());
17142
+ output.sourcePlayable.processFrame(output.context);
17060
17143
  output.processFrame();
17061
17144
  };
17062
17145
  _proto.prepareFrameWithRoot = function prepareFrameWithRoot(output) {
17063
- output.sourcePlayable.prepareFrameRecursive(output.context, output.getSourceOutputPort());
17064
17146
  output.prepareFrame();
17147
+ output.sourcePlayable.prepareFrame(output.context);
17065
17148
  };
17066
17149
  _proto.updatePlayableTime = function updatePlayableTime(playable, deltaTime) {
17067
17150
  if (playable.getPlayState() !== 0) {
@@ -17076,24 +17159,15 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17076
17159
  * @since 2.0.0
17077
17160
  */ var Playable = /*#__PURE__*/ function() {
17078
17161
  function Playable(graph, inputCount) {
17079
- if (inputCount === void 0) inputCount = 0;
17080
17162
  this.onPlayablePlayFlag = true;
17081
17163
  this.onPlayablePauseFlag = false;
17082
17164
  this.duration = 0;
17083
17165
  this.destroyed = false;
17084
- this.inputs = [];
17085
- this.inputOuputPorts = [];
17086
- this.inputWeight = [];
17087
- this.outputs = [];
17088
17166
  this.playState = 0;
17089
- this.traversalMode = 0;
17090
17167
  /**
17091
17168
  * 当前本地播放的时间
17092
17169
  */ this.time = 0;
17093
17170
  graph.addPlayable(this);
17094
- this.inputs = new Array(inputCount);
17095
- this.inputOuputPorts = new Array(inputCount);
17096
- this.inputWeight = new Array(inputCount);
17097
17171
  }
17098
17172
  var _proto = Playable.prototype;
17099
17173
  _proto.play = function play() {
@@ -17116,56 +17190,6 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17116
17190
  break;
17117
17191
  }
17118
17192
  };
17119
- _proto.connectInput = function connectInput(inputPort, sourcePlayable, sourceOutputPort, weight) {
17120
- if (weight === void 0) weight = 1.0;
17121
- this.setInput(sourcePlayable, inputPort);
17122
- this.setInputWeight(inputPort, weight);
17123
- sourcePlayable.setOutput(this, sourceOutputPort);
17124
- if (this.inputOuputPorts.length < inputPort + 1) {
17125
- this.inputOuputPorts.length = inputPort + 1;
17126
- }
17127
- this.inputOuputPorts[inputPort] = sourceOutputPort;
17128
- };
17129
- _proto.addInput = function addInput(sourcePlayable, sourceOutputPort, weight) {
17130
- if (weight === void 0) weight = 1.0;
17131
- this.connectInput(this.getInputCount(), sourcePlayable, sourceOutputPort, weight);
17132
- };
17133
- _proto.getInputCount = function getInputCount() {
17134
- return this.inputs.length;
17135
- };
17136
- _proto.getInputs = function getInputs() {
17137
- return this.inputs;
17138
- };
17139
- _proto.getInput = function getInput(index) {
17140
- return this.inputs[index];
17141
- };
17142
- _proto.getOutputCount = function getOutputCount() {
17143
- return this.outputs.length;
17144
- };
17145
- _proto.getOutputs = function getOutputs() {
17146
- return this.outputs;
17147
- };
17148
- _proto.getOutput = function getOutput(index) {
17149
- return this.outputs[index];
17150
- };
17151
- _proto.getInputWeight = function getInputWeight(inputIndex) {
17152
- return this.inputWeight[inputIndex];
17153
- };
17154
- _proto.setInputWeight = function setInputWeight(playableOrIndex, weight) {
17155
- if (_instanceof1(playableOrIndex, Playable)) {
17156
- for(var i = 0; i < this.inputs.length; i++){
17157
- if (this.inputs[i] === playableOrIndex) {
17158
- this.inputWeight[i] = weight;
17159
- return;
17160
- }
17161
- }
17162
- } else {
17163
- if (this.inputWeight.length < playableOrIndex + 1) {
17164
- this.inputWeight.length = playableOrIndex + 1;
17165
- }
17166
- this.inputWeight[playableOrIndex] = weight;
17167
- }
17168
- };
17169
17193
  _proto.setTime = function setTime(time) {
17170
17194
  this.time = time;
17171
17195
  };
@@ -17181,18 +17205,14 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17181
17205
  _proto.getPlayState = function getPlayState() {
17182
17206
  return this.playState;
17183
17207
  };
17184
- _proto.setTraversalMode = function setTraversalMode(mode) {
17185
- this.traversalMode = mode;
17186
- };
17187
- _proto.getTraversalMode = function getTraversalMode() {
17188
- return this.traversalMode;
17189
- };
17190
17208
  // onGraphStart () {
17191
17209
  // }
17192
17210
  // onGraphStop () {
17193
17211
  // }
17194
- _proto.onPlayablePlay = function onPlayablePlay(context) {};
17195
- _proto.onPlayablePause = function onPlayablePause(context) {};
17212
+ // onPlayablePlay (context: FrameContext) {
17213
+ // }
17214
+ // onPlayablePause (context: FrameContext) {
17215
+ // }
17196
17216
  _proto.prepareFrame = function prepareFrame(context) {};
17197
17217
  _proto.processFrame = function processFrame(context) {};
17198
17218
  _proto.onPlayableDestroy = function onPlayableDestroy() {};
@@ -17204,76 +17224,6 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17204
17224
  // TODO 将节点从动画图中移除
17205
17225
  this.destroyed = true;
17206
17226
  };
17207
- /**
17208
- * @internal
17209
- */ _proto.prepareFrameRecursive = function prepareFrameRecursive(context, passthroughPort) {
17210
- if (this.destroyed || this.playState !== 0) {
17211
- return;
17212
- }
17213
- if (this.onPlayablePlayFlag) {
17214
- this.onPlayablePlay(context);
17215
- this.onPlayablePlayFlag = false;
17216
- }
17217
- if (this.onPlayablePauseFlag) {
17218
- this.onPlayablePause(context);
17219
- this.onPlayablePauseFlag = false;
17220
- }
17221
- if (passthroughPort === 0) {
17222
- this.prepareFrame(context);
17223
- }
17224
- // 前序遍历,用于设置节点的初始状态,weight etc.
17225
- switch(this.getTraversalMode()){
17226
- case 0:
17227
- for(var i = 0; i < this.getInputCount(); i++){
17228
- var input = this.getInput(i);
17229
- input.prepareFrameRecursive(context, this.inputOuputPorts[i]);
17230
- }
17231
- break;
17232
- case 1:
17233
- {
17234
- var input1 = this.getInput(passthroughPort);
17235
- input1.prepareFrameRecursive(context, this.inputOuputPorts[passthroughPort]);
17236
- break;
17237
- }
17238
- }
17239
- };
17240
- /**
17241
- * @internal
17242
- */ _proto.processFrameRecursive = function processFrameRecursive(context, passthroughPort) {
17243
- if (this.destroyed || this.playState !== 0) {
17244
- return;
17245
- }
17246
- // 后序遍历,保证 playable 拿到的 input 节点的估计数据是最新的
17247
- switch(this.getTraversalMode()){
17248
- case 0:
17249
- {
17250
- for(var i = 0; i < this.getInputCount(); i++){
17251
- var input = this.getInput(i);
17252
- input.processFrameRecursive(context, this.inputOuputPorts[i]);
17253
- }
17254
- break;
17255
- }
17256
- case 1:
17257
- {
17258
- var input1 = this.getInput(passthroughPort);
17259
- input1.processFrameRecursive(context, this.inputOuputPorts[passthroughPort]);
17260
- break;
17261
- }
17262
- }
17263
- this.processFrame(context);
17264
- };
17265
- _proto.setOutput = function setOutput(outputPlayable, outputPort) {
17266
- if (this.outputs.length < outputPort + 1) {
17267
- this.outputs.length = outputPort + 1;
17268
- }
17269
- this.outputs[outputPort] = outputPlayable;
17270
- };
17271
- _proto.setInput = function setInput(inputPlayable, inputPort) {
17272
- if (this.inputs.length < inputPort + 1) {
17273
- this.inputs.length = inputPort + 1;
17274
- }
17275
- this.inputs[inputPort] = inputPlayable;
17276
- };
17277
17227
  return Playable;
17278
17228
  }();
17279
17229
  /**
@@ -17281,20 +17231,14 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17281
17231
  * @since 2.0.0
17282
17232
  */ var PlayableOutput = /*#__PURE__*/ function() {
17283
17233
  function PlayableOutput() {
17284
- this.sourceOutputPort = 0;
17285
17234
  this.context = {
17286
17235
  deltaTime: 0,
17287
17236
  output: this
17288
17237
  };
17289
17238
  }
17290
17239
  var _proto = PlayableOutput.prototype;
17291
- _proto.setSourcePlayable = function setSourcePlayable(playable, port) {
17292
- if (port === void 0) port = 0;
17240
+ _proto.setSourcePlayable = function setSourcePlayable(playable) {
17293
17241
  this.sourcePlayable = playable;
17294
- this.sourceOutputPort = port;
17295
- };
17296
- _proto.getSourceOutputPort = function getSourceOutputPort() {
17297
- return this.sourceOutputPort;
17298
17242
  };
17299
17243
  _proto.setUserData = function setUserData(value) {
17300
17244
  this.userData = value;
@@ -17320,11 +17264,6 @@ var PlayState;
17320
17264
  PlayState[PlayState["Playing"] = 0] = "Playing";
17321
17265
  PlayState[PlayState["Paused"] = 1] = "Paused";
17322
17266
  })(PlayState || (PlayState = {}));
17323
- var PlayableTraversalMode;
17324
- (function(PlayableTraversalMode) {
17325
- PlayableTraversalMode[PlayableTraversalMode["Mix"] = 0] = "Mix";
17326
- PlayableTraversalMode[PlayableTraversalMode["Passthrough"] = 1] = "Passthrough";
17327
- })(PlayableTraversalMode || (PlayableTraversalMode = {}));
17328
17267
 
17329
17268
  var tempQuat$1 = new Quaternion();
17330
17269
  var seed$4 = 1;
@@ -18891,20 +18830,6 @@ exports.SpriteComponent = __decorate([
18891
18830
  effectsClass(DataType.SpriteComponent)
18892
18831
  ], exports.SpriteComponent);
18893
18832
 
18894
- var RUNTIME_ENV = "runtime_env";
18895
- var RENDER_PREFER_LOOKUP_TEXTURE = "lookup_texture";
18896
- // 文本元素使用 offscreen canvas 绘制
18897
- var TEMPLATE_USE_OFFSCREEN_CANVAS = "offscreen_canvas";
18898
- // 后处理配置相关
18899
- var POST_PROCESS_SETTINGS = "post_process_settings";
18900
- var config = {};
18901
- function getConfig(name) {
18902
- return config[name];
18903
- }
18904
- function setConfig(name, value) {
18905
- return config[name] = value;
18906
- }
18907
-
18908
18833
  var Cone = /*#__PURE__*/ function() {
18909
18834
  function Cone(props) {
18910
18835
  var _this = this;
@@ -22829,12 +22754,6 @@ var AnimationStream = /*#__PURE__*/ function() {
22829
22754
  _proto.findCurveValue = function findCurveValue(componentType, propertyName) {
22830
22755
  return this.curveValues[componentType + propertyName];
22831
22756
  };
22832
- _proto.getInputStream = function getInputStream(index) {
22833
- var inputPlayable = this.playable.getInput(index);
22834
- if (_instanceof1(inputPlayable, AnimationPlayable)) {
22835
- return inputPlayable.animationStream;
22836
- }
22837
- };
22838
22757
  return AnimationStream;
22839
22758
  }();
22840
22759
 
@@ -23169,214 +23088,65 @@ var AnimationClipPlayable = /*#__PURE__*/ function(Playable) {
23169
23088
  return AnimationClipPlayable;
23170
23089
  }(Playable);
23171
23090
 
23172
- /**
23173
- * @since 2.0.0
23174
- */ var TimelineClip = /*#__PURE__*/ function() {
23175
- function TimelineClip() {
23176
- this.start = 0;
23177
- this.duration = 0;
23178
- }
23179
- var _proto = TimelineClip.prototype;
23180
- _proto.toLocalTime = function toLocalTime(time) {
23181
- var localTime = time - this.start;
23182
- var duration = this.duration;
23183
- if (localTime - duration > 0) {
23184
- if (this.endBehavior === EndBehavior.restart) {
23185
- localTime = localTime % duration;
23186
- } else if (this.endBehavior === EndBehavior.freeze) {
23187
- localTime = Math.min(duration, localTime);
23188
- }
23189
- }
23190
- return localTime;
23191
- };
23192
- return TimelineClip;
23193
- }();
23194
- exports.TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
23195
- _inherits(TrackAsset, PlayableAsset);
23196
- function TrackAsset() {
23091
+ var TrackMixerPlayable = /*#__PURE__*/ function(Playable1) {
23092
+ _inherits(TrackMixerPlayable, Playable1);
23093
+ function TrackMixerPlayable() {
23197
23094
  var _this;
23198
- _this = PlayableAsset.apply(this, arguments) || this;
23199
- _this.trackType = 0;
23200
- _this.clipSeed = 0;
23201
- _this.clips = [];
23202
- _this.children = [];
23095
+ _this = Playable1.apply(this, arguments) || this;
23096
+ _this.clipPlayables = [];
23097
+ _this.clipWeights = [];
23203
23098
  return _this;
23204
23099
  }
23205
- var _proto = TrackAsset.prototype;
23206
- /**
23207
- * 重写该方法以获取自定义对象绑定
23208
- */ _proto.updateAnimatedObject = function updateAnimatedObject() {
23209
- if (this.parent) {
23210
- this.boundObject = this.parent.boundObject;
23211
- }
23212
- };
23213
- /**
23214
- * 重写该方法以创建自定义混合器
23215
- */ _proto.createTrackMixer = function createTrackMixer(graph) {
23216
- return new Playable(graph);
23217
- };
23218
- _proto.createOutput = function createOutput() {
23219
- var output = new PlayableOutput();
23220
- return output;
23221
- };
23222
- _proto.createPlayableGraph = function createPlayableGraph(graph, runtimeClips) {
23223
- var mixerPlayable = this.createMixerPlayableGraph(graph, runtimeClips);
23224
- return mixerPlayable;
23225
- };
23226
- _proto.createMixerPlayableGraph = function createMixerPlayableGraph(graph, runtimeClips) {
23227
- var clips = [];
23228
- for(var _iterator = _create_for_of_iterator_helper_loose(this.clips), _step; !(_step = _iterator()).done;){
23229
- var clip = _step.value;
23230
- clips.push(clip);
23231
- }
23232
- var mixerPlayable = this.compileClips(graph, clips, runtimeClips);
23233
- return mixerPlayable;
23234
- };
23235
- _proto.compileClips = function compileClips(graph, timelineClips, runtimeClips) {
23236
- var mixer = this.createTrackMixer(graph);
23237
- for(var _iterator = _create_for_of_iterator_helper_loose(timelineClips), _step; !(_step = _iterator()).done;){
23238
- var timelineClip = _step.value;
23239
- var clipPlayable = this.createClipPlayable(graph, timelineClip);
23240
- clipPlayable.setDuration(timelineClip.duration);
23241
- var clip = new RuntimeClip(timelineClip, clipPlayable, mixer, this);
23242
- runtimeClips.push(clip);
23243
- mixer.addInput(clipPlayable, 0);
23244
- 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);
23245
23105
  }
23246
- return mixer;
23247
- };
23248
- _proto.createPlayable = function createPlayable(graph) {
23249
- return new Playable(graph);
23106
+ this.evaluate(context);
23250
23107
  };
23251
- _proto.getChildTracks = function getChildTracks() {
23252
- return this.children;
23253
- };
23254
- _proto.addChild = function addChild(child) {
23255
- this.children.push(child);
23256
- child.parent = this;
23257
- };
23258
- _proto.createClip = function createClip(classConstructor, name) {
23259
- var newClip = new TimelineClip();
23260
- newClip.asset = new classConstructor(this.engine);
23261
- newClip.name = name ? name : "TimelineClip" + newClip.id;
23262
- this.addClip(newClip);
23263
- return newClip;
23264
- };
23265
- _proto.getClips = function getClips() {
23266
- return this.clips;
23267
- };
23268
- _proto.findClip = function findClip(name) {
23269
- for(var _iterator = _create_for_of_iterator_helper_loose(this.clips), _step; !(_step = _iterator()).done;){
23270
- var clip = _step.value;
23271
- if (clip.name === name) {
23272
- 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
+ }
23273
23115
  }
23116
+ } else {
23117
+ if (this.clipWeights.length < playableOrIndex + 1) {
23118
+ this.clipWeights.length = playableOrIndex + 1;
23119
+ }
23120
+ this.clipWeights[playableOrIndex] = weight;
23274
23121
  }
23275
23122
  };
23276
- _proto.addClip = function addClip(clip) {
23277
- clip.id = (this.clipSeed++).toString();
23278
- this.clips.push(clip);
23123
+ _proto.getClipWeight = function getClipWeight(inputIndex) {
23124
+ return this.clipWeights[inputIndex];
23279
23125
  };
23280
- _proto.createClipPlayable = function createClipPlayable(graph, clip) {
23281
- return clip.asset.createPlayable(graph);
23126
+ _proto.getClipPlayable = function getClipPlayable(index) {
23127
+ return this.clipPlayables[index];
23282
23128
  };
23283
- _proto.fromData = function fromData(data) {
23284
- PlayableAsset.prototype.fromData.call(this, data);
23285
- for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
23286
- var child = _step.value;
23287
- child.parent = this;
23288
- }
23129
+ _proto.evaluate = function evaluate(context) {
23130
+ // Override
23289
23131
  };
23290
- return TrackAsset;
23291
- }(PlayableAsset);
23292
- __decorate([
23293
- serialize(TimelineClip)
23294
- ], exports.TrackAsset.prototype, "clips", void 0);
23295
- __decorate([
23296
- serialize()
23297
- ], exports.TrackAsset.prototype, "children", void 0);
23298
- exports.TrackAsset = __decorate([
23299
- effectsClass(DataType.TrackAsset)
23300
- ], exports.TrackAsset);
23301
- exports.TrackType = void 0;
23302
- (function(TrackType) {
23303
- TrackType[TrackType["MasterTrack"] = 0] = "MasterTrack";
23304
- TrackType[TrackType["ObjectTrack"] = 1] = "ObjectTrack";
23305
- })(exports.TrackType || (exports.TrackType = {}));
23306
- var RuntimeClip = /*#__PURE__*/ function() {
23307
- function RuntimeClip(clip, clipPlayable, parentMixer, track) {
23308
- this.clip = clip;
23309
- this.playable = clipPlayable;
23310
- this.parentMixer = parentMixer;
23311
- this.track = track;
23312
- if (_instanceof1(this.track.boundObject, exports.VFXItem)) {
23313
- this.particleSystem = this.track.boundObject.getComponent(exports.ParticleSystem);
23314
- }
23315
- }
23316
- var _proto = RuntimeClip.prototype;
23317
- _proto.evaluateAt = function evaluateAt(localTime) {
23318
- var clip = this.clip;
23319
- var weight = 1.0;
23320
- var ended = false;
23321
- var started = false;
23322
- var boundObject = this.track.boundObject;
23323
- if (localTime >= clip.start + clip.duration && clip.endBehavior === EndBehavior.destroy) {
23324
- if (_instanceof1(boundObject, exports.VFXItem) && exports.VFXItem.isParticle(boundObject) && this.particleSystem && !this.particleSystem.destroyed) {
23325
- weight = 1.0;
23326
- } else {
23327
- weight = 0.0;
23328
- ended = true;
23329
- }
23330
- } else if (localTime - this.clip.start >= 0) {
23331
- weight = 1.0;
23332
- started = true;
23333
- } else if (localTime < clip.start) {
23334
- weight = 0.0;
23335
- }
23336
- if (started && this.playable.getPlayState() !== PlayState.Playing) {
23337
- this.playable.play();
23338
- }
23339
- this.parentMixer.setInputWeight(this.playable, weight);
23340
- var clipTime = clip.toLocalTime(localTime);
23341
- this.playable.setTime(clipTime);
23342
- // 判断动画是否结束
23343
- if (ended) {
23344
- if (this.playable.getPlayState() === PlayState.Playing) {
23345
- this.playable.pause();
23346
- }
23347
- }
23348
- };
23349
- _create_class(RuntimeClip, [
23350
- {
23351
- key: "enable",
23352
- set: function set(value) {
23353
- if (value) {
23354
- this.playable.play();
23355
- } else {
23356
- this.parentMixer.setInputWeight(this.playable, 0);
23357
- this.playable.pause();
23358
- }
23359
- }
23360
- }
23361
- ]);
23362
- return RuntimeClip;
23363
- }();
23132
+ return TrackMixerPlayable;
23133
+ }(Playable);
23364
23134
 
23365
- var ActivationMixerPlayable = /*#__PURE__*/ function(Playable) {
23366
- _inherits(ActivationMixerPlayable, Playable);
23135
+ var ActivationMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
23136
+ _inherits(ActivationMixerPlayable, TrackMixerPlayable);
23367
23137
  function ActivationMixerPlayable() {
23368
- return Playable.apply(this, arguments);
23138
+ return TrackMixerPlayable.apply(this, arguments);
23369
23139
  }
23370
23140
  var _proto = ActivationMixerPlayable.prototype;
23371
- _proto.processFrame = function processFrame(context) {
23141
+ _proto.evaluate = function evaluate(context) {
23372
23142
  var boundObject = context.output.getUserData();
23373
23143
  if (!_instanceof1(boundObject, exports.VFXItem)) {
23374
23144
  return;
23375
23145
  }
23376
23146
  var boundItem = boundObject;
23377
23147
  var hasInput = false;
23378
- for(var i = 0; i < this.getInputCount(); i++){
23379
- if (this.getInputWeight(i) > 0) {
23148
+ for(var i = 0; i < this.clipPlayables.length; i++){
23149
+ if (this.getClipWeight(i) > 0) {
23380
23150
  hasInput = true;
23381
23151
  break;
23382
23152
  }
@@ -23390,22 +23160,7 @@ var ActivationMixerPlayable = /*#__PURE__*/ function(Playable) {
23390
23160
  }
23391
23161
  };
23392
23162
  return ActivationMixerPlayable;
23393
- }(Playable);
23394
-
23395
- exports.ActivationTrack = /*#__PURE__*/ function(TrackAsset) {
23396
- _inherits(ActivationTrack, TrackAsset);
23397
- function ActivationTrack() {
23398
- return TrackAsset.apply(this, arguments);
23399
- }
23400
- var _proto = ActivationTrack.prototype;
23401
- _proto.createTrackMixer = function createTrackMixer(graph) {
23402
- return new ActivationMixerPlayable(graph);
23403
- };
23404
- return ActivationTrack;
23405
- }(exports.TrackAsset);
23406
- exports.ActivationTrack = __decorate([
23407
- effectsClass(DataType.ActivationTrack)
23408
- ], exports.ActivationTrack);
23163
+ }(TrackMixerPlayable);
23409
23164
 
23410
23165
  var PropertyClipPlayable = /*#__PURE__*/ function(Playable) {
23411
23166
  _inherits(PropertyClipPlayable, Playable);
@@ -23419,16 +23174,61 @@ var PropertyClipPlayable = /*#__PURE__*/ function(Playable) {
23419
23174
  return PropertyClipPlayable;
23420
23175
  }(Playable);
23421
23176
 
23422
- var FloatPropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
23423
- _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);
23424
23224
  function FloatPropertyMixerPlayable() {
23425
23225
  var _this;
23426
- _this = Playable.apply(this, arguments) || this;
23226
+ _this = TrackMixerPlayable.apply(this, arguments) || this;
23427
23227
  _this.propertyName = "";
23428
23228
  return _this;
23429
23229
  }
23430
23230
  var _proto = FloatPropertyMixerPlayable.prototype;
23431
- _proto.processFrame = function processFrame(context) {
23231
+ _proto.evaluate = function evaluate(context) {
23432
23232
  var boundObject = context.output.getUserData();
23433
23233
  if (!boundObject) {
23434
23234
  return;
@@ -23436,10 +23236,10 @@ var FloatPropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
23436
23236
  var hasInput = false;
23437
23237
  var value = 0;
23438
23238
  // evaluate the curve
23439
- for(var i = 0; i < this.getInputCount(); i++){
23440
- var weight = this.getInputWeight(i);
23239
+ for(var i = 0; i < this.clipPlayables.length; i++){
23240
+ var weight = this.getClipWeight(i);
23441
23241
  if (weight > 0) {
23442
- var propertyClipPlayable = this.getInput(i);
23242
+ var propertyClipPlayable = this.getClipPlayable(i);
23443
23243
  if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
23444
23244
  console.error("FloatPropertyTrack added non-FloatPropertyPlayableAsset");
23445
23245
  continue;
@@ -23455,7 +23255,27 @@ var FloatPropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
23455
23255
  }
23456
23256
  };
23457
23257
  return FloatPropertyMixerPlayable;
23458
- }(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);
23459
23279
 
23460
23280
  var SerializationHelper = /*#__PURE__*/ function() {
23461
23281
  function SerializationHelper() {}
@@ -23947,7 +23767,8 @@ var SerializationHelper = /*#__PURE__*/ function() {
23947
23767
  this.timelinePlayable.setTime(time);
23948
23768
  // The properties of the object may change dynamically,
23949
23769
  // so reset the track binding to avoid invalidation of the previously obtained binding object.
23950
- this.resolveBindings();
23770
+ // this.resolveBindings();
23771
+ this.timelinePlayable.evaluate();
23951
23772
  this.graph.evaluate(dt);
23952
23773
  };
23953
23774
  _proto.createContent = function createContent() {
@@ -24126,21 +23947,21 @@ var SubCompositionClipPlayable = /*#__PURE__*/ function(Playable) {
24126
23947
  return SubCompositionClipPlayable;
24127
23948
  }(Playable);
24128
23949
 
24129
- var SubCompositionMixerPlayable = /*#__PURE__*/ function(Playable) {
24130
- _inherits(SubCompositionMixerPlayable, Playable);
23950
+ var SubCompositionMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
23951
+ _inherits(SubCompositionMixerPlayable, TrackMixerPlayable);
24131
23952
  function SubCompositionMixerPlayable() {
24132
- return Playable.apply(this, arguments);
23953
+ return TrackMixerPlayable.apply(this, arguments);
24133
23954
  }
24134
23955
  var _proto = SubCompositionMixerPlayable.prototype;
24135
- _proto.processFrame = function processFrame(context) {
23956
+ _proto.evaluate = function evaluate(context) {
24136
23957
  var boundObject = context.output.getUserData();
24137
23958
  if (!_instanceof1(boundObject, CompositionComponent)) {
24138
23959
  return;
24139
23960
  }
24140
23961
  var compositionComponent = boundObject;
24141
23962
  var hasInput = false;
24142
- for(var i = 0; i < this.getInputCount(); i++){
24143
- if (this.getInputWeight(i) > 0) {
23963
+ for(var i = 0; i < this.clipPlayables.length; i++){
23964
+ if (this.getClipWeight(i) > 0) {
24144
23965
  hasInput = true;
24145
23966
  break;
24146
23967
  }
@@ -24152,18 +23973,28 @@ var SubCompositionMixerPlayable = /*#__PURE__*/ function(Playable) {
24152
23973
  }
24153
23974
  };
24154
23975
  return SubCompositionMixerPlayable;
24155
- }(Playable);
23976
+ }(TrackMixerPlayable);
24156
23977
 
24157
- var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
24158
- _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);
24159
23990
  function Vector4PropertyMixerPlayable() {
24160
23991
  var _this;
24161
- _this = Playable.apply(this, arguments) || this;
23992
+ _this = TrackMixerPlayable.apply(this, arguments) || this;
24162
23993
  _this.propertyName = "";
24163
23994
  return _this;
24164
23995
  }
24165
23996
  var _proto = Vector4PropertyMixerPlayable.prototype;
24166
- _proto.processFrame = function processFrame(context) {
23997
+ _proto.evaluate = function evaluate(context) {
24167
23998
  var boundObject = context.output.getUserData();
24168
23999
  if (!boundObject) {
24169
24000
  return;
@@ -24175,10 +24006,10 @@ var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
24175
24006
  }
24176
24007
  value.setZero();
24177
24008
  // evaluate the curve
24178
- for(var i = 0; i < this.getInputCount(); i++){
24179
- var weight = this.getInputWeight(i);
24009
+ for(var i = 0; i < this.clipPlayables.length; i++){
24010
+ var weight = this.getClipWeight(i);
24180
24011
  if (weight > 0) {
24181
- var propertyClipPlayable = this.getInput(i);
24012
+ var propertyClipPlayable = this.getClipPlayable(i);
24182
24013
  if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
24183
24014
  console.error("Vector4PropertyTrack added non-Vector4PropertyPlayableAsset");
24184
24015
  continue;
@@ -24197,52 +24028,215 @@ var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
24197
24028
  }
24198
24029
  };
24199
24030
  return Vector4PropertyMixerPlayable;
24200
- }(Playable);
24031
+ }(TrackMixerPlayable);
24201
24032
 
24202
- var ColorPropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
24203
- _inherits(ColorPropertyMixerPlayable, Playable);
24204
- 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() {
24205
24058
  var _this;
24206
- _this = Playable.apply(this, arguments) || this;
24207
- _this.propertyName = "";
24059
+ _this = PlayableAsset.apply(this, arguments) || this;
24060
+ _this.trackType = 0;
24061
+ _this.clipSeed = 0;
24062
+ _this.clips = [];
24063
+ _this.children = [];
24208
24064
  return _this;
24209
24065
  }
24210
- var _proto = ColorPropertyMixerPlayable.prototype;
24211
- _proto.processFrame = function processFrame(context) {
24212
- var boundObject = context.output.getUserData();
24213
- if (!boundObject) {
24214
- return;
24066
+ var _proto = TrackAsset.prototype;
24067
+ /**
24068
+ * 重写该方法以获取自定义对象绑定
24069
+ */ _proto.updateAnimatedObject = function updateAnimatedObject() {
24070
+ if (this.parent) {
24071
+ this.boundObject = this.parent.boundObject;
24215
24072
  }
24216
- var hasInput = false;
24217
- var value = boundObject[this.propertyName];
24218
- if (!_instanceof1(value, Color)) {
24219
- 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);
24220
24092
  }
24221
- value.setZero();
24222
- // evaluate the curve
24223
- for(var i = 0; i < this.getInputCount(); i++){
24224
- var weight = this.getInputWeight(i);
24225
- if (weight > 0) {
24226
- var propertyClipPlayable = this.getInput(i);
24227
- if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
24228
- console.error("ColorPropertyMixerPlayable received incompatible input");
24229
- continue;
24230
- }
24231
- var curveValue = propertyClipPlayable.value;
24232
- value.r += curveValue.r * weight;
24233
- value.g += curveValue.g * weight;
24234
- value.b += curveValue.b * weight;
24235
- value.a += curveValue.a * weight;
24236
- 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;
24237
24134
  }
24238
24135
  }
24239
- // set value
24240
- if (hasInput) {
24241
- 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;
24242
24149
  }
24243
24150
  };
24244
- return ColorPropertyMixerPlayable;
24245
- }(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);
24246
24240
 
24247
24241
  var PropertyTrack = /*#__PURE__*/ function(TrackAsset) {
24248
24242
  _inherits(PropertyTrack, TrackAsset);
@@ -24315,6 +24309,10 @@ exports.SpriteColorTrack = /*#__PURE__*/ function(TrackAsset) {
24315
24309
  function SpriteColorTrack() {
24316
24310
  return TrackAsset.apply(this, arguments);
24317
24311
  }
24312
+ var _proto = SpriteColorTrack.prototype;
24313
+ _proto.createTrackMixer = function createTrackMixer(graph) {
24314
+ return new SpriteColorMixerPlayable(graph);
24315
+ };
24318
24316
  return SpriteColorTrack;
24319
24317
  }(exports.TrackAsset);
24320
24318
  exports.SpriteColorTrack = __decorate([
@@ -24347,6 +24345,10 @@ exports.TransformTrack = /*#__PURE__*/ function(TrackAsset) {
24347
24345
  function TransformTrack() {
24348
24346
  return TrackAsset.apply(this, arguments);
24349
24347
  }
24348
+ var _proto = TransformTrack.prototype;
24349
+ _proto.createTrackMixer = function createTrackMixer(graph) {
24350
+ return new TransformMixerPlayable(graph);
24351
+ };
24350
24352
  return TransformTrack;
24351
24353
  }(exports.TrackAsset);
24352
24354
  exports.TransformTrack = __decorate([
@@ -24375,6 +24377,18 @@ exports.MaterialTrack = __decorate([
24375
24377
  effectsClass("MaterialTrack")
24376
24378
  ], exports.MaterialTrack);
24377
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
+
24378
24392
  exports.Vector4PropertyTrack = /*#__PURE__*/ function(PropertyTrack) {
24379
24393
  _inherits(Vector4PropertyTrack, PropertyTrack);
24380
24394
  function Vector4PropertyTrack() {
@@ -24503,7 +24517,6 @@ exports.TimelineAsset = /*#__PURE__*/ function(PlayableAsset) {
24503
24517
  var _proto = TimelineAsset.prototype;
24504
24518
  _proto.createPlayable = function createPlayable(graph) {
24505
24519
  var timelinePlayable = new TimelinePlayable(graph);
24506
- timelinePlayable.setTraversalMode(PlayableTraversalMode.Passthrough);
24507
24520
  for(var _iterator = _create_for_of_iterator_helper_loose(this.tracks), _step; !(_step = _iterator()).done;){
24508
24521
  var track = _step.value;
24509
24522
  if (_instanceof1(track, exports.ObjectBindingTrack)) {
@@ -24584,9 +24597,7 @@ var TimelinePlayable = /*#__PURE__*/ function(Playable) {
24584
24597
  return _this;
24585
24598
  }
24586
24599
  var _proto = TimelinePlayable.prototype;
24587
- _proto.prepareFrame = function prepareFrame(context) {
24588
- this.evaluate();
24589
- };
24600
+ _proto.prepareFrame = function prepareFrame(context) {};
24590
24601
  _proto.evaluate = function evaluate() {
24591
24602
  var time = this.getTime();
24592
24603
  // TODO search active clips
@@ -24603,11 +24614,10 @@ var TimelinePlayable = /*#__PURE__*/ function(Playable) {
24603
24614
  var track = _step.value;
24604
24615
  // create track mixer and track output
24605
24616
  var trackMixPlayable = track.createPlayableGraph(graph, this.clips);
24606
- this.addInput(trackMixPlayable, 0);
24607
24617
  var trackOutput = track.createOutput();
24608
24618
  trackOutput.setUserData(track.boundObject);
24609
24619
  graph.addOutput(trackOutput);
24610
- trackOutput.setSourcePlayable(this, this.getInputCount() - 1);
24620
+ trackOutput.setSourcePlayable(trackMixPlayable);
24611
24621
  // create track instance
24612
24622
  var trackInstance = new TrackInstance(track, trackMixPlayable, trackOutput);
24613
24623
  trackInstanceMap[track.getInstanceId()] = trackInstance;
@@ -24668,10 +24678,10 @@ exports.Vector4PropertyPlayableAsset = __decorate([
24668
24678
  effectsClass("Vector4PropertyPlayableAsset")
24669
24679
  ], exports.Vector4PropertyPlayableAsset);
24670
24680
 
24671
- exports.ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
24672
- _inherits(ObjectBindingTrack, TrackAsset1);
24681
+ exports.ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset) {
24682
+ _inherits(ObjectBindingTrack, TrackAsset);
24673
24683
  function ObjectBindingTrack() {
24674
- return TrackAsset1.apply(this, arguments);
24684
+ return TrackAsset.apply(this, arguments);
24675
24685
  }
24676
24686
  var _proto = ObjectBindingTrack.prototype;
24677
24687
  _proto.updateAnimatedObject = function updateAnimatedObject() {};
@@ -24682,7 +24692,7 @@ exports.ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
24682
24692
  var boundItem = this.boundObject;
24683
24693
  // 添加粒子动画 clip // TODO 待移除
24684
24694
  if (boundItem.getComponent(exports.ParticleSystem)) {
24685
- var particleTrack = timelineAsset.createTrack(exports.TrackAsset, this, "ParticleTrack");
24695
+ var particleTrack = timelineAsset.createTrack(ParticleTrack, this, "ParticleTrack");
24686
24696
  particleTrack.boundObject = this.boundObject;
24687
24697
  var particleClip = particleTrack.createClip(ParticleBehaviourPlayableAsset);
24688
24698
  particleClip.start = boundItem.start;
@@ -24712,7 +24722,7 @@ var TextLayout = /*#__PURE__*/ function() {
24712
24722
  this.width = textWidth;
24713
24723
  this.height = textHeight;
24714
24724
  this.letterSpace = letterSpace;
24715
- this.overFlow = textOverflow;
24725
+ this.overflow = textOverflow;
24716
24726
  this.textBaseline = textBaseline;
24717
24727
  this.textAlign = textAlign;
24718
24728
  this.lineHeight = lineHeight;
@@ -27327,6 +27337,7 @@ var seed$1 = 1;
27327
27337
  this.downloader = downloader;
27328
27338
  this.assets = {};
27329
27339
  this.sourceFrom = {};
27340
+ this.imageBitmapOptions = {};
27330
27341
  this.id = seed$1++;
27331
27342
  this.timers = [];
27332
27343
  this.updateOptions(options);
@@ -27584,12 +27595,12 @@ var seed$1 = 1;
27584
27595
  _proto.processJSON = function processJSON(json) {
27585
27596
  var _this = this;
27586
27597
  return _async_to_generator(function() {
27587
- var jsonScene, _jsonScene_plugins, plugins, pluginSystem;
27598
+ var jsonScene, _jsonScene_plugins, plugins, textures, pluginSystem;
27588
27599
  return __generator(this, function(_state) {
27589
27600
  switch(_state.label){
27590
27601
  case 0:
27591
27602
  jsonScene = getStandardJSON(json);
27592
- _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;
27593
27604
  pluginSystem = new PluginSystem(plugins);
27594
27605
  return [
27595
27606
  4,
@@ -27597,6 +27608,7 @@ var seed$1 = 1;
27597
27608
  ];
27598
27609
  case 1:
27599
27610
  _state.sent();
27611
+ _this.assignImageBitmapOptions(textures);
27600
27612
  return [
27601
27613
  2,
27602
27614
  {
@@ -27702,11 +27714,11 @@ var seed$1 = 1;
27702
27714
  if (compressedTexture === void 0) compressedTexture = 0;
27703
27715
  var _this = this;
27704
27716
  return _async_to_generator(function() {
27705
- var _this_options, useCompressedTexture, variables, baseUrl, jobs, loadedImages;
27717
+ var _this_options, useCompressedTexture, variables, disableWebP, disableAVIF, baseUrl, jobs, loadedImages;
27706
27718
  return __generator(this, function(_state) {
27707
27719
  switch(_state.label){
27708
27720
  case 0:
27709
- _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;
27710
27722
  baseUrl = _this.baseUrl;
27711
27723
  jobs = images.map(/*#__PURE__*/ _async_to_generator(function(img, idx) {
27712
27724
  var png, webp, avif, imageURL, webpURL, avifURL, id, template, background, url, isVideo, loadFn, resultImage, e, compressed, src, bufferURL, _ref, url1, image, _tmp;
@@ -27717,9 +27729,9 @@ var seed$1 = 1;
27717
27729
  // eslint-disable-next-line compat/compat
27718
27730
  imageURL = new URL(png, baseUrl).href;
27719
27731
  // eslint-disable-next-line compat/compat
27720
- webpURL = webp && new URL(webp, baseUrl).href;
27732
+ webpURL = !disableWebP && webp ? new URL(webp, baseUrl).href : undefined;
27721
27733
  // eslint-disable-next-line compat/compat
27722
- avifURL = avif && new URL(avif, baseUrl).href;
27734
+ avifURL = !disableAVIF && avif ? new URL(avif, baseUrl).href : undefined;
27723
27735
  id = img.id;
27724
27736
  if (!("template" in img)) return [
27725
27737
  3,
@@ -27828,7 +27840,7 @@ var seed$1 = 1;
27828
27840
  ];
27829
27841
  return [
27830
27842
  4,
27831
- loadAVIFOptional(imageURL, avifURL)
27843
+ loadAVIFOptional(imageURL, avifURL, _this.imageBitmapOptions[id])
27832
27844
  ];
27833
27845
  case 10:
27834
27846
  _tmp = _state.sent();
@@ -27839,7 +27851,7 @@ var seed$1 = 1;
27839
27851
  case 11:
27840
27852
  return [
27841
27853
  4,
27842
- loadWebPOptional(imageURL, webpURL)
27854
+ loadWebPOptional(imageURL, webpURL, _this.imageBitmapOptions[id])
27843
27855
  ];
27844
27856
  case 12:
27845
27857
  _tmp = _state.sent();
@@ -28051,6 +28063,21 @@ var seed$1 = 1;
28051
28063
  this.assets[images[i].id] = loadedImages[i];
28052
28064
  }
28053
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
+ };
28054
28081
  _proto.removeTimer = function removeTimer(id) {
28055
28082
  var index = this.timers.indexOf(id);
28056
28083
  if (index !== -1) {
@@ -28060,11 +28087,15 @@ var seed$1 = 1;
28060
28087
  /**
28061
28088
  * 销毁方法
28062
28089
  */ _proto.dispose = function dispose() {
28090
+ var _this = this;
28063
28091
  if (this.timers.length) {
28064
28092
  this.timers.map(function(id) {
28065
28093
  return window.clearTimeout(id);
28066
28094
  });
28067
28095
  }
28096
+ closeImageBitMap(Object.keys(this.assets).map(function(key) {
28097
+ return _this.assets[key];
28098
+ }));
28068
28099
  this.assets = {};
28069
28100
  this.sourceFrom = {};
28070
28101
  this.timers = [];
@@ -28081,7 +28112,7 @@ function createTextureOptionsBySource(image, sourceFrom, id) {
28081
28112
  };
28082
28113
  if (_instanceof1(image, Texture)) {
28083
28114
  return _extends({}, image.source, options);
28084
- } else if (_instanceof1(image, HTMLImageElement) || isCanvas(image)) {
28115
+ } else if (_instanceof1(image, HTMLImageElement) || _instanceof1(image, ImageBitmap) || isCanvas(image)) {
28085
28116
  return _extends({
28086
28117
  image: image,
28087
28118
  sourceType: exports.TextureSourceType.image,
@@ -28937,7 +28968,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
28937
28968
  if (!this.assigned || this.paused) {
28938
28969
  return;
28939
28970
  }
28940
- var dt = this.getUpdateTime(deltaTime * this.speed);
28971
+ var dt = parseFloat(this.getUpdateTime(deltaTime * this.speed).toFixed(0));
28941
28972
  this.updateRootComposition(dt / 1000);
28942
28973
  this.updateVideo();
28943
28974
  // 更新 model-tree-plugin
@@ -31414,7 +31445,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
31414
31445
  registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
31415
31446
  registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
31416
31447
  registerPlugin("interact", InteractLoader, exports.VFXItem, true);
31417
- var version$1 = "2.1.5-alpha.0";
31448
+ var version$1 = "2.2.0-alpha.0";
31418
31449
  logger.info("Core version: " + version$1 + ".");
31419
31450
 
31420
31451
  var _obj;
@@ -33041,7 +33072,7 @@ setMaxSpriteMeshItemCount(8);
33041
33072
  */ Mesh.create = function(engine, props) {
33042
33073
  return new ThreeMesh(engine, props);
33043
33074
  };
33044
- var version = "2.1.5-alpha.0";
33075
+ var version = "2.2.0-alpha.0";
33045
33076
  logger.info("THREEJS plugin version: " + version + ".");
33046
33077
 
33047
33078
  exports.AbstractPlugin = AbstractPlugin;
@@ -33095,6 +33126,7 @@ exports.HELP_LINK = HELP_LINK;
33095
33126
  exports.InteractLoader = InteractLoader;
33096
33127
  exports.InteractMesh = InteractMesh;
33097
33128
  exports.KTXTexture = KTXTexture;
33129
+ exports.LOAD_PREFER_IMAGE_BITMAP = LOAD_PREFER_IMAGE_BITMAP;
33098
33130
  exports.LineSegments = LineSegments;
33099
33131
  exports.LinearValue = LinearValue;
33100
33132
  exports.Material = Material;
@@ -33108,6 +33140,7 @@ exports.ParticleBehaviourPlayableAsset = ParticleBehaviourPlayableAsset;
33108
33140
  exports.ParticleLoader = ParticleLoader;
33109
33141
  exports.ParticleMesh = ParticleMesh;
33110
33142
  exports.ParticleSystemRenderer = ParticleSystemRenderer;
33143
+ exports.ParticleTrack = ParticleTrack;
33111
33144
  exports.PassTextureCache = PassTextureCache;
33112
33145
  exports.PathSegments = PathSegments;
33113
33146
  exports.PluginSystem = PluginSystem;
@@ -33170,6 +33203,7 @@ exports.base64ToFile = base64ToFile;
33170
33203
  exports.blend = blend;
33171
33204
  exports.calculateTranslation = calculateTranslation;
33172
33205
  exports.canvasPool = canvasPool;
33206
+ exports.closeImageBitMap = closeImageBitMap;
33173
33207
  exports.colorGradingFrag = colorGradingFrag;
33174
33208
  exports.colorStopsFromGradient = colorStopsFromGradient;
33175
33209
  exports.colorToArr = colorToArr$1;
@@ -33248,6 +33282,7 @@ exports.loadAVIFOptional = loadAVIFOptional;
33248
33282
  exports.loadBinary = loadBinary;
33249
33283
  exports.loadBlob = loadBlob;
33250
33284
  exports.loadImage = loadImage;
33285
+ exports.loadImageBitmap = loadImageBitmap;
33251
33286
  exports.loadMedia = loadMedia;
33252
33287
  exports.loadVideo = loadVideo;
33253
33288
  exports.loadWebPOptional = loadWebPOptional;