@galacean/effects-core 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
@@ -153,4 +153,4 @@ Uniforms involved and their types:
153
153
  30. uWaveParams: vec4
154
154
  ```
155
155
 
156
- ## [API Documentation](https://galacean.antgroup.com/effects/#/api/modules_galacean_effects_core)
156
+ ## [API Documentation](https://galacean.antgroup.com/effects/api/effects-core)
@@ -4,7 +4,6 @@ import type { Engine } from './engine';
4
4
  import type { VFXItemProps } from './vfx-item';
5
5
  /**
6
6
  * @since 2.0.0
7
- * @internal
8
7
  */
9
8
  export declare class AssetLoader {
10
9
  private engine;
@@ -15,7 +15,6 @@ export interface SceneBindingData {
15
15
  }
16
16
  /**
17
17
  * @since 2.0.0
18
- * @internal
19
18
  */
20
19
  export declare class CompositionComponent extends Behaviour {
21
20
  time: number;
@@ -2,7 +2,6 @@ import { EffectsObject } from '../effects-object';
2
2
  import type { VFXItem } from '../vfx-item';
3
3
  /**
4
4
  * @since 2.0.0
5
- * @internal
6
5
  */
7
6
  export declare abstract class Component extends EffectsObject {
8
7
  name: string;
@@ -21,7 +20,6 @@ export declare abstract class Component extends EffectsObject {
21
20
  }
22
21
  /**
23
22
  * @since 2.0.0
24
- * @internal
25
23
  */
26
24
  export declare abstract class Behaviour extends Component {
27
25
  isAwakeCalled: boolean;
@@ -8,7 +8,6 @@ import { DestroyOptions } from '../utils';
8
8
  import { RendererComponent } from './renderer-component';
9
9
  /**
10
10
  * @since 2.0.0
11
- * @internal
12
11
  */
13
12
  export declare class EffectComponent extends RendererComponent {
14
13
  /**
@@ -362,31 +362,11 @@ export declare class Composition extends EventEmitter<CompositionEvent<Compositi
362
362
  * @param type - 交互类型
363
363
  */
364
364
  removeInteractiveItem(item: VFXItem, type: spec.InteractType): void;
365
- /**
366
- * 销毁插件 Item 中保存的纹理数组
367
- * @internal
368
- * @param textures - 需要销毁的数组
369
- */
370
- destroyTextures(textures: (Texture | null | undefined)[]): void;
371
- /**
372
- * 销毁 Item
373
- * @internal
374
- * @param item - 需要销毁的 item
375
- */
376
- destroyItem(item: VFXItem): void;
377
365
  lost(e: Event): void;
378
366
  /**
379
367
  * 合成对象销毁
380
368
  */
381
369
  dispose(): void;
382
- /**
383
- * 编辑器使用的 transform 修改方法
384
- * @internal
385
- * @param scale - 缩放比例
386
- * @param dx - x偏移量
387
- * @param dy - y偏移量
388
- */
389
- setEditorTransform(scale: number, dx: number, dy: number): void;
390
370
  /**
391
371
  * 合成整体在水平方向移动 x 像素,垂直方向移动 y 像素
392
372
  */
@@ -2,7 +2,6 @@ import type * as spec from '@galacean/effects-specification';
2
2
  import type { Engine } from './engine';
3
3
  /**
4
4
  * @since 2.0.0
5
- * @internal
6
5
  */
7
6
  export declare abstract class EffectsObject {
8
7
  engine: Engine;
@@ -5,7 +5,6 @@ interface FileSummary {
5
5
  }
6
6
  /**
7
7
  * @since 2.0.0
8
- * @internal
9
8
  */
10
9
  export declare class EffectsPackage {
11
10
  fileSummary: FileSummary;
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.0.1
6
+ * Version: v2.0.3
7
7
  */
8
8
 
9
9
  'use strict';
@@ -4569,7 +4569,6 @@ function getDirectStore(target) {
4569
4569
 
4570
4570
  /**
4571
4571
  * @since 2.0.0
4572
- * @internal
4573
4572
  */ var EffectsObject = /*#__PURE__*/ function() {
4574
4573
  function EffectsObject(engine) {
4575
4574
  this.engine = engine;
@@ -4605,7 +4604,6 @@ function getDirectStore(target) {
4605
4604
 
4606
4605
  /**
4607
4606
  * @since 2.0.0
4608
- * @internal
4609
4607
  */ var Component = /*#__PURE__*/ function(EffectsObject) {
4610
4608
  _inherits(Component, EffectsObject);
4611
4609
  function Component() {
@@ -4640,7 +4638,6 @@ function getDirectStore(target) {
4640
4638
  }(EffectsObject);
4641
4639
  /**
4642
4640
  * @since 2.0.0
4643
- * @internal
4644
4641
  */ var Behaviour = /*#__PURE__*/ function(Component) {
4645
4642
  _inherits(Behaviour, Component);
4646
4643
  function Behaviour() {
@@ -13904,13 +13901,17 @@ var SpriteColorPlayable = /*#__PURE__*/ function(Playable) {
13904
13901
  if (!_instanceof1(boundObject, exports.VFXItem)) {
13905
13902
  return;
13906
13903
  }
13904
+ if (!this.spriteComponent) {
13905
+ this.spriteComponent = boundObject.getComponent(exports.SpriteComponent);
13906
+ }
13907
13907
  if (!this.spriteMaterial) {
13908
- this.spriteMaterial = boundObject.getComponent(exports.SpriteComponent).material;
13908
+ this.spriteMaterial = this.spriteComponent.material;
13909
13909
  var startColor = this.spriteMaterial.getVector4("_Color");
13910
13910
  if (startColor) {
13911
13911
  this.startColor = startColor.toArray();
13912
13912
  }
13913
13913
  }
13914
+ this.spriteComponent.setAnimationTime(this.time);
13914
13915
  var colorInc = vecFill(tempColor, 1);
13915
13916
  var colorChanged;
13916
13917
  var life = this.time / boundObject.duration;
@@ -13970,7 +13971,6 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
13970
13971
  _this = RendererComponent.call(this, engine) || this;
13971
13972
  _this.cachePrefix = "-";
13972
13973
  _this.frameAnimationLoop = false;
13973
- _this.frameAnimationTime = 0;
13974
13974
  _this.color = [
13975
13975
  1,
13976
13976
  1,
@@ -13978,6 +13978,8 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
13978
13978
  1
13979
13979
  ];
13980
13980
  _this.visible = true;
13981
+ _this.isManualTimeSet = false;
13982
+ _this.frameAnimationTime = 0;
13981
13983
  _this.getHitTestParams = function(force) {
13982
13984
  var ui = _this.interaction;
13983
13985
  if (force || ui) {
@@ -14060,6 +14062,12 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
14060
14062
  this.renderer.texture = texture;
14061
14063
  this.material.setTexture("uSampler0", texture);
14062
14064
  };
14065
+ /**
14066
+ * @internal
14067
+ */ _proto.setAnimationTime = function setAnimationTime(time) {
14068
+ this.frameAnimationTime = time;
14069
+ this.isManualTimeSet = true;
14070
+ };
14063
14071
  _proto.render = function render(renderer) {
14064
14072
  if (!this.getVisible()) {
14065
14073
  return;
@@ -14074,12 +14082,12 @@ exports.SpriteComponent = /*#__PURE__*/ function(RendererComponent) {
14074
14082
  };
14075
14083
  _proto.start = function start() {
14076
14084
  this.item.getHitTestParams = this.getHitTestParams;
14077
- if (this.item.endBehavior === EndBehavior.restart) {
14078
- this.frameAnimationLoop = true;
14079
- }
14080
14085
  };
14081
14086
  _proto.update = function update(dt) {
14082
- this.frameAnimationTime += dt / 1000;
14087
+ if (!this.isManualTimeSet) {
14088
+ this.frameAnimationTime += dt / 1000;
14089
+ this.isManualTimeSet = false;
14090
+ }
14083
14091
  var time = this.frameAnimationTime;
14084
14092
  var duration = this.item.duration;
14085
14093
  if (time > duration && this.frameAnimationLoop) {
@@ -16474,7 +16482,6 @@ function getTrailMeshShader(trails, particleMaxCount, name, gpuCapability, env)
16474
16482
 
16475
16483
  /**
16476
16484
  * @since 2.0.0
16477
- * @internal
16478
16485
  */ var ParticleSystemRenderer = /*#__PURE__*/ function(RendererComponent) {
16479
16486
  _inherits(ParticleSystemRenderer, RendererComponent);
16480
16487
  function ParticleSystemRenderer(engine, particleMeshProps, trailMeshProps) {
@@ -19338,7 +19345,6 @@ function compareTracks(a, b) {
19338
19345
 
19339
19346
  /**
19340
19347
  * @since 2.0.0
19341
- * @internal
19342
19348
  */ var CompositionComponent = /*#__PURE__*/ function(Behaviour) {
19343
19349
  _inherits(CompositionComponent, Behaviour);
19344
19350
  function CompositionComponent() {
@@ -21627,7 +21633,6 @@ var SerializationHelper = /*#__PURE__*/ function() {
21627
21633
 
21628
21634
  /**
21629
21635
  * @since 2.0.0
21630
- * @internal
21631
21636
  */ var AssetLoader = /*#__PURE__*/ function() {
21632
21637
  function AssetLoader(engine) {
21633
21638
  this.engine = engine;
@@ -22542,34 +22547,6 @@ function getStandardInteractContent(ui) {
22542
22547
  if (item.type === ItemType.camera && item.content.positionOverLifetime && Object.keys(item.content.positionOverLifetime).length !== 0) {
22543
22548
  item.content.positionOverLifetime.asMovement = true;
22544
22549
  }
22545
- // 动画数据转化 TODO: 动画数据移到 TimelineComponentData
22546
- item.content.tracks = [];
22547
- var tracks = item.content.tracks;
22548
- if (item.type !== ItemType.particle) {
22549
- tracks.push({
22550
- clips: [
22551
- {
22552
- id: generateGUID(),
22553
- dataType: "TransformPlayableAsset",
22554
- sizeOverLifetime: item.content.sizeOverLifetime,
22555
- rotationOverLifetime: item.content.rotationOverLifetime,
22556
- positionOverLifetime: item.content.positionOverLifetime
22557
- }
22558
- ]
22559
- });
22560
- }
22561
- if (item.type === ItemType.sprite) {
22562
- tracks.push({
22563
- clips: [
22564
- {
22565
- id: generateGUID(),
22566
- dataType: "SpriteColorPlayableAsset",
22567
- colorOverLifetime: item.content.colorOverLifetime,
22568
- startColor: item.content.options.startColor
22569
- }
22570
- ]
22571
- });
22572
- }
22573
22550
  // 修正老 json 的 item.pluginName
22574
22551
  if (item.pn !== undefined) {
22575
22552
  var pn = item.pn;
@@ -22758,7 +22735,7 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
22758
22735
  });
22759
22736
  trackDatas.push(newTrackData);
22760
22737
  }
22761
- if (item.type === ItemType.sprite) {
22738
+ if (item.type === ItemType.sprite || item.type === ItemType.text) {
22762
22739
  var newSpriteColorPlayableAssetData = {
22763
22740
  id: generateGUID(),
22764
22741
  dataType: "SpriteColorPlayableAsset",
@@ -27141,7 +27118,6 @@ var FBGeometryDataT = /*#__PURE__*/ function() {
27141
27118
 
27142
27119
  /**
27143
27120
  * @since 2.0.0
27144
- * @internal
27145
27121
  */ var EffectsPackage = /*#__PURE__*/ function() {
27146
27122
  function EffectsPackage() {
27147
27123
  this.exportObjectDatas = [];
@@ -27689,7 +27665,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
27689
27665
  registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
27690
27666
  registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
27691
27667
  registerPlugin("interact", InteractLoader, exports.VFXItem, true);
27692
- var version = "2.0.1";
27668
+ var version = "2.0.3";
27693
27669
  logger.info("Core version: " + version + ".");
27694
27670
 
27695
27671
  exports.AbstractPlugin = AbstractPlugin;