@galacean/effects-core 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.
Files changed (34) hide show
  1. package/dist/asset-manager.d.ts +5 -0
  2. package/dist/config.d.ts +1 -0
  3. package/dist/downloader.d.ts +16 -4
  4. package/dist/index.js +559 -517
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +556 -518
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/math/value-getters/value-getter.d.ts +4 -0
  9. package/dist/plugins/cal/animation-stream.d.ts +1 -2
  10. package/dist/plugins/cal/playable-graph.d.ts +1 -30
  11. package/dist/plugins/text/text-layout.d.ts +1 -1
  12. package/dist/plugins/timeline/playables/activation-mixer-playable.d.ts +3 -3
  13. package/dist/plugins/timeline/playables/color-property-mixer-playable.d.ts +3 -3
  14. package/dist/plugins/timeline/playables/float-property-mixer-playable.d.ts +3 -3
  15. package/dist/plugins/timeline/playables/index.d.ts +6 -2
  16. package/dist/plugins/timeline/playables/particle-mixer-playable.d.ts +5 -0
  17. package/dist/plugins/timeline/playables/sprite-color-mixer-playable.d.ts +5 -0
  18. package/dist/plugins/timeline/playables/sub-composition-mixer-playable.d.ts +3 -3
  19. package/dist/plugins/timeline/playables/track-mixer-playable.d.ts +12 -0
  20. package/dist/plugins/timeline/playables/transform-mixer-playable.d.ts +5 -0
  21. package/dist/plugins/timeline/playables/vector4-property-mixer-playable.d.ts +3 -3
  22. package/dist/plugins/timeline/track.d.ts +7 -6
  23. package/dist/plugins/timeline/tracks/activation-track.d.ts +3 -2
  24. package/dist/plugins/timeline/tracks/color-property-track.d.ts +3 -2
  25. package/dist/plugins/timeline/tracks/float-property-track.d.ts +3 -2
  26. package/dist/plugins/timeline/tracks/index.d.ts +1 -0
  27. package/dist/plugins/timeline/tracks/particle-track.d.ts +6 -0
  28. package/dist/plugins/timeline/tracks/property-track.d.ts +1 -1
  29. package/dist/plugins/timeline/tracks/sprite-color-track.d.ts +3 -0
  30. package/dist/plugins/timeline/tracks/sub-composition-track.d.ts +3 -2
  31. package/dist/plugins/timeline/tracks/transform-track.d.ts +3 -0
  32. package/dist/plugins/timeline/tracks/vector4-property-track.d.ts +3 -2
  33. package/dist/scene.d.ts +13 -1
  34. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime core 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';
@@ -63,12 +63,8 @@ function __generator(thisArg, body) {
63
63
  },
64
64
  trys: [],
65
65
  ops: []
66
- }, f, y, t, g;
67
- return g = {
68
- next: verb(0),
69
- "throw": verb(1),
70
- "return": verb(2)
71
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
66
+ }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
67
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
72
68
  return this;
73
69
  }), g;
74
70
  function verb(n) {
@@ -5725,6 +5721,22 @@ exports.TextureSourceType = void 0;
5725
5721
  TextureSourceType[TextureSourceType["mipmaps"] = 7] = "mipmaps";
5726
5722
  })(exports.TextureSourceType || (exports.TextureSourceType = {}));
5727
5723
 
