@galacean/effects-threejs 1.1.3 → 1.1.5

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: v1.1.3
6
+ * Version: v1.1.5
7
7
  */
8
8
 
9
9
  'use strict';
@@ -14755,6 +14755,9 @@ var VFXItem = /** @class */ (function () {
14755
14755
  VFXItem.isTree = function (item) {
14756
14756
  return item.type === ItemType$1.tree;
14757
14757
  };
14758
+ VFXItem.isCamera = function (item) {
14759
+ return item.type === ItemType$1.camera;
14760
+ };
14758
14761
  VFXItem.isExtraCamera = function (item) {
14759
14762
  return item.id === 'extra-camera' && item.name === 'extra-camera';
14760
14763
  };
@@ -14955,10 +14958,11 @@ var VFXItem = /** @class */ (function () {
14955
14958
  }
14956
14959
  else if (this.endBehavior === END_BEHAVIOR_DESTROY$1) {
14957
14960
  this._contentVisible = false;
14961
+ shouldUpdate = true;
14962
+ dt = 0;
14958
14963
  // 预合成配置 reusable 且销毁时, 需要隐藏其中的元素
14959
14964
  if (this.type === ItemType$1.composition) {
14960
14965
  this.handleVisibleChanged(false);
14961
- this.onItemUpdate(0, lifetime);
14962
14966
  }
14963
14967
  }
14964
14968
  lifetime = Math.min(lifetime, 1);
@@ -14967,7 +14971,6 @@ var VFXItem = /** @class */ (function () {
14967
14971
  shouldUpdate = true;
14968
14972
  if (this.endBehavior === END_BEHAVIOR_RESTART$1) {
14969
14973
  this.ended = true;
14970
- lifetime = lifetime % 1;
14971
14974
  }
14972
14975
  }
14973
14976
  }
@@ -14975,7 +14978,7 @@ var VFXItem = /** @class */ (function () {
14975
14978
  this.setVisible(true);
14976
14979
  this.callEnd = false;
14977
14980
  }
14978
- this.lifetime = lifetime;
14981
+ this.lifetime = lifetime % 1;
14979
14982
  shouldUpdate && this.onItemUpdate(dt, lifetime);
14980
14983
  }
14981
14984
  }
@@ -15542,10 +15545,6 @@ var CameraVFXItem = /** @class */ (function (_super) {
15542
15545
  (_a = this.controller) === null || _a === void 0 ? void 0 : _a.update(lifetime);
15543
15546
  this.updateCamera();
15544
15547
  };
15545
- // override onEnd () {
15546
- // this.controller?.update(1);
15547
- // this.updateCamera();
15548
- // }
15549
15548
  CameraVFXItem.prototype.updateCamera = function () {
15550
15549
  if (this.controller && this.composition) {
15551
15550
  var camera = this.composition.camera;
@@ -19302,19 +19301,28 @@ var SpriteMesh = /** @class */ (function () {
19302
19301
  var aPointLen = 0;
19303
19302
  var indexLen = 0;
19304
19303
  var pointCount = 0;
19304
+ var renderInfo;
19305
19305
  if (!items.length) {
19306
19306
  this.mesh.setVisible(false);
19307
19307
  return true;
19308
19308
  }
19309
+ for (var i = 0; i < items.length; i++) {
19310
+ if (items[i].renderInfo) {
19311
+ renderInfo = items[i].renderInfo;
19312
+ break;
19313
+ }
19314
+ }
19315
+ if (!renderInfo) {
19316
+ return true;
19317
+ }
19309
19318
  this.items = items.slice();
19310
19319
  if (items.length > 2) {
19311
19320
  itemSlot = exports.maxSpriteMeshItemCount;
19312
19321
  }
19313
- var renderInfo = items[0].renderInfo;
19314
19322
  if (this.mtlSlotCount !== itemSlot) {
19315
19323
  this.mesh.setMaterial(this.createMaterial(renderInfo, itemSlot), { textures: exports.DestroyOptions.keep });
19316
19324
  }
19317
- var attachmentLength = (_d = (_c = (_b = (_a = renderInfo === null || renderInfo === void 0 ? void 0 : renderInfo.filter) === null || _a === void 0 ? void 0 : _a.passSplitOptions) === null || _b === void 0 ? void 0 : _b.attachments) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0;
19325
+ var attachmentLength = (_d = (_c = (_b = (_a = renderInfo.filter) === null || _a === void 0 ? void 0 : _a.passSplitOptions) === null || _b === void 0 ? void 0 : _b.attachments) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0;
19318
19326
  this.splitLayer = attachmentLength > 0;
19319
19327
  for (var i = 0; i < items.length; i++) {
19320
19328
  var item = items[i];
@@ -23590,7 +23598,7 @@ var ParticleSystem = /** @class */ (function () {
23590
23598
  configurable: true
23591
23599
  });
23592
23600
  ParticleSystem.prototype.updateEmitterTransform = function (time) {
23593
- var parentTransform = this.parentTransform;
23601
+ var parentTransform = this.transform.parentTransform;
23594
23602
  var _a = this.basicTransform, path = _a.path, position = _a.position;
23595
23603
  var selfPos = position.clone();
23596
23604
  if (path) {
@@ -23600,9 +23608,9 @@ var ParticleSystem = /** @class */ (function () {
23600
23608
  this.transform.setPosition(selfPos.x, selfPos.y, selfPos.z);
23601
23609
  if (this.options.particleFollowParent && parentTransform) {
23602
23610
  var tempMatrix = parentTransform.getWorldMatrix();
23603
- this.particleMesh.mesh.worldMatrix = tempMatrix.clone();
23611
+ this.particleMesh.mesh.worldMatrix = tempMatrix;
23604
23612
  if (this.trailMesh) {
23605
- this.trailMesh.mesh.worldMatrix = tempMatrix.clone();
23613
+ this.trailMesh.mesh.worldMatrix = tempMatrix;
23606
23614
  }
23607
23615
  }
23608
23616
  };
@@ -23621,8 +23629,8 @@ var ParticleSystem = /** @class */ (function () {
23621
23629
  link.pushNode(linkContent);
23622
23630
  this.particleMesh.setPoint(point, pointIndex);
23623
23631
  this.clearPointTrail(pointIndex);
23624
- if (this.parentTransform && this.trailMesh) {
23625
- this.trailMesh.setPointStartPos(pointIndex, this.parentTransform.position.clone());
23632
+ if (this.trailMesh) {
23633
+ this.trailMesh.setPointStartPos(pointIndex, this.transform.parentTransform.position.clone());
23626
23634
  }
23627
23635
  };
23628
23636
  ParticleSystem.prototype.setVisible = function (visible) {
@@ -23660,7 +23668,8 @@ var ParticleSystem = /** @class */ (function () {
23660
23668
  }
23661
23669
  };
23662
23670
  ParticleSystem.prototype.setParentTransform = function (transform) {
23663
- this.parentTransform = transform;
23671
+ // this.transform.parentTransform = transform;
23672
+ // this.parentTransform = transform;
23664
23673
  };
23665
23674
  ParticleSystem.prototype.getTextures = function () {
23666
23675
  var e_1, _a, e_2, _b;
@@ -23912,9 +23921,7 @@ var ParticleSystem = /** @class */ (function () {
23912
23921
  if (options.removeParticle) {
23913
23922
  mesh.removePoint(pointIndex);
23914
23923
  this.clearPointTrail(pointIndex);
23915
- link.removeNode(node);
23916
- node.content = [0];
23917
- // link.shiftNode(node.content); // 删了又加回去 没明白什么意思
23924
+ node.content[0] = 0;
23918
23925
  }
23919
23926
  hitPositions.push(pos);
23920
23927
  if (!options.multiple) {
@@ -23953,8 +23960,8 @@ var ParticleSystem = /** @class */ (function () {
23953
23960
  if (trails.sizeAffectsLifetime) {
23954
23961
  lifetime *= size[0];
23955
23962
  }
23956
- if (trails.parentAffectsPosition && this.parentTransform) {
23957
- position.add(this.parentTransform.position);
23963
+ if (trails.parentAffectsPosition && this.transform.parentTransform) {
23964
+ position.add(this.transform.parentTransform.position);
23958
23965
  var pos = this.trailMesh.getPointStartPos(pointIndex);
23959
23966
  if (pos) {
23960
23967
  position.subtract(pos);
@@ -24168,7 +24175,9 @@ function randomArrItem(arr, keepArr) {
24168
24175
  var ParticleVFXItem = /** @class */ (function (_super) {
24169
24176
  __extends(ParticleVFXItem, _super);
24170
24177
  function ParticleVFXItem() {
24171
- return _super !== null && _super.apply(this, arguments) || this;
24178
+ var _this = _super !== null && _super.apply(this, arguments) || this;
24179
+ _this.destroyed = false;
24180
+ return _this;
24172
24181
  }
24173
24182
  Object.defineProperty(ParticleVFXItem.prototype, "type", {
24174
24183
  get: function () {
@@ -24194,12 +24203,11 @@ var ParticleVFXItem = /** @class */ (function (_super) {
24194
24203
  ParticleVFXItem.prototype.onItemUpdate = function (dt, lifetime) {
24195
24204
  var _a;
24196
24205
  if (this.content) {
24197
- var hide = !this.contentVisible;
24206
+ var hide = !this.visible;
24198
24207
  var parentItem = this.parentId && ((_a = this.composition) === null || _a === void 0 ? void 0 : _a.getItemByID(this.parentId));
24199
24208
  if (!hide && parentItem) {
24200
24209
  var parentData = parentItem.getRenderData();
24201
24210
  if (parentData) {
24202
- this.content.setParentTransform(parentData.transform);
24203
24211
  if (!parentData.visible) {
24204
24212
  hide = false;
24205
24213
  }
@@ -29202,7 +29210,6 @@ var CompositionSourceManager = /** @class */ (function () {
29202
29210
  }
29203
29211
  var cachedTextures = textureOptions.map(function (option) { return option && (option instanceof Texture ? option : Texture.create(engine, option)); });
29204
29212
  // 缓存创建的Texture对象
29205
- // @ts-expect-error
29206
29213
  scene.textureOptions = cachedTextures;
29207
29214
  cachedTextures === null || cachedTextures === void 0 ? void 0 : cachedTextures.forEach(function (tex) { return tex === null || tex === void 0 ? void 0 : tex.initialize(); });
29208
29215
  try {
@@ -29432,24 +29439,24 @@ var AssetManager = /** @class */ (function () {
29432
29439
  this.timeout = timeout;
29433
29440
  };
29434
29441
  /**
29435
- * 场景创建
29436
- * 通过 json 创建出场景对象,并进行提前编译等工作
29442
+ * 场景创建,通过 json 创建出场景对象,并进行提前编译等工作
29437
29443
  * @param url - json 的 URL 链接或者 json 对象
29438
29444
  * @param renderer - renderer 对象,用于获取管理、编译 shader 及 GPU 上下文的参数
29439
29445
  * @param options - 扩展参数
29440
29446
  * @returns
29441
29447
  */
29442
29448
  AssetManager.prototype.loadScene = function (url, renderer, options) {
29443
- var _a, _b;
29449
+ var _a, _b, _c;
29444
29450
  return __awaiter(this, void 0, void 0, function () {
29445
- var rawJSON, timeLabel, startTime, timeInfos, gpuInstance, asyncShaderCompile, loadTimer, cancelLoading, waitPromise, hookTimeInfo, loadResourcePromise;
29451
+ var rawJSON, timeLabel, startTime, timeInfos, gpuInstance, asyncShaderCompile, compressedTexture, loadTimer, cancelLoading, waitPromise, hookTimeInfo, loadResourcePromise;
29446
29452
  var _this = this;
29447
- return __generator(this, function (_c) {
29453
+ return __generator(this, function (_d) {
29448
29454
  timeLabel = "Load asset: ".concat(isString(url) ? url : this.id);
29449
29455
  startTime = performance.now();
29450
29456
  timeInfos = [];
29451
29457
  gpuInstance = renderer === null || renderer === void 0 ? void 0 : renderer.engine.gpuCapability;
29452
29458
  asyncShaderCompile = (_b = (_a = gpuInstance === null || gpuInstance === void 0 ? void 0 : gpuInstance.detail) === null || _a === void 0 ? void 0 : _a.asyncShaderCompile) !== null && _b !== void 0 ? _b : false;
29459
+ compressedTexture = (_c = gpuInstance === null || gpuInstance === void 0 ? void 0 : gpuInstance.detail.compressedTexture) !== null && _c !== void 0 ? _c : 0;
29453
29460
  cancelLoading = false;
29454
29461
  waitPromise = new Promise(function (resolve, reject) {
29455
29462
  return loadTimer = window.setTimeout(function () {
@@ -29474,10 +29481,10 @@ var AssetManager = /** @class */ (function () {
29474
29481
  });
29475
29482
  }); };
29476
29483
  loadResourcePromise = function () { return __awaiter(_this, void 0, void 0, function () {
29477
- var _a, usedImages, jsonScene, _b, bins, images, compositions, fonts, _c, loadedBins, loadedImages, loadedTextures, scene, totalTime;
29484
+ var scene, rawImages, images_1, i, _a, i, _b, usedImages_1, jsonScene_1, pluginSystem_1, _c, bins_1, images_2, compositions_1, fonts_1, _d, loadedBins_1, loadedImages_1, loadedTextures, totalTime;
29478
29485
  var _this = this;
29479
- return __generator(this, function (_d) {
29480
- switch (_d.label) {
29486
+ return __generator(this, function (_e) {
29487
+ switch (_e.label) {
29481
29488
  case 0:
29482
29489
  if (!isObject(url)) return [3 /*break*/, 1];
29483
29490
  // TODO: 原 JSONLoader contructor 判断是否兼容
@@ -29490,42 +29497,66 @@ var AssetManager = /** @class */ (function () {
29490
29497
  this.baseUrl = url;
29491
29498
  return [4 /*yield*/, hookTimeInfo('loadJSON', function () { return _this.loadJSON(url); })];
29492
29499
  case 2:
29493
- rawJSON = _d.sent();
29494
- _d.label = 3;
29495
- case 3: return [4 /*yield*/, hookTimeInfo('processJSON', function () { return _this.processJSON(rawJSON); })];
29500
+ rawJSON = _e.sent();
29501
+ _e.label = 3;
29502
+ case 3:
29503
+ if (!isScene(rawJSON)) return [3 /*break*/, 6];
29504
+ // 已经加载过的 可能需要更新数据模板
29505
+ scene = __assign$1({}, rawJSON);
29506
+ if (!(this.options && this.options.variables && Object.keys(this.options.variables).length !== 0)) return [3 /*break*/, 5];
29507
+ rawImages = rawJSON.jsonScene.images;
29508
+ images_1 = scene.images;
29509
+ for (i = 0; i < rawImages.length; i++) {
29510
+ // 仅重新加载数据模板对应的图片
29511
+ if (images_1[i] instanceof HTMLCanvasElement) {
29512
+ images_1[i] = rawImages[i];
29513
+ }
29514
+ }
29515
+ _a = scene;
29516
+ return [4 /*yield*/, hookTimeInfo('processImages', function () { return _this.processImages(images_1, scene.usedImages, compressedTexture); })];
29496
29517
  case 4:
29497
- _a = _d.sent(), usedImages = _a.usedImages, jsonScene = _a.jsonScene;
29498
- _b = jsonScene.bins, bins = _b === void 0 ? [] : _b, images = jsonScene.images, compositions = jsonScene.compositions, fonts = jsonScene.fonts;
29518
+ _a.images = _e.sent();
29519
+ // 更新 TextureOptions 中的 image 指向
29520
+ for (i = 0; i < scene.images.length; i++) {
29521
+ scene.textureOptions[i].image = scene.images[i];
29522
+ }
29523
+ _e.label = 5;
29524
+ case 5: return [3 /*break*/, 12];
29525
+ case 6: return [4 /*yield*/, hookTimeInfo('processJSON', function () { return _this.processJSON(rawJSON); })];
29526
+ case 7:
29527
+ _b = _e.sent(), usedImages_1 = _b.usedImages, jsonScene_1 = _b.jsonScene, pluginSystem_1 = _b.pluginSystem;
29528
+ _c = jsonScene_1.bins, bins_1 = _c === void 0 ? [] : _c, images_2 = jsonScene_1.images, compositions_1 = jsonScene_1.compositions, fonts_1 = jsonScene_1.fonts;
29499
29529
  return [4 /*yield*/, Promise.all([
29500
- hookTimeInfo('processBins', function () { return _this.processBins(bins); }),
29501
- hookTimeInfo('processImages', function () { var _a; return _this.processImages(images, usedImages, (_a = gpuInstance === null || gpuInstance === void 0 ? void 0 : gpuInstance.detail.compressedTexture) !== null && _a !== void 0 ? _a : 0); }),
29502
- hookTimeInfo("".concat(asyncShaderCompile ? 'async' : 'sync', " compile"), function () { return _this.precompile(compositions, renderer, options); }),
29530
+ hookTimeInfo('processBins', function () { return _this.processBins(bins_1); }),
29531
+ hookTimeInfo('processImages', function () { return _this.processImages(images_2, usedImages_1, compressedTexture); }),
29532
+ hookTimeInfo("".concat(asyncShaderCompile ? 'async' : 'sync', " compile"), function () { return _this.precompile(compositions_1, pluginSystem_1, renderer, options); }),
29503
29533
  ])];
29504
- case 5:
29505
- _c = __read$3.apply(void 0, [_d.sent(), 2]), loadedBins = _c[0], loadedImages = _c[1];
29506
- return [4 /*yield*/, hookTimeInfo('processFontURL', function () { return _this.processFontURL(fonts); })];
29507
- case 6:
29508
- _d.sent();
29509
- return [4 /*yield*/, hookTimeInfo('processTextures', function () { return _this.processTextures(loadedImages, loadedBins, jsonScene); })];
29510
- case 7:
29511
- loadedTextures = _d.sent();
29534
+ case 8:
29535
+ _d = __read$3.apply(void 0, [_e.sent(), 2]), loadedBins_1 = _d[0], loadedImages_1 = _d[1];
29536
+ return [4 /*yield*/, hookTimeInfo('processFontURL', function () { return _this.processFontURL(fonts_1); })];
29537
+ case 9:
29538
+ _e.sent();
29539
+ return [4 /*yield*/, hookTimeInfo('processTextures', function () { return _this.processTextures(loadedImages_1, loadedBins_1, jsonScene_1); })];
29540
+ case 10:
29541
+ loadedTextures = _e.sent();
29512
29542
  scene = {
29513
- jsonScene: jsonScene,
29514
- images: loadedImages,
29515
- textureOptions: loadedTextures,
29516
- bins: loadedBins,
29517
- storage: {},
29518
- pluginSystem: this.pluginSystem,
29519
- renderLevel: this.options.renderLevel,
29520
- totalTime: 0,
29521
- startTime: 0,
29522
29543
  url: url,
29544
+ renderLevel: this.options.renderLevel,
29545
+ storage: {},
29546
+ pluginSystem: pluginSystem_1,
29547
+ jsonScene: jsonScene_1,
29548
+ usedImages: usedImages_1,
29549
+ images: loadedImages_1,
29550
+ textureOptions: loadedTextures,
29551
+ bins: loadedBins_1,
29523
29552
  };
29524
29553
  // 触发插件系统 pluginSystem 的回调 prepareResource
29525
- return [4 /*yield*/, hookTimeInfo('processPlugins', function () { return _this.pluginSystem.loadResources(scene, _this.options); })];
29526
- case 8:
29554
+ return [4 /*yield*/, hookTimeInfo('processPlugins', function () { return pluginSystem_1.loadResources(scene, _this.options); })];
29555
+ case 11:
29527
29556
  // 触发插件系统 pluginSystem 的回调 prepareResource
29528
- _d.sent();
29557
+ _e.sent();
29558
+ _e.label = 12;
29559
+ case 12:
29529
29560
  totalTime = performance.now() - startTime;
29530
29561
  console.info({
29531
29562
  content: "".concat(timeLabel, ": ").concat(totalTime.toFixed(4), "ms, ").concat(timeInfos.join(' ')),
@@ -29542,7 +29573,7 @@ var AssetManager = /** @class */ (function () {
29542
29573
  });
29543
29574
  });
29544
29575
  };
29545
- AssetManager.prototype.precompile = function (compositions, renderer, options) {
29576
+ AssetManager.prototype.precompile = function (compositions, pluginSystem, renderer, options) {
29546
29577
  return __awaiter(this, void 0, void 0, function () {
29547
29578
  var shaderLibrary;
29548
29579
  return __generator(this, function (_a) {
@@ -29552,7 +29583,7 @@ var AssetManager = /** @class */ (function () {
29552
29583
  return [2 /*return*/];
29553
29584
  }
29554
29585
  shaderLibrary = renderer === null || renderer === void 0 ? void 0 : renderer.getShaderLibrary();
29555
- return [4 /*yield*/, this.pluginSystem.precompile(compositions, renderer, options)];
29586
+ return [4 /*yield*/, (pluginSystem === null || pluginSystem === void 0 ? void 0 : pluginSystem.precompile(compositions, renderer, options))];
29556
29587
  case 1:
29557
29588
  _a.sent();
29558
29589
  return [4 /*yield*/, new Promise(function (resolve) {
@@ -29569,7 +29600,7 @@ var AssetManager = /** @class */ (function () {
29569
29600
  };
29570
29601
  AssetManager.prototype.processJSON = function (json) {
29571
29602
  return __awaiter(this, void 0, void 0, function () {
29572
- var jsonScene, _a, plugins, sceneCompositions, imgUsage, images, renderLevel, usedImages;
29603
+ var jsonScene, _a, plugins, sceneCompositions, imgUsage, images, pluginSystem, renderLevel, usedImages;
29573
29604
  return __generator(this, function (_b) {
29574
29605
  switch (_b.label) {
29575
29606
  case 0:
@@ -29583,8 +29614,8 @@ var AssetManager = /** @class */ (function () {
29583
29614
  }
29584
29615
  });
29585
29616
  _a = jsonScene.plugins, plugins = _a === void 0 ? [] : _a, sceneCompositions = jsonScene.compositions, imgUsage = jsonScene.imgUsage, images = jsonScene.images;
29586
- this.pluginSystem = new PluginSystem(plugins);
29587
- return [4 /*yield*/, this.pluginSystem.processRawJSON(jsonScene, this.options)];
29617
+ pluginSystem = new PluginSystem(plugins);
29618
+ return [4 /*yield*/, pluginSystem.processRawJSON(jsonScene, this.options)];
29588
29619
  case 1:
29589
29620
  _b.sent();
29590
29621
  renderLevel = this.options.renderLevel;
@@ -29601,6 +29632,7 @@ var AssetManager = /** @class */ (function () {
29601
29632
  return [2 /*return*/, {
29602
29633
  usedImages: usedImages,
29603
29634
  jsonScene: jsonScene,
29635
+ pluginSystem: pluginSystem,
29604
29636
  }];
29605
29637
  }
29606
29638
  });
@@ -29984,7 +30016,8 @@ var CompVFXItem = /** @class */ (function (_super) {
29984
30016
  }
29985
30017
  else {
29986
30018
  item = createVFXItem(this.itemProps[i], this.composition);
29987
- item.transform.parentTransform = this.transform;
30019
+ // 相机不跟随合成移动
30020
+ item.transform.parentTransform = VFXItem.isCamera(item) ? new Transform() : this.transform;
29988
30021
  }
29989
30022
  if (VFXItem.isExtraCamera(item)) {
29990
30023
  this.extraCamera = item;
@@ -30170,7 +30203,7 @@ var CompVFXItem = /** @class */ (function (_super) {
30170
30203
  if (!parentItem) {
30171
30204
  itemNode.parentId = undefined;
30172
30205
  item.parent = undefined;
30173
- item.transform.parentTransform = this.transform;
30206
+ item.transform.parentTransform = VFXItem.isExtraCamera(item) ? new Transform() : this.transform;
30174
30207
  }
30175
30208
  else {
30176
30209
  var parentNode = this.itemCacheMap.get(parentItem.id);
@@ -30467,7 +30500,7 @@ var Composition = /** @class */ (function () {
30467
30500
  });
30468
30501
  Object.defineProperty(Composition.prototype, "startTime", {
30469
30502
  /**
30470
- * 获取合成开始时间
30503
+ * 获取合成开始渲染的时间
30471
30504
  */
30472
30505
  get: function () {
30473
30506
  var _a;
@@ -30547,7 +30580,12 @@ var Composition = /** @class */ (function () {
30547
30580
  if (this.content.ended && this.reusable) {
30548
30581
  this.restart();
30549
30582
  }
30550
- this.gotoAndPlay(this.time);
30583
+ if (this.content.started) {
30584
+ this.gotoAndPlay(this.time - this.startTime);
30585
+ }
30586
+ else {
30587
+ this.gotoAndPlay(0);
30588
+ }
30551
30589
  };
30552
30590
  /**
30553
30591
  * 暂停合成的播放
@@ -30561,14 +30599,21 @@ var Composition = /** @class */ (function () {
30561
30599
  Composition.prototype.resume = function () {
30562
30600
  this.paused = false;
30563
30601
  };
30602
+ /**
30603
+ * 跳转合成到指定时间播放
30604
+ * @param time - 相对 startTime 的时间
30605
+ */
30564
30606
  Composition.prototype.gotoAndPlay = function (time) {
30565
30607
  this.resume();
30566
30608
  if (!this.content.started) {
30567
30609
  this.content.start();
30568
- this.forwardTime(this.startTime);
30569
30610
  }
30570
- this.forwardTime(time);
30611
+ this.forwardTime(time + this.startTime);
30571
30612
  };
30613
+ /**
30614
+ * 跳转合成到指定时间并暂停
30615
+ * @param time - 相对 startTime 的时间
30616
+ */
30572
30617
  Composition.prototype.gotoAndStop = function (time) {
30573
30618
  this.gotoAndPlay(time);
30574
30619
  this.pause();
@@ -30588,21 +30633,29 @@ var Composition = /** @class */ (function () {
30588
30633
  };
30589
30634
  /**
30590
30635
  * 跳到指定时间点(不做任何播放行为)
30591
- * @param time - 指定的时间
30636
+ * @param time - 相对 startTime 的时间
30592
30637
  */
30593
30638
  Composition.prototype.setTime = function (time) {
30594
30639
  var pause = this.paused;
30595
30640
  if (pause) {
30596
30641
  this.resume();
30597
30642
  }
30598
- this.forwardTime(time, true);
30643
+ if (!this.content.started) {
30644
+ this.content.start();
30645
+ }
30646
+ this.forwardTime(time + this.startTime, true);
30599
30647
  if (pause) {
30600
30648
  this.pause();
30601
30649
  }
30602
30650
  };
30651
+ /**
30652
+ * 前进合成到指定时间
30653
+ * @param time - 相对0时刻的时间
30654
+ * @param skipRender - 是否跳过渲染
30655
+ */
30603
30656
  Composition.prototype.forwardTime = function (time, skipRender) {
30604
30657
  if (skipRender === void 0) { skipRender = false; }
30605
- var deltaTime = (this.startTime + Math.max(0, time)) * 1000 - this.content.timeInms;
30658
+ var deltaTime = time * 1000 - this.content.timeInms;
30606
30659
  var reverse = deltaTime < 0;
30607
30660
  var step = 15;
30608
30661
  var t = Math.abs(deltaTime);
@@ -32785,9 +32838,9 @@ Geometry.create = function (engine, options) {
32785
32838
  Mesh.create = function (engine, props) {
32786
32839
  return new ThreeMesh(engine, props);
32787
32840
  };
32788
- var version = "1.1.3";
32841
+ var version = "1.1.5";
32789
32842
  console.info({
32790
- content: '[Galacean Effects THREEJS] version: ' + "1.1.3",
32843
+ content: '[Galacean Effects THREEJS] version: ' + "1.1.5",
32791
32844
  type: LOG_TYPE,
32792
32845
  });
32793
32846