@galacean/effects-threejs 2.0.1 → 2.0.3

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/README.md CHANGED
@@ -92,4 +92,4 @@ displayObject.addEventListener('end', () => {
92
92
  });
93
93
  ```
94
94
 
95
- ## [API Documentation](https://galacean.antgroup.com/effects/#/api/modules_galacean_effects_threejs)
95
+ ## [API Documentation](https://galacean.antgroup.com/effects/api/effects-threejs)
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime threejs plugin for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.0.1
6
+ * Version: v2.0.3
7
7
  */
8
8
 
9
9
  'use strict';
@@ -4591,7 +4591,6 @@ function getDirectStore(target) {
4591
4591
 
4592
4592
  /**
4593
4593
  * @since 2.0.0
4594
- * @internal
4595
4594
  */ var EffectsObject = /*#__PURE__*/ function() {
4596
4595
  function EffectsObject(engine) {
4597
4596
  this.engine = engine;
@@ -4627,7 +4626,6 @@ function getDirectStore(target) {
4627
4626
 
4628
4627
  /**
4629
4628
  * @since 2.0.0
4630
- * @internal
4631
4629
  */ var Component = /*#__PURE__*/ function(EffectsObject) {
4632
4630
  _inherits(Component, EffectsObject);
4633
4631
  function Component() {
@@ -4662,7 +4660,6 @@ function getDirectStore(target) {
4662
4660
  }(EffectsObject);
4663
4661
  /**
4664
4662
  * @since 2.0.0
4665
- * @internal
4666
4663
  */ var Behaviour = /*#__PURE__*/ function(Component) {
4667
4664
  _inherits(Behaviour, Component);
4668
4665
  function Behaviour() {
@@ -13926,13 +13923,17 @@ var SpriteColorPlayable = /*#__PURE__*/ function(Playable) {
13926
13923
  if (!_instanceof1(boundObject, exports.VFXItem)) {
13927
13924
  return;
13928
13925
  }
13926
+ if (!this.spriteComponent) {
13927
+ this.spriteComponent = boundObject.getComponent(exports.SpriteComponent);
13928
+ }
13929
13929
  if (!this.spriteMaterial) {
13930
- this.spriteMaterial = boundObject.getComponent(exports.SpriteComponent).material;
13930
+ this.spriteMaterial = this.spriteComponent.material;
13931
13931
  var startColor = this.spriteMaterial.getVector4("_Color");
13932
13932
  if (startColor) {
13933
13933
  this.startColor = startColor.toArray();
13934
13934
  }
13935
13935
  }
13936
+ this.spriteComponent.setAnimationTime(this.time);
13936
13937
  var colorInc = vecFill(tempColor, 1);
13937
13938
  var colorChanged;
13938
13939
  var life = this.time / boundObject.duration;
@@ -13992,7 +13993,6 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
13992
13993
  _this = RendererComponent.call(this, engine) || this;
13993
13994
  _this.cachePrefix = "-";
13994
13995
  _this.frameAnimationLoop = false;
13995
- _this.frameAnimationTime = 0;
13996
13996
  _this.color = [
13997
13997
  1,
13998
13998
  1,
@@ -14000,6 +14000,8 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
14000
14000
  1
14001
14001
  ];
14002
14002
  _this.visible = true;
14003
+ _this.isManualTimeSet = false;
14004
+ _this.frameAnimationTime = 0;
14003
14005
  _this.getHitTestParams = function(force) {
14004
14006
  var ui = _this.interaction;
14005
14007
  if (force || ui) {
@@ -14082,6 +14084,12 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
14082
14084
  this.renderer.texture = texture;
14083
14085
  this.material.setTexture("uSampler0", texture);
14084
14086
  };
14087
+ /**
14088
+ * @internal
14089
+ */ _proto.setAnimationTime = function setAnimationTime(time) {
14090
+ this.frameAnimationTime = time;
14091
+ this.isManualTimeSet = true;
14092
+ };
14085
14093
  _proto.render = function render(renderer) {
14086
14094
  if (!this.getVisible()) {
14087
14095
  return;
@@ -14096,12 +14104,12 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
14096
14104
  };
14097
14105
  _proto.start = function start() {
14098
14106
  this.item.getHitTestParams = this.getHitTestParams;
14099
- if (this.item.endBehavior === EndBehavior.restart) {
14100
- this.frameAnimationLoop = true;
14101
- }
14102
14107
  };
14103
14108
  _proto.update = function update(dt) {
14104
- this.frameAnimationTime += dt / 1000;
14109
+ if (!this.isManualTimeSet) {
14110
+ this.frameAnimationTime += dt / 1000;
14111
+ this.isManualTimeSet = false;
14112
+ }
14105
14113
  var time = this.frameAnimationTime;
14106
14114
  var duration = this.item.duration;
14107
14115
  if (time > duration && this.frameAnimationLoop) {
@@ -16496,7 +16504,6 @@ function getTrailMeshShader(trails, particleMaxCount, name, gpuCapability, env)
16496
16504
 
16497
16505
  /**
16498
16506
  * @since 2.0.0
16499
- * @internal
16500
16507
  */ var ParticleSystemRenderer = /*#__PURE__*/ function(RendererComponent) {
16501
16508
  _inherits(ParticleSystemRenderer, RendererComponent);
16502
16509
  function ParticleSystemRenderer(engine, particleMeshProps, trailMeshProps) {
@@ -19360,7 +19367,6 @@ function compareTracks(a, b) {
19360
19367
 
19361
19368
  /**
19362
19369
  * @since 2.0.0
19363
- * @internal
19364
19370
  */ var CompositionComponent = /*#__PURE__*/ function(Behaviour) {
19365
19371
  _inherits(CompositionComponent, Behaviour);
19366
19372
  function CompositionComponent() {
@@ -21649,7 +21655,6 @@ var SerializationHelper = /*#__PURE__*/ function() {
21649
21655
 
21650
21656
  /**
21651
21657
  * @since 2.0.0
21652
- * @internal
21653
21658
  */ var AssetLoader = /*#__PURE__*/ function() {
21654
21659
  function AssetLoader(engine) {
21655
21660
  this.engine = engine;
@@ -22564,34 +22569,6 @@ function getStandardInteractContent(ui) {
22564
22569
  if (item.type === ItemType.camera && item.content.positionOverLifetime && Object.keys(item.content.positionOverLifetime).length !== 0) {
22565
22570
  item.content.positionOverLifetime.asMovement = true;
22566
22571
  }
22567
- // 动画数据转化 TODO: 动画数据移到 TimelineComponentData
22568
- item.content.tracks = [];
22569
- var tracks = item.content.tracks;
22570
- if (item.type !== ItemType.particle) {
22571
- tracks.push({
22572
- clips: [
22573
- {
22574
- id: generateGUID(),
22575
- dataType: "TransformPlayableAsset",
22576
- sizeOverLifetime: item.content.sizeOverLifetime,
22577
- rotationOverLifetime: item.content.rotationOverLifetime,
22578
- positionOverLifetime: item.content.positionOverLifetime
22579
- }
22580
- ]
22581
- });
22582
- }
22583
- if (item.type === ItemType.sprite) {
22584
- tracks.push({
22585
- clips: [
22586
- {
22587
- id: generateGUID(),
22588
- dataType: "SpriteColorPlayableAsset",
22589
- colorOverLifetime: item.content.colorOverLifetime,
22590
- startColor: item.content.options.startColor
22591
- }
22592
- ]
22593
- });
22594
- }
22595
22572
  // 修正老 json 的 item.pluginName
22596
22573
  if (item.pn !== undefined) {
22597
22574
  var pn = item.pn;
@@ -22780,7 +22757,7 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
22780
22757
  });
22781
22758
  trackDatas.push(newTrackData);
22782
22759
  }
22783
- if (item.type === ItemType.sprite) {
22760
+ if (item.type === ItemType.sprite || item.type === ItemType.text) {
22784
22761
  var newSpriteColorPlayableAssetData = {
22785
22762
  id: generateGUID(),
22786
22763
  dataType: "SpriteColorPlayableAsset",
@@ -27163,7 +27140,6 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
27163
27140
 
27164
27141
  /**
27165
27142
  * @since 2.0.0
27166
- * @internal
27167
27143
  */ var EffectsPackage = /*#__PURE__*/ function() {
27168
27144
  function EffectsPackage() {
27169
27145
  this.exportObjectDatas = [];
@@ -27711,7 +27687,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
27711
27687
  registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
27712
27688
  registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
27713
27689
  registerPlugin("interact", InteractLoader, exports.VFXItem, true);
27714
- var version$1 = "2.0.1";
27690
+ var version$1 = "2.0.3";
27715
27691
  logger.info("Core version: " + version$1 + ".");
27716
27692
 
27717
27693
  var _obj;
@@ -29392,7 +29368,7 @@ setMaxSpriteMeshItemCount(8);
29392
29368
  */ Mesh.create = function(engine, props) {
29393
29369
  return new ThreeMesh(engine, props);
29394
29370
  };
29395
- var version = "2.0.1";
29371
+ var version = "2.0.3";
29396
29372
  logger.info("THREEJS plugin version: " + version + ".");
29397
29373
 
29398
29374
  exports.AbstractPlugin = AbstractPlugin;