5724
+ var RUNTIME_ENV = "runtime_env";
5725
+ var RENDER_PREFER_LOOKUP_TEXTURE = "lookup_texture";
5726
+ // 文本元素使用 offscreen canvas 绘制
5727
+ var TEMPLATE_USE_OFFSCREEN_CANVAS = "offscreen_canvas";
5728
+ // 后处理配置相关
5729
+ var POST_PROCESS_SETTINGS = "post_process_settings";
5730
+ // 加载图片时是否使用 ImageBitmap
5731
+ var LOAD_PREFER_IMAGE_BITMAP = "load_image_bitmap";
5732
+ var config = {};
5733
+ function getConfig(name) {
5734
+ return config[name];
5735
+ }
5736
+ function setConfig(name, value) {
5737
+ return config[name] = value;
5738
+ }
5739
+
5728
5740
  /**
5729
5741
  * 负责下载各种资源,并提供了一些异步加载和缓存管理的功能
5730
5742
  */ var Downloader = /*#__PURE__*/ function() {
@@ -5813,11 +5825,11 @@ var avifFailed = false;
5813
5825
  * 异步加载一个 WebP 图片文件,如果不支持 WebP,则加载 PNG 图片文件
5814
5826
  * @param png - PNG 图片文件的 URL
5815
5827
  * @param webp - WebP 图片文件的 URL
5816
- */ function loadWebPOptional(png, webp) {
5828
+ */ function loadWebPOptional(png, webp, options) {
5817
5829
  return _loadWebPOptional.apply(this, arguments);
5818
5830
  }
5819
5831
  function _loadWebPOptional() {
5820
- _loadWebPOptional = _async_to_generator(function(png, webp) {
5832
+ _loadWebPOptional = _async_to_generator(function(png, webp, options) {
5821
5833
  var image, image1, image2;
5822
5834
  return __generator(this, function(_state) {
5823
5835
  switch(_state.label){
@@ -5828,7 +5840,7 @@ function _loadWebPOptional() {
5828
5840
  ];
5829
5841
  return [
5830
5842
  4,
5831
- loadImage(png)
5843
+ loadImageBitmap(png, options)
5832
5844
  ];
5833
5845
  case 1:
5834
5846
  image = _state.sent();
@@ -5848,7 +5860,7 @@ function _loadWebPOptional() {
5848
5860
  ]);
5849
5861
  return [
5850
5862
  4,
5851
- loadImage(webp)
5863
+ loadImageBitmap(webp, options)
5852
5864
  ];
5853
5865
  case 3:
5854
5866
  image1 = _state.sent();
@@ -5864,7 +5876,7 @@ function _loadWebPOptional() {
5864
5876
  webPFailed = true;
5865
5877
  return [
5866
5878
  4,
5867
- loadImage(png)
5879
+ loadImageBitmap(png, options)
5868
5880
  ];
5869
5881
  case 5:
5870
5882
  image2 = _state.sent();
@@ -5888,11 +5900,11 @@ function _loadWebPOptional() {
5888
5900
  * 异步加载一个 AVIF 图片文件,如果不支持 AVIF,则加载 PNG 图片文件
5889
5901
  * @param png - PNG 图片文件的 URL
5890
5902
  * @param avif - AVIF 图片文件的 URL
5891
- */ function loadAVIFOptional(png, avif) {
5903
+ */ function loadAVIFOptional(png, avif, options) {
5892
5904
  return _loadAVIFOptional.apply(this, arguments);
5893
5905
  }
5894
5906
  function _loadAVIFOptional() {
5895
- _loadAVIFOptional = _async_to_generator(function(png, avif) {
5907
+ _loadAVIFOptional = _async_to_generator(function(png, avif, options) {
5896
5908
  var image, image1, image2;
5897
5909
  return __generator(this, function(_state) {
5898
5910
  switch(_state.label){
@@ -5903,7 +5915,7 @@ function _loadAVIFOptional() {
5903
5915
  ];
5904
5916
  return [
5905
5917
  4,
5906
- loadImage(png)
5918
+ loadImageBitmap(png, options)
5907
5919
  ];
5908
5920
  case 1:
5909
5921
  image = _state.sent();
@@ -5923,7 +5935,7 @@ function _loadAVIFOptional() {
5923
5935
  ]);
5924
5936
  return [
5925
5937
  4,
5926
- loadImage(avif)
5938
+ loadImageBitmap(avif, options)
5927
5939
  ];
5928
5940
  case 3:
5929
5941
  image1 = _state.sent();
@@ -5939,7 +5951,7 @@ function _loadAVIFOptional() {
5939
5951
  avifFailed = true;
5940
5952
  return [
5941
5953
  4,
5942
- loadImage(png)
5954
+ loadImageBitmap(png, options)
5943
5955
  ];
5944
5956
  case 5:
5945
5957
  image2 = _state.sent();
@@ -6154,6 +6166,80 @@ function _loadMedia() {
6154
6166
  });
6155
6167
  return _loadMedia.apply(this, arguments);
6156
6168
  }
6169
+ var imageBitMapAvailable = typeof createImageBitmap === "function";
6170
+ /**
6171
+ * 异步加载一个图片文件,如果支持 ImageBitmap 则返回 ImageBitmap 对象
6172
+ * @param source
6173
+ * @param options
6174
+ * @returns
6175
+ */ function loadImageBitmap(source, options) {
6176
+ return _loadImageBitmap.apply(this, arguments);
6177
+ }
6178
+ function _loadImageBitmap() {
6179
+ _loadImageBitmap = _async_to_generator(function(source, options) {
6180
+ var blob;
6181
+ return __generator(this, function(_state) {
6182
+ switch(_state.label){
6183
+ case 0:
6184
+ if (!(imageBitMapAvailable && getConfig(LOAD_PREFER_IMAGE_BITMAP))) return [
6185
+ 3,
6186
+ 4
6187
+ ];
6188
+ if (!(typeof source === "string")) return [
6189
+ 3,
6190
+ 2
6191
+ ];
6192
+ return [
6193
+ 4,
6194
+ loadBlob(source)
6195
+ ];
6196
+ case 1:
6197
+ blob = _state.sent();
6198
+ return [
6199
+ 3,
6200
+ 3
6201
+ ];
6202
+ case 2:
6203
+ if (_instanceof1(source, Blob)) {
6204
+ blob = source;
6205
+ } else {
6206
+ return [
6207
+ 2,
6208
+ loadImage(source)
6209
+ ];
6210
+ }
6211
+ _state.label = 3;
6212
+ case 3:
6213
+ return [
6214
+ 2,
6215
+ createImageBitmap(blob, options)
6216
+ ];
6217
+ case 4:
6218
+ return [
6219
+ 2,
6220
+ loadImage(source)
6221
+ ];
6222
+ case 5:
6223
+ return [
6224
+ 2
6225
+ ];
6226
+ }
6227
+ });
6228
+ });
6229
+ return _loadImageBitmap.apply(this, arguments);
6230
+ }
6231
+ /**
6232
+ * 关闭 ImageBitMap,释放内存
6233
+ * @param imgs
6234
+ */ function closeImageBitMap(imgs) {
6235
+ if (imageBitMapAvailable) {
6236
+ if (_instanceof1(imgs, ImageBitmap)) {
6237
+ imgs.close();
6238
+ } else if (_instanceof1(imgs, Array)) {
6239
+ imgs.forEach(closeImageBitMap);
6240
+ }
6241
+ }
6242
+ }
6157
6243
 
6158
6244
  function deserializeMipmapTexture(textureOptions, bins, assets) {
6159
6245
  return _deserializeMipmapTexture.apply(this, arguments);
@@ -12756,8 +12842,8 @@ var BezierCurve = /*#__PURE__*/ function(ValueGetter) {
12756
12842
  return data;
12757
12843
  };
12758
12844
  _proto.getMaxTime = function getMaxTime() {
12759
- var keyTimeData = Object.keys(this.curveMap);
12760
- return Number(keyTimeData[keyTimeData.length - 1].split("&")[1]);
12845
+ var keyTimeData = this.keyTimeData;
12846
+ return this.curveMap[keyTimeData[keyTimeData.length - 1]].timeEnd;
12761
12847
  };
12762
12848
  return BezierCurve;
12763
12849
  }(ValueGetter);
@@ -12835,19 +12921,22 @@ var BezierCurvePath = /*#__PURE__*/ function(ValueGetter) {
12835
12921
  timeInterval: timeInterval,
12836
12922
  valueInterval: valueInterval,
12837
12923
  easingCurve: easingCurve,
12838
- pathCurve: pathCurve
12924
+ pathCurve: pathCurve,
12925
+ timeStart: Number(s.x),
12926
+ timeEnd: Number(e.x)
12839
12927
  };
12840
12928
  }
12929
+ this.keyTimeData = Object.keys(this.curveSegments);
12841
12930
  };
12842
12931
  _proto.getValue = function getValue(time) {
12843
12932
  var t = numberToFix(time, 5);
12844
12933
  var perc = 0, point = new Vector3();
12845
- var keyTimeData = Object.keys(this.curveSegments);
12934
+ var keyTimeData = this.keyTimeData;
12846
12935
  if (!keyTimeData.length) {
12847
12936
  return point;
12848
12937
  }
12849
- var keyTimeStart = Number(keyTimeData[0].split("&")[0]);
12850
- var keyTimeEnd = Number(keyTimeData[keyTimeData.length - 1].split("&")[1]);
12938
+ var keyTimeStart = this.curveSegments[keyTimeData[0]].timeStart;
12939
+ var keyTimeEnd = this.curveSegments[keyTimeData[keyTimeData.length - 1]].timeEnd;
12851
12940
  if (t <= keyTimeStart) {
12852
12941
  var pathCurve = this.curveSegments[keyTimeData[0]].pathCurve;
12853
12942
  point = pathCurve.getPointInPercent(0);
@@ -12859,7 +12948,8 @@ var BezierCurvePath = /*#__PURE__*/ function(ValueGetter) {
12859
12948
  return point;
12860
12949
  }
12861
12950
  for(var i = 0; i < keyTimeData.length; i++){
12862
- var _keyTimeData_i_split = keyTimeData[i].split("&"), xMin = _keyTimeData_i_split[0], xMax = _keyTimeData_i_split[1];
12951
+ var xMin = this.curveSegments[keyTimeData[i]].timeStart;
12952
+ var xMax = this.curveSegments[keyTimeData[i]].timeEnd;
12863
12953
  if (t >= Number(xMin) && t < Number(xMax)) {
12864
12954
  var bezierPath = this.curveSegments[keyTimeData[i]].pathCurve;
12865
12955
  perc = this.getPercValue(keyTimeData[i], t);
@@ -12878,8 +12968,8 @@ var BezierCurvePath = /*#__PURE__*/ function(ValueGetter) {
12878
12968
  return clamp$1(value, 0, 1);
12879
12969
  };
12880
12970
  _proto.getMaxTime = function getMaxTime() {
12881
- var keyTimeData = Object.keys(this.curveSegments);
12882
- return Number(keyTimeData[keyTimeData.length - 1].split("&")[1]);
12971
+ var keyTimeData = this.keyTimeData;
12972
+ return this.curveSegments[keyTimeData[keyTimeData.length - 1]].timeEnd;
12883
12973
  };
12884
12974
  return BezierCurvePath;
12885
12975
  }(ValueGetter);
@@ -13032,15 +13122,18 @@ function createKeyFrameMeta() {
13032
13122
  }
13033
13123
 
13034
13124
  function _is_native_reflect_construct() {
13035
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
13036
- if (Reflect.construct.sham) return false;
13037
- if (typeof Proxy === "function") return true;
13125
+ // Since Reflect.construct can't be properly polyfilled, some
13126
+ // implementations (e.g. core-js@2) don't set the correct internal slots.
13127
+ // Those polyfills don't allow us to subclass built-ins, so we need to
13128
+ // use our fallback implementation.
13038
13129
  try {
13039
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
13040
- return true;
13041
- } catch (e) {
13042
- return false;
13043
- }
13130
+ // If the internal slots aren't set, this throws an error similar to
13131
+ // TypeError: this is not a Boolean object.
13132
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
13133
+ } catch (_) {}
13134
+ return (_is_native_reflect_construct = function _is_native_reflect_construct() {
13135
+ return !!result;
13136
+ })();
13044
13137
  }
13045
13138
 
13046
13139
  function _construct(Parent, args, Class) {
@@ -15904,6 +15997,7 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
15904
15997
  if (this.animated) {
15905
15998
  this.buildPath(this.data);
15906
15999
  this.buildGeometryFromPath(this.path.shapePath);
16000
+ this.animated = false;
15907
16001
  }
15908
16002
  };
15909
16003
  _proto.buildGeometryFromPath = function buildGeometryFromPath(shapePath) {
@@ -17011,14 +17105,10 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17011
17105
  var playableOutput2 = _step2.value;
17012
17106
  this.processFrameWithRoot(playableOutput2);
17013
17107
  }
17014
- // 更新节点时间
17015
- for(var _iterator3 = _create_for_of_iterator_helper_loose(this.playables), _step3; !(_step3 = _iterator3()).done;){
17016
- var playable = _step3.value;
17017
- this.updatePlayableTime(playable, dt / 1000);
17018
- }
17019
- };
17020
- _proto.connect = function connect(source, sourceOutputPort, destination, destinationInputPort) {
17021
- destination.connectInput(destinationInputPort, source, sourceOutputPort);
17108
+ // 更新节点时间
17109
+ // for (const playable of this.playables) {
17110
+ // this.updatePlayableTime(playable, dt / 1000);
17111
+ // }
17022
17112
  };
17023
17113
  _proto.addOutput = function addOutput(output) {
17024
17114
  this.playableOutputs.push(output);
@@ -17027,12 +17117,12 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17027
17117
  this.playables.push(playable);
17028
17118
  };
17029
17119
  _proto.processFrameWithRoot = function processFrameWithRoot(output) {
17030
- output.sourcePlayable.processFrameRecursive(output.context, output.getSourceOutputPort());
17120
+ output.sourcePlayable.processFrame(output.context);
17031
17121
  output.processFrame();
17032
17122
  };
17033
17123
  _proto.prepareFrameWithRoot = function prepareFrameWithRoot(output) {
17034
- output.sourcePlayable.prepareFrameRecursive(output.context, output.getSourceOutputPort());
17035
17124
  output.prepareFrame();
17125
+ output.sourcePlayable.prepareFrame(output.context);
17036
17126
  };
17037
17127
  _proto.updatePlayableTime = function updatePlayableTime(playable, deltaTime) {
17038
17128
  if (playable.getPlayState() !== 0) {
@@ -17047,24 +17137,15 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17047
17137
  * @since 2.0.0
17048
17138
  */ var Playable = /*#__PURE__*/ function() {
17049
17139
  function Playable(graph, inputCount) {
17050
- if (inputCount === void 0) inputCount = 0;
17051
17140
  this.onPlayablePlayFlag = true;
17052
17141
  this.onPlayablePauseFlag = false;
17053
17142
  this.duration = 0;
17054
17143
  this.destroyed = false;
17055
- this.inputs = [];
17056
- this.inputOuputPorts = [];
17057
- this.inputWeight = [];
17058
- this.outputs = [];
17059
17144
  this.playState = 0;
17060
- this.traversalMode = 0;
17061
17145
  /**
17062
17146
  * 当前本地播放的时间
17063
17147
  */ this.time = 0;
17064
17148
  graph.addPlayable(this);
17065
- this.inputs = new Array(inputCount);
17066
- this.inputOuputPorts = new Array(inputCount);
17067
- this.inputWeight = new Array(inputCount);
17068
17149
  }
17069
17150
  var _proto = Playable.prototype;
17070
17151
  _proto.play = function play() {
@@ -17087,56 +17168,6 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17087
17168
  break;
17088
17169
  }
17089
17170
  };
17090
- _proto.connectInput = function connectInput(inputPort, sourcePlayable, sourceOutputPort, weight) {
17091
- if (weight === void 0) weight = 1.0;
17092
- this.setInput(sourcePlayable, inputPort);
17093
- this.setInputWeight(inputPort, weight);
17094
- sourcePlayable.setOutput(this, sourceOutputPort);
17095
- if (this.inputOuputPorts.length < inputPort + 1) {
17096
- this.inputOuputPorts.length = inputPort + 1;
17097
- }
17098
- this.inputOuputPorts[inputPort] = sourceOutputPort;
17099
- };
17100
- _proto.addInput = function addInput(sourcePlayable, sourceOutputPort, weight) {
17101
- if (weight === void 0) weight = 1.0;
17102
- this.connectInput(this.getInputCount(), sourcePlayable, sourceOutputPort, weight);
17103
- };
17104
- _proto.getInputCount = function getInputCount() {
17105
- return this.inputs.length;
17106
- };
17107
- _proto.getInputs = function getInputs() {
17108
- return this.inputs;
17109
- };
17110
- _proto.getInput = function getInput(index) {
17111
- return this.inputs[index];
17112
- };
17113
- _proto.getOutputCount = function getOutputCount() {
17114
- return this.outputs.length;
17115
- };
17116
- _proto.getOutputs = function getOutputs() {
17117
- return this.outputs;
17118
- };
17119
- _proto.getOutput = function getOutput(index) {
17120
- return this.outputs[index];
17121
- };
17122
- _proto.getInputWeight = function getInputWeight(inputIndex) {
17123
- return this.inputWeight[inputIndex];
17124
- };
17125
- _proto.setInputWeight = function setInputWeight(playableOrIndex, weight) {
17126
- if (_instanceof1(playableOrIndex, Playable)) {
17127
- for(var i = 0; i < this.inputs.length; i++){
17128
- if (this.inputs[i] === playableOrIndex) {
17129
- this.inputWeight[i] = weight;
17130
- return;
17131
- }
17132
- }
17133
- } else {
17134
- if (this.inputWeight.length < playableOrIndex + 1) {
17135
- this.inputWeight.length = playableOrIndex + 1;
17136
- }
17137
- this.inputWeight[playableOrIndex] = weight;
17138
- }
17139
- };
17140
17171
  _proto.setTime = function setTime(time) {
17141
17172
  this.time = time;
17142
17173
  };
@@ -17152,18 +17183,14 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17152
17183
  _proto.getPlayState = function getPlayState() {
17153
17184
  return this.playState;
17154
17185
  };
17155
- _proto.setTraversalMode = function setTraversalMode(mode) {
17156
- this.traversalMode = mode;
17157
- };
17158
- _proto.getTraversalMode = function getTraversalMode() {
17159
- return this.traversalMode;
17160
- };
17161
17186
  // onGraphStart () {
17162
17187
  // }
17163
17188
  // onGraphStop () {
17164
17189
  // }
17165
- _proto.onPlayablePlay = function onPlayablePlay(context) {};
17166
- _proto.onPlayablePause = function onPlayablePause(context) {};
17190
+ // onPlayablePlay (context: FrameContext) {
17191
+ // }
17192
+ // onPlayablePause (context: FrameContext) {
17193
+ // }
17167
17194
  _proto.prepareFrame = function prepareFrame(context) {};
17168
17195
  _proto.processFrame = function processFrame(context) {};
17169
17196
  _proto.onPlayableDestroy = function onPlayableDestroy() {};
@@ -17175,76 +17202,6 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17175
17202
  // TODO 将节点从动画图中移除
17176
17203
  this.destroyed = true;
17177
17204
  };
17178
- /**
17179
- * @internal
17180
- */ _proto.prepareFrameRecursive = function prepareFrameRecursive(context, passthroughPort) {
17181
- if (this.destroyed || this.playState !== 0) {
17182
- return;
17183
- }
17184
- if (this.onPlayablePlayFlag) {
17185
- this.onPlayablePlay(context);
17186
- this.onPlayablePlayFlag = false;
17187
- }
17188
- if (this.onPlayablePauseFlag) {
17189
- this.onPlayablePause(context);
17190
- this.onPlayablePauseFlag = false;
17191
- }
17192
- if (passthroughPort === 0) {
17193
- this.prepareFrame(context);
17194
- }
17195
- // 前序遍历,用于设置节点的初始状态,weight etc.
17196
- switch(this.getTraversalMode()){
17197
- case 0:
17198
- for(var i = 0; i < this.getInputCount(); i++){
17199
- var input = this.getInput(i);
17200
- input.prepareFrameRecursive(context, this.inputOuputPorts[i]);
17201
- }
17202
- break;
17203
- case 1:
17204
- {
17205
- var input1 = this.getInput(passthroughPort);
17206
- input1.prepareFrameRecursive(context, this.inputOuputPorts[passthroughPort]);
17207
- break;
17208
- }
17209
- }
17210
- };
17211
- /**
17212
- * @internal
17213
- */ _proto.processFrameRecursive = function processFrameRecursive(context, passthroughPort) {
17214
- if (this.destroyed || this.playState !== 0) {
17215
- return;
17216
- }
17217
- // 后序遍历,保证 playable 拿到的 input 节点的估计数据是最新的
17218
- switch(this.getTraversalMode()){
17219
- case 0:
17220
- {
17221
- for(var i = 0; i < this.getInputCount(); i++){
17222
- var input = this.getInput(i);
17223
- input.processFrameRecursive(context, this.inputOuputPorts[i]);
17224
- }
17225
- break;
17226
- }
17227
- case 1:
17228
- {
17229
- var input1 = this.getInput(passthroughPort);
17230
- input1.processFrameRecursive(context, this.inputOuputPorts[passthroughPort]);
17231
- break;
17232
- }
17233
- }
17234
- this.processFrame(context);
17235
- };
17236
- _proto.setOutput = function setOutput(outputPlayable, outputPort) {
17237
- if (this.outputs.length < outputPort + 1) {
17238
- this.outputs.length = outputPort + 1;
17239
- }
17240
- this.outputs[outputPort] = outputPlayable;
17241
- };
17242
- _proto.setInput = function setInput(inputPlayable, inputPort) {
17243
- if (this.inputs.length < inputPort + 1) {
17244
- this.inputs.length = inputPort + 1;
17245
- }
17246
- this.inputs[inputPort] = inputPlayable;
17247
- };
17248
17205
  return Playable;
17249
17206
  }();
17250
17207
  /**
@@ -17252,20 +17209,14 @@ var SpriteLoader = /*#__PURE__*/ function(AbstractPlugin) {
17252
17209
  * @since 2.0.0
17253
17210
  */ var PlayableOutput = /*#__PURE__*/ function() {
17254
17211
  function PlayableOutput() {
17255
- this.sourceOutputPort = 0;
17256
17212
  this.context = {
17257
17213
  deltaTime: 0,
17258
17214
  output: this
17259
17215
  };
17260
17216
  }
17261
17217
  var _proto = PlayableOutput.prototype;
17262
- _proto.setSourcePlayable = function setSourcePlayable(playable, port) {
17263
- if (port === void 0) port = 0;
17218
+ _proto.setSourcePlayable = function setSourcePlayable(playable) {
17264
17219
  this.sourcePlayable = playable;
17265
- this.sourceOutputPort = port;
17266
- };
17267
- _proto.getSourceOutputPort = function getSourceOutputPort() {
17268
- return this.sourceOutputPort;
17269
17220
  };
17270
17221
  _proto.setUserData = function setUserData(value) {
17271
17222
  this.userData = value;
@@ -17291,11 +17242,6 @@ var PlayState;
17291
17242
  PlayState[PlayState["Playing"] = 0] = "Playing";
17292
17243
  PlayState[PlayState["Paused"] = 1] = "Paused";
17293
17244
  })(PlayState || (PlayState = {}));
17294
- var PlayableTraversalMode;
17295
- (function(PlayableTraversalMode) {
17296
- PlayableTraversalMode[PlayableTraversalMode["Mix"] = 0] = "Mix";
17297
- PlayableTraversalMode[PlayableTraversalMode["Passthrough"] = 1] = "Passthrough";
17298
- })(PlayableTraversalMode || (PlayableTraversalMode = {}));
17299
17245
 
17300
17246
  var tempQuat$1 = new Quaternion();
17301
17247
  var seed$3 = 1;
@@ -18862,20 +18808,6 @@ exports.SpriteComponent = __decorate([
18862
18808
  effectsClass(DataType.SpriteComponent)
18863
18809
  ], exports.SpriteComponent);
18864
18810
 
18865
- var RUNTIME_ENV = "runtime_env";
18866
- var RENDER_PREFER_LOOKUP_TEXTURE = "lookup_texture";
18867
- // 文本元素使用 offscreen canvas 绘制
18868
- var TEMPLATE_USE_OFFSCREEN_CANVAS = "offscreen_canvas";
18869
- // 后处理配置相关
18870
- var POST_PROCESS_SETTINGS = "post_process_settings";
18871
- var config = {};
18872
- function getConfig(name) {
18873
- return config[name];
18874
- }
18875
- function setConfig(name, value) {
18876
- return config[name] = value;
18877
- }
18878
-
18879
18811
  var Cone = /*#__PURE__*/ function() {
18880
18812
  function Cone(props) {
18881
18813
  var _this = this;
@@ -22800,12 +22732,6 @@ var AnimationStream = /*#__PURE__*/ function() {
22800
22732
  _proto.findCurveValue = function findCurveValue(componentType, propertyName) {
22801
22733
  return this.curveValues[componentType + propertyName];
22802
22734
  };
22803
- _proto.getInputStream = function getInputStream(index) {
22804
- var inputPlayable = this.playable.getInput(index);
22805
- if (_instanceof1(inputPlayable, AnimationPlayable)) {
22806
- return inputPlayable.animationStream;
22807
- }
22808
- };
22809
22735
  return AnimationStream;
22810
22736
  }();
22811
22737
 
@@ -23140,266 +23066,147 @@ var AnimationClipPlayable = /*#__PURE__*/ function(Playable) {
23140
23066
  return AnimationClipPlayable;
23141
23067
  }(Playable);
23142
23068
 
23143
- /**
23144
- * @since 2.0.0
23145
- */ var TimelineClip = /*#__PURE__*/ function() {
23146
- function TimelineClip() {
23147
- this.start = 0;
23148
- this.duration = 0;
23149
- }
23150
- var _proto = TimelineClip.prototype;
23151
- _proto.toLocalTime = function toLocalTime(time) {
23152
- var localTime = time - this.start;
23153
- var duration = this.duration;
23154
- if (localTime - duration > 0) {
23155
- if (this.endBehavior === EndBehavior.restart) {
23156
- localTime = localTime % duration;
23157
- } else if (this.endBehavior === EndBehavior.freeze) {
23158
- localTime = Math.min(duration, localTime);
23159
- }
23160
- }
23161
- return localTime;
23162
- };
23163
- return TimelineClip;
23164
- }();
23165
- exports.TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
23166
- _inherits(TrackAsset, PlayableAsset);
23167
- function TrackAsset() {
23069
+ var TrackMixerPlayable = /*#__PURE__*/ function(Playable1) {
23070
+ _inherits(TrackMixerPlayable, Playable1);
23071
+ function TrackMixerPlayable() {
23168
23072
  var _this;
23169
- _this = PlayableAsset.apply(this, arguments) || this;
23170
- _this.trackType = 0;
23171
- _this.clipSeed = 0;
23172
- _this.clips = [];
23173
- _this.children = [];
23073
+ _this = Playable1.apply(this, arguments) || this;
23074
+ _this.clipPlayables = [];
23075
+ _this.clipWeights = [];
23174
23076
  return _this;
23175
23077
  }
23176
- var _proto = TrackAsset.prototype;
23177
- /**
23178
- * 重写该方法以获取自定义对象绑定
23179
- */ _proto.updateAnimatedObject = function updateAnimatedObject() {
23180
- if (this.parent) {
23181
- this.boundObject = this.parent.boundObject;
23078
+ var _proto = TrackMixerPlayable.prototype;
23079
+ _proto.processFrame = function processFrame(context) {
23080
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.clipPlayables), _step; !(_step = _iterator()).done;){
23081
+ var clipPlayable = _step.value;
23082
+ clipPlayable.processFrame(context);
23182
23083
  }
23084
+ this.evaluate(context);
23183
23085
  };
23184
- /**
23185
- * 重写该方法以创建自定义混合器
23186
- */ _proto.createTrackMixer = function createTrackMixer(graph) {
23187
- return new Playable(graph);
23086
+ _proto.setClipWeight = function setClipWeight(playableOrIndex, weight) {
23087
+ if (_instanceof1(playableOrIndex, Playable)) {
23088
+ for(var i = 0; i < this.clipPlayables.length; i++){
23089
+ if (this.clipPlayables[i] === playableOrIndex) {
23090
+ this.clipWeights[i] = weight;
23091
+ return;
23092
+ }
23093
+ }
23094
+ } else {
23095
+ if (this.clipWeights.length < playableOrIndex + 1) {
23096
+ this.clipWeights.length = playableOrIndex + 1;
23097
+ }
23098
+ this.clipWeights[playableOrIndex] = weight;
23099
+ }
23188
23100
  };
23189
- _proto.createOutput = function createOutput() {
23190
- var output = new PlayableOutput();
23191
- return output;
23101
+ _proto.getClipWeight = function getClipWeight(inputIndex) {
23102
+ return this.clipWeights[inputIndex];
23192
23103
  };
23193
- _proto.createPlayableGraph = function createPlayableGraph(graph, runtimeClips) {
23194
- var mixerPlayable = this.createMixerPlayableGraph(graph, runtimeClips);
23195
- return mixerPlayable;
23104
+ _proto.getClipPlayable = function getClipPlayable(index) {
23105
+ return this.clipPlayables[index];
23196
23106
  };
23197
- _proto.createMixerPlayableGraph = function createMixerPlayableGraph(graph, runtimeClips) {
23198
- var clips = [];
23199
- for(var _iterator = _create_for_of_iterator_helper_loose(this.clips), _step; !(_step = _iterator()).done;){
23200
- var clip = _step.value;
23201
- clips.push(clip);
23202
- }
23203
- var mixerPlayable = this.compileClips(graph, clips, runtimeClips);
23204
- return mixerPlayable;
23107
+ _proto.evaluate = function evaluate(context) {
23108
+ // Override
23205
23109
  };
23206
- _proto.compileClips = function compileClips(graph, timelineClips, runtimeClips) {
23207
- var mixer = this.createTrackMixer(graph);
23208
- for(var _iterator = _create_for_of_iterator_helper_loose(timelineClips), _step; !(_step = _iterator()).done;){
23209
- var timelineClip = _step.value;
23210
- var clipPlayable = this.createClipPlayable(graph, timelineClip);
23211
- clipPlayable.setDuration(timelineClip.duration);
23212
- var clip = new RuntimeClip(timelineClip, clipPlayable, mixer, this);
23213
- runtimeClips.push(clip);
23214
- mixer.addInput(clipPlayable, 0);
23215
- mixer.setInputWeight(clipPlayable, 0.0);
23110
+ return TrackMixerPlayable;
23111
+ }(Playable);
23112
+
23113
+ var ActivationMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
23114
+ _inherits(ActivationMixerPlayable, TrackMixerPlayable);
23115
+ function ActivationMixerPlayable() {
23116
+ return TrackMixerPlayable.apply(this, arguments);
23117
+ }
23118
+ var _proto = ActivationMixerPlayable.prototype;
23119
+ _proto.evaluate = function evaluate(context) {
23120
+ var boundObject = context.output.getUserData();
23121
+ if (!_instanceof1(boundObject, exports.VFXItem)) {
23122
+ return;
23123
+ }
23124
+ var boundItem = boundObject;
23125
+ var hasInput = false;
23126
+ for(var i = 0; i < this.clipPlayables.length; i++){
23127
+ if (this.getClipWeight(i) > 0) {
23128
+ hasInput = true;
23129
+ break;
23130
+ }
23131
+ }
23132
+ if (hasInput) {
23133
+ boundItem.transform.setValid(true);
23134
+ boundItem.setActive(true);
23135
+ } else {
23136
+ boundItem.transform.setValid(false);
23137
+ boundItem.setActive(false);
23216
23138
  }
23217
- return mixer;
23218
- };
23219
- _proto.createPlayable = function createPlayable(graph) {
23220
- return new Playable(graph);
23221
- };
23222
- _proto.getChildTracks = function getChildTracks() {
23223
- return this.children;
23224
23139
  };
23225
- _proto.addChild = function addChild(child) {
23226
- this.children.push(child);
23227
- child.parent = this;
23228
- };
23229
- _proto.createClip = function createClip(classConstructor, name) {
23230
- var newClip = new TimelineClip();
23231
- newClip.asset = new classConstructor(this.engine);
23232
- newClip.name = name ? name : "TimelineClip" + newClip.id;
23233
- this.addClip(newClip);
23234
- return newClip;
23235
- };
23236
- _proto.getClips = function getClips() {
23237
- return this.clips;
23238
- };
23239
- _proto.findClip = function findClip(name) {
23240
- for(var _iterator = _create_for_of_iterator_helper_loose(this.clips), _step; !(_step = _iterator()).done;){
23241
- var clip = _step.value;
23242
- if (clip.name === name) {
23243
- return clip;
23244
- }
23245
- }
23246
- };
23247
- _proto.addClip = function addClip(clip) {
23248
- clip.id = (this.clipSeed++).toString();
23249
- this.clips.push(clip);
23250
- };
23251
- _proto.createClipPlayable = function createClipPlayable(graph, clip) {
23252
- return clip.asset.createPlayable(graph);
23253
- };
23254
- _proto.fromData = function fromData(data) {
23255
- PlayableAsset.prototype.fromData.call(this, data);
23256
- for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
23257
- var child = _step.value;
23258
- child.parent = this;
23259
- }
23260
- };
23261
- return TrackAsset;
23262
- }(PlayableAsset);
23263
- __decorate([
23264
- serialize(TimelineClip)
23265
- ], exports.TrackAsset.prototype, "clips", void 0);
23266
- __decorate([
23267
- serialize()
23268
- ], exports.TrackAsset.prototype, "children", void 0);
23269
- exports.TrackAsset = __decorate([
23270
- effectsClass(DataType.TrackAsset)
23271
- ], exports.TrackAsset);
23272
- exports.TrackType = void 0;
23273
- (function(TrackType) {
23274
- TrackType[TrackType["MasterTrack"] = 0] = "MasterTrack";
23275
- TrackType[TrackType["ObjectTrack"] = 1] = "ObjectTrack";
23276
- })(exports.TrackType || (exports.TrackType = {}));
23277
- var RuntimeClip = /*#__PURE__*/ function() {
23278
- function RuntimeClip(clip, clipPlayable, parentMixer, track) {
23279
- this.clip = clip;
23280
- this.playable = clipPlayable;
23281
- this.parentMixer = parentMixer;
23282
- this.track = track;
23283
- if (_instanceof1(this.track.boundObject, exports.VFXItem)) {
23284
- this.particleSystem = this.track.boundObject.getComponent(exports.ParticleSystem);
23285
- }
23286
- }
23287
- var _proto = RuntimeClip.prototype;
23288
- _proto.evaluateAt = function evaluateAt(localTime) {
23289
- var clip = this.clip;
23290
- var weight = 1.0;
23291
- var ended = false;
23292
- var started = false;
23293
- var boundObject = this.track.boundObject;
23294
- if (localTime >= clip.start + clip.duration && clip.endBehavior === EndBehavior.destroy) {
23295
- if (_instanceof1(boundObject, exports.VFXItem) && exports.VFXItem.isParticle(boundObject) && this.particleSystem && !this.particleSystem.destroyed) {
23296
- weight = 1.0;
23297
- } else {
23298
- weight = 0.0;
23299
- ended = true;
23300
- }
23301
- } else if (localTime - this.clip.start >= 0) {
23302
- weight = 1.0;
23303
- started = true;
23304
- } else if (localTime < clip.start) {
23305
- weight = 0.0;
23306
- }
23307
- if (started && this.playable.getPlayState() !== PlayState.Playing) {
23308
- this.playable.play();
23309
- }
23310
- this.parentMixer.setInputWeight(this.playable, weight);
23311
- var clipTime = parseFloat(clip.toLocalTime(localTime).toFixed(3));
23312
- this.playable.setTime(clipTime);
23313
- // 判断动画是否结束
23314
- if (ended) {
23315
- if (this.playable.getPlayState() === PlayState.Playing) {
23316
- this.playable.pause();
23317
- }
23318
- }
23319
- };
23320
- _create_class(RuntimeClip, [
23321
- {
23322
- key: "enable",
23323
- set: function set(value) {
23324
- if (value) {
23325
- this.playable.play();
23326
- } else {
23327
- this.parentMixer.setInputWeight(this.playable, 0);
23328
- this.playable.pause();
23329
- }
23330
- }
23331
- }
23332
- ]);
23333
- return RuntimeClip;
23334
- }();
23140
+ return ActivationMixerPlayable;
23141
+ }(TrackMixerPlayable);
23335
23142
 
23336
- var ActivationMixerPlayable = /*#__PURE__*/ function(Playable) {
23337
- _inherits(ActivationMixerPlayable, Playable);
23338
- function ActivationMixerPlayable() {
23143
+ var PropertyClipPlayable = /*#__PURE__*/ function(Playable) {
23144
+ _inherits(PropertyClipPlayable, Playable);
23145
+ function PropertyClipPlayable() {
23339
23146
  return Playable.apply(this, arguments);
23340
23147
  }
23341
- var _proto = ActivationMixerPlayable.prototype;
23148
+ var _proto = PropertyClipPlayable.prototype;
23342
23149
  _proto.processFrame = function processFrame(context) {
23150
+ this.value = this.curve.getValue(this.time / this.getDuration());
23151
+ };
23152
+ return PropertyClipPlayable;
23153
+ }(Playable);
23154
+
23155
+ var ColorPropertyMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
23156
+ _inherits(ColorPropertyMixerPlayable, TrackMixerPlayable);
23157
+ function ColorPropertyMixerPlayable() {
23158
+ var _this;
23159
+ _this = TrackMixerPlayable.apply(this, arguments) || this;
23160
+ _this.propertyName = "";
23161
+ return _this;
23162
+ }
23163
+ var _proto = ColorPropertyMixerPlayable.prototype;
23164
+ _proto.evaluate = function evaluate(context) {
23343
23165
  var boundObject = context.output.getUserData();
23344
- if (!_instanceof1(boundObject, exports.VFXItem)) {
23166
+ if (!boundObject) {
23345
23167
  return;
23346
23168
  }
23347
- var boundItem = boundObject;
23348
23169
  var hasInput = false;
23349
- for(var i = 0; i < this.getInputCount(); i++){
23350
- if (this.getInputWeight(i) > 0) {
23170
+ var value = boundObject[this.propertyName];
23171
+ if (!_instanceof1(value, Color)) {
23172
+ return;
23173
+ }
23174
+ value.setZero();
23175
+ // evaluate the curve
23176
+ for(var i = 0; i < this.clipPlayables.length; i++){
23177
+ var weight = this.getClipWeight(i);
23178
+ if (weight > 0) {
23179
+ var propertyClipPlayable = this.getClipPlayable(i);
23180
+ if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
23181
+ console.error("ColorPropertyMixerPlayable received incompatible input");
23182
+ continue;
23183
+ }
23184
+ var curveValue = propertyClipPlayable.value;
23185
+ value.r += curveValue.r * weight;
23186
+ value.g += curveValue.g * weight;
23187
+ value.b += curveValue.b * weight;
23188
+ value.a += curveValue.a * weight;
23351
23189
  hasInput = true;
23352
- break;
23353
23190
  }
23354
23191
  }
23192
+ // set value
23355
23193
  if (hasInput) {
23356
- boundItem.transform.setValid(true);
23357
- boundItem.setActive(true);
23358
- } else {
23359
- boundItem.transform.setValid(false);
23360
- boundItem.setActive(false);
23194
+ boundObject[this.propertyName] = value;
23361
23195
  }
23362
23196
  };
23363
- return ActivationMixerPlayable;
23364
- }(Playable);
23365
-
23366
- exports.ActivationTrack = /*#__PURE__*/ function(TrackAsset) {
23367
- _inherits(ActivationTrack, TrackAsset);
23368
- function ActivationTrack() {
23369
- return TrackAsset.apply(this, arguments);
23370
- }
23371
- var _proto = ActivationTrack.prototype;
23372
- _proto.createTrackMixer = function createTrackMixer(graph) {
23373
- return new ActivationMixerPlayable(graph);
23374
- };
23375
- return ActivationTrack;
23376
- }(exports.TrackAsset);
23377
- exports.ActivationTrack = __decorate([
23378
- effectsClass(DataType.ActivationTrack)
23379
- ], exports.ActivationTrack);
23380
-
23381
- var PropertyClipPlayable = /*#__PURE__*/ function(Playable) {
23382
- _inherits(PropertyClipPlayable, Playable);
23383
- function PropertyClipPlayable() {
23384
- return Playable.apply(this, arguments);
23385
- }
23386
- var _proto = PropertyClipPlayable.prototype;
23387
- _proto.processFrame = function processFrame(context) {
23388
- this.value = this.curve.getValue(this.time / this.getDuration());
23389
- };
23390
- return PropertyClipPlayable;
23391
- }(Playable);
23197
+ return ColorPropertyMixerPlayable;
23198
+ }(TrackMixerPlayable);
23392
23199
 
23393
- var FloatPropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
23394
- _inherits(FloatPropertyMixerPlayable, Playable);
23200
+ var FloatPropertyMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
23201
+ _inherits(FloatPropertyMixerPlayable, TrackMixerPlayable);
23395
23202
  function FloatPropertyMixerPlayable() {
23396
23203
  var _this;
23397
- _this = Playable.apply(this, arguments) || this;
23204
+ _this = TrackMixerPlayable.apply(this, arguments) || this;
23398
23205
  _this.propertyName = "";
23399
23206
  return _this;
23400
23207
  }
23401
23208
  var _proto = FloatPropertyMixerPlayable.prototype;
23402
- _proto.processFrame = function processFrame(context) {
23209
+ _proto.evaluate = function evaluate(context) {
23403
23210
  var boundObject = context.output.getUserData();
23404
23211
  if (!boundObject) {
23405
23212
  return;
@@ -23407,10 +23214,10 @@ var FloatPropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
23407
23214
  var hasInput = false;
23408
23215
  var value = 0;
23409
23216
  // evaluate the curve
23410
- for(var i = 0; i < this.getInputCount(); i++){
23411
- var weight = this.getInputWeight(i);
23217
+ for(var i = 0; i < this.clipPlayables.length; i++){
23218
+ var weight = this.getClipWeight(i);
23412
23219
  if (weight > 0) {
23413
- var propertyClipPlayable = this.getInput(i);
23220
+ var propertyClipPlayable = this.getClipPlayable(i);
23414
23221
  if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
23415
23222
  console.error("FloatPropertyTrack added non-FloatPropertyPlayableAsset");
23416
23223
  continue;
@@ -23426,7 +23233,27 @@ var FloatPropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
23426
23233
  }
23427
23234
  };
23428
23235
  return FloatPropertyMixerPlayable;
23429
- }(Playable);
23236
+ }(TrackMixerPlayable);
23237
+
23238
+ var ParticleMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
23239
+ _inherits(ParticleMixerPlayable, TrackMixerPlayable);
23240
+ function ParticleMixerPlayable() {
23241
+ return TrackMixerPlayable.apply(this, arguments);
23242
+ }
23243
+ var _proto = ParticleMixerPlayable.prototype;
23244
+ _proto.evaluate = function evaluate(context) {};
23245
+ return ParticleMixerPlayable;
23246
+ }(TrackMixerPlayable);
23247
+
23248
+ var SpriteColorMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
23249
+ _inherits(SpriteColorMixerPlayable, TrackMixerPlayable);
23250
+ function SpriteColorMixerPlayable() {
23251
+ return TrackMixerPlayable.apply(this, arguments);
23252
+ }
23253
+ var _proto = SpriteColorMixerPlayable.prototype;
23254
+ _proto.evaluate = function evaluate(context) {};
23255
+ return SpriteColorMixerPlayable;
23256
+ }(TrackMixerPlayable);
23430
23257
 
23431
23258
  var SerializationHelper = /*#__PURE__*/ function() {
23432
23259
  function SerializationHelper() {}
@@ -23918,7 +23745,8 @@ var SerializationHelper = /*#__PURE__*/ function() {
23918
23745
  this.timelinePlayable.setTime(time);
23919
23746
  // The properties of the object may change dynamically,
23920
23747
  // so reset the track binding to avoid invalidation of the previously obtained binding object.
23921
- this.resolveBindings();
23748
+ // this.resolveBindings();
23749
+ this.timelinePlayable.evaluate();
23922
23750
  this.graph.evaluate(dt);
23923
23751
  };
23924
23752
  _proto.createContent = function createContent() {
@@ -24097,21 +23925,21 @@ var SubCompositionClipPlayable = /*#__PURE__*/ function(Playable) {
24097
23925
  return SubCompositionClipPlayable;
24098
23926
  }(Playable);
24099
23927
 
24100
- var SubCompositionMixerPlayable = /*#__PURE__*/ function(Playable) {
24101
- _inherits(SubCompositionMixerPlayable, Playable);
23928
+ var SubCompositionMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
23929
+ _inherits(SubCompositionMixerPlayable, TrackMixerPlayable);
24102
23930
  function SubCompositionMixerPlayable() {
24103
- return Playable.apply(this, arguments);
23931
+ return TrackMixerPlayable.apply(this, arguments);
24104
23932
  }
24105
23933
  var _proto = SubCompositionMixerPlayable.prototype;
24106
- _proto.processFrame = function processFrame(context) {
23934
+ _proto.evaluate = function evaluate(context) {
24107
23935
  var boundObject = context.output.getUserData();
24108
23936
  if (!_instanceof1(boundObject, CompositionComponent)) {
24109
23937
  return;
24110
23938
  }
24111
23939
  var compositionComponent = boundObject;
24112
23940
  var hasInput = false;
24113
- for(var i = 0; i < this.getInputCount(); i++){
24114
- if (this.getInputWeight(i) > 0) {
23941
+ for(var i = 0; i < this.clipPlayables.length; i++){
23942
+ if (this.getClipWeight(i) > 0) {
24115
23943
  hasInput = true;
24116
23944
  break;
24117
23945
  }
@@ -24123,18 +23951,28 @@ var SubCompositionMixerPlayable = /*#__PURE__*/ function(Playable) {
24123
23951
  }
24124
23952
  };
24125
23953
  return SubCompositionMixerPlayable;
24126
- }(Playable);
23954
+ }(TrackMixerPlayable);
24127
23955
 
24128
- var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
24129
- _inherits(Vector4PropertyMixerPlayable, Playable);
23956
+ var TransformMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
23957
+ _inherits(TransformMixerPlayable, TrackMixerPlayable);
23958
+ function TransformMixerPlayable() {
23959
+ return TrackMixerPlayable.apply(this, arguments);
23960
+ }
23961
+ var _proto = TransformMixerPlayable.prototype;
23962
+ _proto.evaluate = function evaluate(context) {};
23963
+ return TransformMixerPlayable;
23964
+ }(TrackMixerPlayable);
23965
+
23966
+ var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(TrackMixerPlayable) {
23967
+ _inherits(Vector4PropertyMixerPlayable, TrackMixerPlayable);
24130
23968
  function Vector4PropertyMixerPlayable() {
24131
23969
  var _this;
24132
- _this = Playable.apply(this, arguments) || this;
23970
+ _this = TrackMixerPlayable.apply(this, arguments) || this;
24133
23971
  _this.propertyName = "";
24134
23972
  return _this;
24135
23973
  }
24136
23974
  var _proto = Vector4PropertyMixerPlayable.prototype;
24137
- _proto.processFrame = function processFrame(context) {
23975
+ _proto.evaluate = function evaluate(context) {
24138
23976
  var boundObject = context.output.getUserData();
24139
23977
  if (!boundObject) {
24140
23978
  return;
@@ -24146,10 +23984,10 @@ var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
24146
23984
  }
24147
23985
  value.setZero();
24148
23986
  // evaluate the curve
24149
- for(var i = 0; i < this.getInputCount(); i++){
24150
- var weight = this.getInputWeight(i);
23987
+ for(var i = 0; i < this.clipPlayables.length; i++){
23988
+ var weight = this.getClipWeight(i);
24151
23989
  if (weight > 0) {
24152
- var propertyClipPlayable = this.getInput(i);
23990
+ var propertyClipPlayable = this.getClipPlayable(i);
24153
23991
  if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
24154
23992
  console.error("Vector4PropertyTrack added non-Vector4PropertyPlayableAsset");
24155
23993
  continue;
@@ -24168,52 +24006,215 @@ var Vector4PropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
24168
24006
  }
24169
24007
  };
24170
24008
  return Vector4PropertyMixerPlayable;
24171
- }(Playable);
24009
+ }(TrackMixerPlayable);
24172
24010
 
24173
- var ColorPropertyMixerPlayable = /*#__PURE__*/ function(Playable) {
24174
- _inherits(ColorPropertyMixerPlayable, Playable);
24175
- function ColorPropertyMixerPlayable() {
24011
+ /**
24012
+ * @since 2.0.0
24013
+ */ var TimelineClip = /*#__PURE__*/ function() {
24014
+ function TimelineClip() {
24015
+ this.start = 0;
24016
+ this.duration = 0;
24017
+ }
24018
+ var _proto = TimelineClip.prototype;
24019
+ _proto.toLocalTime = function toLocalTime(time) {
24020
+ var localTime = time - this.start;
24021
+ var duration = this.duration;
24022
+ if (localTime - duration > 0) {
24023
+ if (this.endBehavior === EndBehavior.restart) {
24024
+ localTime = localTime % duration;
24025
+ } else if (this.endBehavior === EndBehavior.freeze) {
24026
+ localTime = Math.min(duration, localTime);
24027
+ }
24028
+ }
24029
+ return localTime;
24030
+ };
24031
+ return TimelineClip;
24032
+ }();
24033
+ exports.TrackAsset = /*#__PURE__*/ function(PlayableAsset) {
24034
+ _inherits(TrackAsset, PlayableAsset);
24035
+ function TrackAsset() {
24176
24036
  var _this;
24177
- _this = Playable.apply(this, arguments) || this;
24178
- _this.propertyName = "";
24037
+ _this = PlayableAsset.apply(this, arguments) || this;
24038
+ _this.trackType = 0;
24039
+ _this.clipSeed = 0;
24040
+ _this.clips = [];
24041
+ _this.children = [];
24179
24042
  return _this;
24180
24043
  }
24181
- var _proto = ColorPropertyMixerPlayable.prototype;
24182
- _proto.processFrame = function processFrame(context) {
24183
- var boundObject = context.output.getUserData();
24184
- if (!boundObject) {
24185
- return;
24044
+ var _proto = TrackAsset.prototype;
24045
+ /**
24046
+ * 重写该方法以获取自定义对象绑定
24047
+ */ _proto.updateAnimatedObject = function updateAnimatedObject() {
24048
+ if (this.parent) {
24049
+ this.boundObject = this.parent.boundObject;
24186
24050
  }
24187
- var hasInput = false;
24188
- var value = boundObject[this.propertyName];
24189
- if (!_instanceof1(value, Color)) {
24190
- return;
24051
+ };
24052
+ /**
24053
+ * 重写该方法以创建自定义混合器
24054
+ */ _proto.createTrackMixer = function createTrackMixer(graph) {
24055
+ return new TrackMixerPlayable(graph);
24056
+ };
24057
+ _proto.createOutput = function createOutput() {
24058
+ var output = new PlayableOutput();
24059
+ return output;
24060
+ };
24061
+ _proto.createPlayableGraph = function createPlayableGraph(graph, runtimeClips) {
24062
+ var mixerPlayable = this.createMixerPlayableGraph(graph, runtimeClips);
24063
+ return mixerPlayable;
24064
+ };
24065
+ _proto.createMixerPlayableGraph = function createMixerPlayableGraph(graph, runtimeClips) {
24066
+ var clips = [];
24067
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.clips), _step; !(_step = _iterator()).done;){
24068
+ var clip = _step.value;
24069
+ clips.push(clip);
24191
24070
  }
24192
- value.setZero();
24193
- // evaluate the curve
24194
- for(var i = 0; i < this.getInputCount(); i++){
24195
- var weight = this.getInputWeight(i);
24196
- if (weight > 0) {
24197
- var propertyClipPlayable = this.getInput(i);
24198
- if (!_instanceof1(propertyClipPlayable, PropertyClipPlayable)) {
24199
- console.error("ColorPropertyMixerPlayable received incompatible input");
24200
- continue;
24201
- }
24202
- var curveValue = propertyClipPlayable.value;
24203
- value.r += curveValue.r * weight;
24204
- value.g += curveValue.g * weight;
24205
- value.b += curveValue.b * weight;
24206
- value.a += curveValue.a * weight;
24207
- hasInput = true;
24071
+ var mixerPlayable = this.compileClips(graph, clips, runtimeClips);
24072
+ return mixerPlayable;
24073
+ };
24074
+ _proto.compileClips = function compileClips(graph, timelineClips, runtimeClips) {
24075
+ var mixer = this.createTrackMixer(graph);
24076
+ for(var _iterator = _create_for_of_iterator_helper_loose(timelineClips), _step; !(_step = _iterator()).done;){
24077
+ var timelineClip = _step.value;
24078
+ var clipPlayable = this.createClipPlayable(graph, timelineClip);
24079
+ clipPlayable.setDuration(timelineClip.duration);
24080
+ var clip = new RuntimeClip(timelineClip, clipPlayable, mixer, this);
24081
+ runtimeClips.push(clip);
24082
+ mixer.clipPlayables.push(clipPlayable);
24083
+ mixer.setClipWeight(clipPlayable, 0.0);
24084
+ }
24085
+ return mixer;
24086
+ };
24087
+ _proto.createPlayable = function createPlayable(graph) {
24088
+ return new Playable(graph);
24089
+ };
24090
+ _proto.getChildTracks = function getChildTracks() {
24091
+ return this.children;
24092
+ };
24093
+ _proto.addChild = function addChild(child) {
24094
+ this.children.push(child);
24095
+ child.parent = this;
24096
+ };
24097
+ _proto.createClip = function createClip(classConstructor, name) {
24098
+ var newClip = new TimelineClip();
24099
+ newClip.asset = new classConstructor(this.engine);
24100
+ newClip.name = name ? name : "TimelineClip" + newClip.id;
24101
+ this.addClip(newClip);
24102
+ return newClip;
24103
+ };
24104
+ _proto.getClips = function getClips() {
24105
+ return this.clips;
24106
+ };
24107
+ _proto.findClip = function findClip(name) {
24108
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.clips), _step; !(_step = _iterator()).done;){
24109
+ var clip = _step.value;
24110
+ if (clip.name === name) {
24111
+ return clip;
24208
24112
  }
24209
24113
  }
24210
- // set value
24211
- if (hasInput) {
24212
- boundObject[this.propertyName] = value;
24114
+ };
24115
+ _proto.addClip = function addClip(clip) {
24116
+ clip.id = (this.clipSeed++).toString();
24117
+ this.clips.push(clip);
24118
+ };
24119
+ _proto.createClipPlayable = function createClipPlayable(graph, clip) {
24120
+ return clip.asset.createPlayable(graph);
24121
+ };
24122
+ _proto.fromData = function fromData(data) {
24123
+ PlayableAsset.prototype.fromData.call(this, data);
24124
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.children), _step; !(_step = _iterator()).done;){
24125
+ var child = _step.value;
24126
+ child.parent = this;
24213
24127
  }
24214
24128
  };
24215
- return ColorPropertyMixerPlayable;
24216
- }(Playable);
24129
+ return TrackAsset;
24130
+ }(PlayableAsset);
24131
+ __decorate([
24132
+ serialize(TimelineClip)
24133
+ ], exports.TrackAsset.prototype, "clips", void 0);
24134
+ __decorate([
24135
+ serialize()
24136
+ ], exports.TrackAsset.prototype, "children", void 0);
24137
+ exports.TrackAsset = __decorate([
24138
+ effectsClass(DataType.TrackAsset)
24139
+ ], exports.TrackAsset);
24140
+ exports.TrackType = void 0;
24141
+ (function(TrackType) {
24142
+ TrackType[TrackType["MasterTrack"] = 0] = "MasterTrack";
24143
+ TrackType[TrackType["ObjectTrack"] = 1] = "ObjectTrack";
24144
+ })(exports.TrackType || (exports.TrackType = {}));
24145
+ var RuntimeClip = /*#__PURE__*/ function() {
24146
+ function RuntimeClip(clip, clipPlayable, parentMixer, track) {
24147
+ this.clip = clip;
24148
+ this.playable = clipPlayable;
24149
+ this.parentMixer = parentMixer;
24150
+ this.track = track;
24151
+ if (_instanceof1(this.track.boundObject, exports.VFXItem)) {
24152
+ this.particleSystem = this.track.boundObject.getComponent(exports.ParticleSystem);
24153
+ }
24154
+ }
24155
+ var _proto = RuntimeClip.prototype;
24156
+ _proto.evaluateAt = function evaluateAt(localTime) {
24157
+ var clip = this.clip;
24158
+ var weight = 1.0;
24159
+ var ended = false;
24160
+ var started = false;
24161
+ var boundObject = this.track.boundObject;
24162
+ if (localTime >= clip.start + clip.duration && clip.endBehavior === EndBehavior.destroy) {
24163
+ if (_instanceof1(boundObject, exports.VFXItem) && exports.VFXItem.isParticle(boundObject) && this.particleSystem && !this.particleSystem.destroyed) {
24164
+ weight = 1.0;
24165
+ } else {
24166
+ weight = 0.0;
24167
+ ended = true;
24168
+ }
24169
+ } else if (localTime - this.clip.start >= 0) {
24170
+ weight = 1.0;
24171
+ started = true;
24172
+ } else if (localTime < clip.start) {
24173
+ weight = 0.0;
24174
+ }
24175
+ if (started && this.playable.getPlayState() !== PlayState.Playing) {
24176
+ this.playable.play();
24177
+ }
24178
+ this.parentMixer.setClipWeight(this.playable, weight);
24179
+ var clipTime = parseFloat(clip.toLocalTime(localTime).toFixed(3));
24180
+ this.playable.setTime(clipTime);
24181
+ // 判断动画是否结束
24182
+ if (ended) {
24183
+ if (this.playable.getPlayState() === PlayState.Playing) {
24184
+ this.playable.pause();
24185
+ }
24186
+ }
24187
+ };
24188
+ _create_class(RuntimeClip, [
24189
+ {
24190
+ key: "enable",
24191
+ set: function set(value) {
24192
+ if (value) {
24193
+ this.playable.play();
24194
+ } else {
24195
+ this.parentMixer.setClipWeight(this.playable, 0);
24196
+ this.playable.pause();
24197
+ }
24198
+ }
24199
+ }
24200
+ ]);
24201
+ return RuntimeClip;
24202
+ }();
24203
+
24204
+ exports.ActivationTrack = /*#__PURE__*/ function(TrackAsset) {
24205
+ _inherits(ActivationTrack, TrackAsset);
24206
+ function ActivationTrack() {
24207
+ return TrackAsset.apply(this, arguments);
24208
+ }
24209
+ var _proto = ActivationTrack.prototype;
24210
+ _proto.createTrackMixer = function createTrackMixer(graph) {
24211
+ return new ActivationMixerPlayable(graph);
24212
+ };
24213
+ return ActivationTrack;
24214
+ }(exports.TrackAsset);
24215
+ exports.ActivationTrack = __decorate([
24216
+ effectsClass(DataType.ActivationTrack)
24217
+ ], exports.ActivationTrack);
24217
24218
 
24218
24219
  var PropertyTrack = /*#__PURE__*/ function(TrackAsset) {
24219
24220
  _inherits(PropertyTrack, TrackAsset);
@@ -24286,6 +24287,10 @@ exports.SpriteColorTrack = /*#__PURE__*/ function(TrackAsset) {
24286
24287
  function SpriteColorTrack() {
24287
24288
  return TrackAsset.apply(this, arguments);
24288
24289
  }
24290
+ var _proto = SpriteColorTrack.prototype;
24291
+ _proto.createTrackMixer = function createTrackMixer(graph) {
24292
+ return new SpriteColorMixerPlayable(graph);
24293
+ };
24289
24294
  return SpriteColorTrack;
24290
24295
  }(exports.TrackAsset);
24291
24296
  exports.SpriteColorTrack = __decorate([
@@ -24318,6 +24323,10 @@ exports.TransformTrack = /*#__PURE__*/ function(TrackAsset) {
24318
24323
  function TransformTrack() {
24319
24324
  return TrackAsset.apply(this, arguments);
24320
24325
  }
24326
+ var _proto = TransformTrack.prototype;
24327
+ _proto.createTrackMixer = function createTrackMixer(graph) {
24328
+ return new TransformMixerPlayable(graph);
24329
+ };
24321
24330
  return TransformTrack;
24322
24331
  }(exports.TrackAsset);
24323
24332
  exports.TransformTrack = __decorate([
@@ -24346,6 +24355,18 @@ exports.MaterialTrack = __decorate([
24346
24355
  effectsClass("MaterialTrack")
24347
24356
  ], exports.MaterialTrack);
24348
24357
 
24358
+ var ParticleTrack = /*#__PURE__*/ function(TrackAsset) {
24359
+ _inherits(ParticleTrack, TrackAsset);
24360
+ function ParticleTrack() {
24361
+ return TrackAsset.apply(this, arguments);
24362
+ }
24363
+ var _proto = ParticleTrack.prototype;
24364
+ _proto.createTrackMixer = function createTrackMixer(graph) {
24365
+ return new ParticleMixerPlayable(graph);
24366
+ };
24367
+ return ParticleTrack;
24368
+ }(exports.TrackAsset);
24369
+
24349
24370
  exports.Vector4PropertyTrack = /*#__PURE__*/ function(PropertyTrack) {
24350
24371
  _inherits(Vector4PropertyTrack, PropertyTrack);
24351
24372
  function Vector4PropertyTrack() {
@@ -24474,7 +24495,6 @@ exports.TimelineAsset = /*#__PURE__*/ function(PlayableAsset) {
24474
24495
  var _proto = TimelineAsset.prototype;
24475
24496
  _proto.createPlayable = function createPlayable(graph) {
24476
24497
  var timelinePlayable = new TimelinePlayable(graph);
24477
- timelinePlayable.setTraversalMode(PlayableTraversalMode.Passthrough);
24478
24498
  for(var _iterator = _create_for_of_iterator_helper_loose(this.tracks), _step; !(_step = _iterator()).done;){
24479
24499
  var track = _step.value;
24480
24500
  if (_instanceof1(track, exports.ObjectBindingTrack)) {
@@ -24555,9 +24575,7 @@ var TimelinePlayable = /*#__PURE__*/ function(Playable) {
24555
24575
  return _this;
24556
24576
  }
24557
24577
  var _proto = TimelinePlayable.prototype;
24558
- _proto.prepareFrame = function prepareFrame(context) {
24559
- this.evaluate();
24560
- };
24578
+ _proto.prepareFrame = function prepareFrame(context) {};
24561
24579
  _proto.evaluate = function evaluate() {
24562
24580
  var time = this.getTime();
24563
24581
  // TODO search active clips
@@ -24574,11 +24592,10 @@ var TimelinePlayable = /*#__PURE__*/ function(Playable) {
24574
24592
  var track = _step.value;
24575
24593
  // create track mixer and track output
24576
24594
  var trackMixPlayable = track.createPlayableGraph(graph, this.clips);
24577
- this.addInput(trackMixPlayable, 0);
24578
24595
  var trackOutput = track.createOutput();
24579
24596
  trackOutput.setUserData(track.boundObject);
24580
24597
  graph.addOutput(trackOutput);
24581
- trackOutput.setSourcePlayable(this, this.getInputCount() - 1);
24598
+ trackOutput.setSourcePlayable(trackMixPlayable);
24582
24599
  // create track instance
24583
24600
  var trackInstance = new TrackInstance(track, trackMixPlayable, trackOutput);
24584
24601
  trackInstanceMap[track.getInstanceId()] = trackInstance;
@@ -24639,10 +24656,10 @@ exports.Vector4PropertyPlayableAsset = __decorate([
24639
24656
  effectsClass("Vector4PropertyPlayableAsset")
24640
24657
  ], exports.Vector4PropertyPlayableAsset);
24641
24658
 
24642
- exports.ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
24643
- _inherits(ObjectBindingTrack, TrackAsset1);
24659
+ exports.ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset) {
24660
+ _inherits(ObjectBindingTrack, TrackAsset);
24644
24661
  function ObjectBindingTrack() {
24645
- return TrackAsset1.apply(this, arguments);
24662
+ return TrackAsset.apply(this, arguments);
24646
24663
  }
24647
24664
  var _proto = ObjectBindingTrack.prototype;
24648
24665
  _proto.updateAnimatedObject = function updateAnimatedObject() {};
@@ -24653,7 +24670,7 @@ exports.ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
24653
24670
  var boundItem = this.boundObject;
24654
24671
  // 添加粒子动画 clip // TODO 待移除
24655
24672
  if (boundItem.getComponent(exports.ParticleSystem)) {
24656
- var particleTrack = timelineAsset.createTrack(exports.TrackAsset, this, "ParticleTrack");
24673
+ var particleTrack = timelineAsset.createTrack(ParticleTrack, this, "ParticleTrack");
24657
24674
  particleTrack.boundObject = this.boundObject;
24658
24675
  var particleClip = particleTrack.createClip(ParticleBehaviourPlayableAsset);
24659
24676
  particleClip.start = boundItem.start;
@@ -24683,7 +24700,7 @@ var TextLayout = /*#__PURE__*/ function() {
24683
24700
  this.width = textWidth;
24684
24701
  this.height = textHeight;
24685
24702
  this.letterSpace = letterSpace;
24686
- this.overFlow = textOverflow;
24703
+ this.overflow = textOverflow;
24687
24704
  this.textBaseline = textBaseline;
24688
24705
  this.textAlign = textAlign;
24689
24706
  this.lineHeight = lineHeight;
@@ -27298,6 +27315,7 @@ var seed = 1;
27298
27315
  this.downloader = downloader;
27299
27316
  this.assets = {};
27300
27317
  this.sourceFrom = {};
27318
+ this.imageBitmapOptions = {};
27301
27319
  this.id = seed++;
27302
27320
  this.timers = [];
27303
27321
  this.updateOptions(options);
@@ -27555,12 +27573,12 @@ var seed = 1;
27555
27573
  _proto.processJSON = function processJSON(json) {
27556
27574
  var _this = this;
27557
27575
  return _async_to_generator(function() {
27558
- var jsonScene, _jsonScene_plugins, plugins, pluginSystem;
27576
+ var jsonScene, _jsonScene_plugins, plugins, textures, pluginSystem;
27559
27577
  return __generator(this, function(_state) {
27560
27578
  switch(_state.label){
27561
27579
  case 0:
27562
27580
  jsonScene = getStandardJSON(json);
27563
- _jsonScene_plugins = jsonScene.plugins, plugins = _jsonScene_plugins === void 0 ? [] : _jsonScene_plugins;
27581
+ _jsonScene_plugins = jsonScene.plugins, plugins = _jsonScene_plugins === void 0 ? [] : _jsonScene_plugins, textures = jsonScene.textures;
27564
27582
  pluginSystem = new PluginSystem(plugins);
27565
27583
  return [
27566
27584
  4,
@@ -27568,6 +27586,7 @@ var seed = 1;
27568
27586
  ];
27569
27587
  case 1:
27570
27588
  _state.sent();
27589
+ _this.assignImageBitmapOptions(textures);
27571
27590
  return [
27572
27591
  2,
27573
27592
  {
@@ -27673,11 +27692,11 @@ var seed = 1;
27673
27692
  if (compressedTexture === void 0) compressedTexture = 0;
27674
27693
  var _this = this;
27675
27694
  return _async_to_generator(function() {
27676
- var _this_options, useCompressedTexture, variables, baseUrl, jobs, loadedImages;
27695
+ var _this_options, useCompressedTexture, variables, disableWebP, disableAVIF, baseUrl, jobs, loadedImages;
27677
27696
  return __generator(this, function(_state) {
27678
27697
  switch(_state.label){
27679
27698
  case 0:
27680
- _this_options = _this.options, useCompressedTexture = _this_options.useCompressedTexture, variables = _this_options.variables;
27699
+ _this_options = _this.options, useCompressedTexture = _this_options.useCompressedTexture, variables = _this_options.variables, disableWebP = _this_options.disableWebP, disableAVIF = _this_options.disableAVIF;
27681
27700
  baseUrl = _this.baseUrl;
27682
27701
  jobs = images.map(/*#__PURE__*/ _async_to_generator(function(img, idx) {
27683
27702
  var png, webp, avif, imageURL, webpURL, avifURL, id, template, background, url, isVideo, loadFn, resultImage, e, compressed, src, bufferURL, _ref, url1, image, _tmp;
@@ -27688,9 +27707,9 @@ var seed = 1;
27688
27707
  // eslint-disable-next-line compat/compat
27689
27708
  imageURL = new URL(png, baseUrl).href;
27690
27709
  // eslint-disable-next-line compat/compat
27691
- webpURL = webp && new URL(webp, baseUrl).href;
27710
+ webpURL = !disableWebP && webp ? new URL(webp, baseUrl).href : undefined;
27692
27711
  // eslint-disable-next-line compat/compat
27693
- avifURL = avif && new URL(avif, baseUrl).href;
27712
+ avifURL = !disableAVIF && avif ? new URL(avif, baseUrl).href : undefined;
27694
27713
  id = img.id;
27695
27714
  if (!("template" in img)) return [
27696
27715
  3,
@@ -27799,7 +27818,7 @@ var seed = 1;
27799
27818
  ];
27800
27819
  return [
27801
27820
  4,
27802
- loadAVIFOptional(imageURL, avifURL)
27821
+ loadAVIFOptional(imageURL, avifURL, _this.imageBitmapOptions[id])
27803
27822
  ];
27804
27823
  case 10:
27805
27824
  _tmp = _state.sent();
@@ -27810,7 +27829,7 @@ var seed = 1;
27810
27829
  case 11:
27811
27830
  return [
27812
27831
  4,
27813
- loadWebPOptional(imageURL, webpURL)
27832
+ loadWebPOptional(imageURL, webpURL, _this.imageBitmapOptions[id])
27814
27833
  ];
27815
27834
  case 12:
27816
27835
  _tmp = _state.sent();
@@ -28022,6 +28041,21 @@ var seed = 1;
28022
28041
  this.assets[images[i].id] = loadedImages[i];
28023
28042
  }
28024
28043
  };
28044
+ _proto.assignImageBitmapOptions = function assignImageBitmapOptions(textures) {
28045
+ var _this = this;
28046
+ if (textures === void 0) textures = [];
28047
+ textures.forEach(function(texture) {
28048
+ if (!(_instanceof1(texture, Texture) || "mipmaps" in texture)) {
28049
+ var source = texture.source;
28050
+ if (isObject(source)) {
28051
+ _this.imageBitmapOptions[source.id] = {
28052
+ imageOrientation: texture.flipY ? "flipY" : "none",
28053
+ premultiplyAlpha: texture.premultiplyAlpha ? "premultiply" : "none"
28054
+ };
28055
+ }
28056
+ }
28057
+ });
28058
+ };
28025
28059
  _proto.removeTimer = function removeTimer(id) {
28026
28060
  var index = this.timers.indexOf(id);
28027
28061
  if (index !== -1) {
@@ -28031,11 +28065,15 @@ var seed = 1;
28031
28065
  /**
28032
28066
  * 销毁方法
28033
28067
  */ _proto.dispose = function dispose() {
28068
+ var _this = this;
28034
28069
  if (this.timers.length) {
28035
28070
  this.timers.map(function(id) {
28036
28071
  return window.clearTimeout(id);
28037
28072
  });
28038
28073
  }
28074
+ closeImageBitMap(Object.keys(this.assets).map(function(key) {
28075
+ return _this.assets[key];
28076
+ }));
28039
28077
  this.assets = {};
28040
28078
  this.sourceFrom = {};
28041
28079
  this.timers = [];
@@ -28052,7 +28090,7 @@ function createTextureOptionsBySource(image, sourceFrom, id) {
28052
28090
  };
28053
28091
  if (_instanceof1(image, Texture)) {
28054
28092
  return _extends({}, image.source, options);
28055
- } else if (_instanceof1(image, HTMLImageElement) || isCanvas(image)) {
28093
+ } else if (_instanceof1(image, HTMLImageElement) || _instanceof1(image, ImageBitmap) || isCanvas(image)) {
28056
28094
  return _extends({
28057
28095
  image: image,
28058
28096
  sourceType: exports.TextureSourceType.image,
@@ -31385,7 +31423,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
31385
31423
  registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
31386
31424
  registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
31387
31425
  registerPlugin("interact", InteractLoader, exports.VFXItem, true);
31388
- var version = "2.1.5";
31426
+ var version = "2.2.0-alpha.0";
31389
31427
  logger.info("Core version: " + version + ".");
31390
31428
 
31391
31429
  exports.AbstractPlugin = AbstractPlugin;
@@ -31435,6 +31473,7 @@ exports.HELP_LINK = HELP_LINK;
31435
31473
  exports.InteractLoader = InteractLoader;
31436
31474
  exports.InteractMesh = InteractMesh;
31437
31475
  exports.KTXTexture = KTXTexture;
31476
+ exports.LOAD_PREFER_IMAGE_BITMAP = LOAD_PREFER_IMAGE_BITMAP;
31438
31477
  exports.LineSegments = LineSegments;
31439
31478
  exports.LinearValue = LinearValue;
31440
31479
  exports.Material = Material;
@@ -31448,6 +31487,7 @@ exports.ParticleBehaviourPlayableAsset = ParticleBehaviourPlayableAsset;
31448
31487
  exports.ParticleLoader = ParticleLoader;
31449
31488
  exports.ParticleMesh = ParticleMesh;
31450
31489
  exports.ParticleSystemRenderer = ParticleSystemRenderer;
31490
+ exports.ParticleTrack = ParticleTrack;
31451
31491
  exports.PassTextureCache = PassTextureCache;
31452
31492
  exports.PathSegments = PathSegments;
31453
31493
  exports.PluginSystem = PluginSystem;
@@ -31504,6 +31544,7 @@ exports.base64ToFile = base64ToFile;
31504
31544
  exports.blend = blend;
31505
31545
  exports.calculateTranslation = calculateTranslation;
31506
31546
  exports.canvasPool = canvasPool;
31547
+ exports.closeImageBitMap = closeImageBitMap;
31507
31548
  exports.colorGradingFrag = colorGradingFrag;
31508
31549
  exports.colorStopsFromGradient = colorStopsFromGradient;
31509
31550
  exports.colorToArr = colorToArr$1;
@@ -31582,6 +31623,7 @@ exports.loadAVIFOptional = loadAVIFOptional;
31582
31623
  exports.loadBinary = loadBinary;
31583
31624
  exports.loadBlob = loadBlob;
31584
31625
  exports.loadImage = loadImage;
31626
+ exports.loadImageBitmap = loadImageBitmap;
31585
31627
  exports.loadMedia = loadMedia;
31586
31628
  exports.loadVideo = loadVideo;
31587
31629
  exports.loadWebPOptional = loadWebPOptional;