@galacean/effects-core 2.0.3 → 2.0.4

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.
@@ -1,5 +1,7 @@
1
1
  import type { Euler, Vector3 } from '@galacean/effects-math/es/core/index';
2
2
  import type { ValueGetter } from '../../math';
3
+ import { TrackAsset } from '../timeline/track';
4
+ import type { TimelineAsset } from './timeline-asset';
3
5
  /**
4
6
  * 基础位移属性数据
5
7
  */
@@ -16,3 +18,9 @@ export type ItemLinearVelOverLifetime = {
16
18
  z?: ValueGetter<number>;
17
19
  enabled?: boolean;
18
20
  };
21
+ /**
22
+ * @since 2.0.0
23
+ */
24
+ export declare class ObjectBindingTrack extends TrackAsset {
25
+ create(timelineAsset: TimelineAsset): void;
26
+ }
@@ -2,10 +2,54 @@ import { Vector3 } from '@galacean/effects-math/es/core/vector3';
2
2
  import type { Quaternion } from '@galacean/effects-math/es/core/quaternion';
3
3
  import * as spec from '@galacean/effects-specification';
4
4
  import type { ValueGetter } from '../../math';
5
+ import { AnimationPlayable } from './animation-playable';
6
+ import type { ItemBasicTransform, ItemLinearVelOverLifetime } from './calculate-item';
5
7
  import type { FrameContext, PlayableGraph } from './playable-graph';
6
8
  import { Playable, PlayableAsset } from './playable-graph';
7
9
  import { EffectsObject } from '../../effects-object';
8
10
  import { VFXItem } from '../../vfx-item';
11
+ /**
12
+ * @since 2.0.0
13
+ */
14
+ export declare class TransformAnimationPlayable extends AnimationPlayable {
15
+ originalTransform: ItemBasicTransform;
16
+ protected sizeSeparateAxes: boolean;
17
+ protected sizeXOverLifetime: ValueGetter<number>;
18
+ protected sizeYOverLifetime: ValueGetter<number>;
19
+ protected sizeZOverLifetime: ValueGetter<number>;
20
+ protected rotationOverLifetime: {
21
+ asRotation?: boolean;
22
+ separateAxes?: boolean;
23
+ enabled?: boolean;
24
+ x?: ValueGetter<number>;
25
+ y?: ValueGetter<number>;
26
+ z?: ValueGetter<number>;
27
+ };
28
+ gravityModifier: ValueGetter<number>;
29
+ orbitalVelOverLifetime: {
30
+ x?: ValueGetter<number>;
31
+ y?: ValueGetter<number>;
32
+ z?: ValueGetter<number>;
33
+ center: [x: number, y: number, z: number];
34
+ asRotation?: boolean;
35
+ enabled?: boolean;
36
+ };
37
+ speedOverLifetime?: ValueGetter<number>;
38
+ linearVelOverLifetime: ItemLinearVelOverLifetime;
39
+ positionOverLifetime: spec.PositionOverLifetime;
40
+ gravity: Vector3;
41
+ direction: Vector3;
42
+ startSpeed: number;
43
+ data: TransformPlayableAssetData;
44
+ private velocity;
45
+ private binding;
46
+ start(): void;
47
+ processFrame(context: FrameContext): void;
48
+ /**
49
+ * 应用时间轴K帧数据到对象
50
+ */
51
+ private sampleAnimation;
52
+ }
9
53
  export declare class TransformPlayableAsset extends PlayableAsset {
10
54
  transformAnimationData: TransformPlayableAssetData;
11
55
  createPlayable(graph: PlayableGraph): Playable;
@@ -25,6 +69,12 @@ export interface TransformPlayableAssetData extends spec.EffectsObjectData {
25
69
  */
26
70
  positionOverLifetime?: spec.PositionOverLifetime;
27
71
  }
72
+ /**
73
+ * @since 2.0.0
74
+ */
75
+ export declare class ActivationPlayable extends Playable {
76
+ processFrame(context: FrameContext): void;
77
+ }
28
78
  export declare class ActivationPlayableAsset extends PlayableAsset {
29
79
  createPlayable(graph: PlayableGraph): Playable;
30
80
  }
@@ -1,4 +1,94 @@
1
1
  import { EffectsObject } from '../../effects-object';
2
+ import type { Disposable } from '../../utils';
3
+ /**
4
+ * 动画图,负责更新所有的动画节点
5
+ * @since 2.0.0
6
+ */
7
+ export declare class PlayableGraph {
8
+ private playableOutputs;
9
+ private playables;
10
+ evaluate(dt: number): void;
11
+ connect(source: Playable, sourceOutputPort: number, destination: Playable, destinationInputPort: number): void;
12
+ addOutput(output: PlayableOutput): void;
13
+ addPlayable(playable: Playable): void;
14
+ private processFrameWithRoot;
15
+ private prepareFrameWithRoot;
16
+ private updatePlayableTime;
17
+ }
18
+ /**
19
+ * 动画图可播放节点对象
20
+ * @since 2.0.0
21
+ */
22
+ export declare class Playable implements Disposable {
23
+ onPlayablePlayFlag: boolean;
24
+ onPlayablePauseFlag: boolean;
25
+ overrideTimeNextEvaluation: boolean;
26
+ private destroyed;
27
+ private inputs;
28
+ private inputOuputPorts;
29
+ private inputWeight;
30
+ private outputs;
31
+ private playState;
32
+ private traversalMode;
33
+ /**
34
+ * 当前本地播放的时间
35
+ */
36
+ protected time: number;
37
+ constructor(graph: PlayableGraph, inputCount?: number);
38
+ play(): void;
39
+ pause(): void;
40
+ connectInput(inputPort: number, sourcePlayable: Playable, sourceOutputPort: number, weight?: number): void;
41
+ addInput(sourcePlayable: Playable, sourceOutputPort: number, weight?: number): void;
42
+ getInputCount(): number;
43
+ getInputs(): Playable[];
44
+ getInput(index: number): Playable;
45
+ getOutputCount(): number;
46
+ getOutputs(): Playable[];
47
+ getOutput(index: number): Playable;
48
+ getInputWeight(inputIndex: number): number;
49
+ setInputWeight(playable: Playable, weight: number): void;
50
+ setInputWeight(inputIndex: number, weight: number): void;
51
+ setTime(time: number): void;
52
+ getTime(): number;
53
+ getPlayState(): PlayState;
54
+ setTraversalMode(mode: PlayableTraversalMode): void;
55
+ getTraversalMode(): PlayableTraversalMode;
56
+ onPlayablePlay(context: FrameContext): void;
57
+ onPlayablePause(context: FrameContext): void;
58
+ prepareFrame(context: FrameContext): void;
59
+ processFrame(context: FrameContext): void;
60
+ onPlayableDestroy(): void;
61
+ dispose(): void;
62
+ private setOutput;
63
+ private setInput;
64
+ }
65
+ /**
66
+ * 动画图输出节点对象,将动画数据采样到绑定的元素属性上
67
+ * @since 2.0.0
68
+ */
69
+ export declare class PlayableOutput {
70
+ /**
71
+ * 绑定到的动画 item
72
+ */
73
+ userData: object;
74
+ /**
75
+ * 源 playable 对象
76
+ */
77
+ sourcePlayable: Playable;
78
+ context: FrameContext;
79
+ /**
80
+ * 当前本地播放的时间
81
+ */
82
+ protected time: number;
83
+ private sourceOutputPort;
84
+ constructor();
85
+ setSourcePlayeble(playable: Playable, port?: number): void;
86
+ getSourceOutputPort(): number;
87
+ setUserData(value: object): void;
88
+ getUserData(): object;
89
+ prepareFrame(): void;
90
+ processFrame(): void;
91
+ }
2
92
  export declare abstract class PlayableAsset extends EffectsObject {
3
93
  abstract createPlayable(graph: PlayableGraph): Playable;
4
94
  }
@@ -159,6 +159,7 @@ export declare class ParticleSystem extends Component {
159
159
  get lifetime(): number;
160
160
  get particleCount(): number;
161
161
  isFrozen(): boolean;
162
+ isEnded(): boolean;
162
163
  initEmitterTransform(): void;
163
164
  private updateEmitterTransform;
164
165
  private addParticle;
@@ -1,5 +1,15 @@
1
- import type { PlayableGraph } from '../cal/playable-graph';
1
+ import type { FrameContext, PlayableGraph } from '../cal/playable-graph';
2
2
  import { Playable, PlayableAsset } from '../cal/playable-graph';
3
+ import { ParticleSystem } from './particle-system';
4
+ /**
5
+ * @since 2.0.0
6
+ */
7
+ export declare class ParticleBehaviourPlayable extends Playable {
8
+ lastTime: number;
9
+ particleSystem: ParticleSystem;
10
+ start(context: FrameContext): void;
11
+ processFrame(context: FrameContext): void;
12
+ }
3
13
  export declare class ParticleBehaviourPlayableAsset extends PlayableAsset {
4
14
  createPlayable(graph: PlayableGraph): Playable;
5
15
  }
@@ -0,0 +1,5 @@
1
+ import type { FrameContext } from '../../cal/playable-graph';
2
+ import { Playable } from '../../cal/playable-graph';
3
+ export declare class SubCompositionMixerPlayable extends Playable {
4
+ processFrame(context: FrameContext): void;
5
+ }
@@ -1,5 +1,52 @@
1
- import { Playable } from '../cal/playable-graph';
1
+ import { EndBehavior } from '@galacean/effects-specification';
2
+ import type { PlayableGraph } from '../cal/playable-graph';
3
+ import { Playable, PlayableAsset, PlayableOutput } from '../cal/playable-graph';
2
4
  import { ParticleSystem } from '../particle/particle-system';
5
+ import type { Constructor } from '../../utils';
6
+ /**
7
+ * @since 2.0.0
8
+ */
9
+ export declare class TimelineClip {
10
+ id: string;
11
+ name: string;
12
+ start: number;
13
+ duration: number;
14
+ asset: PlayableAsset;
15
+ endBehavior: EndBehavior;
16
+ constructor();
17
+ toLocalTime(time: number): number;
18
+ }
19
+ /**
20
+ * @since 2.0.0
21
+ */
22
+ export declare class TrackAsset extends PlayableAsset {
23
+ name: string;
24
+ binding: object;
25
+ trackType: TrackType;
26
+ private clipSeed;
27
+ private clips;
28
+ protected children: TrackAsset[];
29
+ /**
30
+ * 重写该方法以获取自定义对象绑定
31
+ */
32
+ resolveBinding(parentBinding: object): object;
33
+ /**
34
+ * 重写该方法以创建自定义混合器
35
+ */
36
+ createTrackMixer(graph: PlayableGraph): Playable;
37
+ createOutput(): PlayableOutput;
38
+ createPlayableGraph(graph: PlayableGraph, runtimeClips: RuntimeClip[]): Playable;
39
+ createMixerPlayableGraph(graph: PlayableGraph, runtimeClips: RuntimeClip[]): Playable;
40
+ compileClips(graph: PlayableGraph, timelineClips: TimelineClip[], runtimeClips: RuntimeClip[]): Playable;
41
+ createPlayable(graph: PlayableGraph): Playable;
42
+ getChildTracks(): TrackAsset[];
43
+ addChild(child: TrackAsset): void;
44
+ createClip<T extends PlayableAsset>(classConstructor: Constructor<T>, name?: string): TimelineClip;
45
+ getClips(): TimelineClip[];
46
+ findClip(name: string): TimelineClip | undefined;
47
+ addClip(clip: TimelineClip): void;
48
+ private createClipPlayable;
49
+ }
3
50
  export declare enum TrackType {
4
51
  MasterTrack = 0,
5
52
  ObjectTrack = 1
@@ -14,3 +61,9 @@ export declare class RuntimeClip {
14
61
  set enable(value: boolean);
15
62
  evaluateAt(localTime: number): void;
16
63
  }
64
+ /**
65
+ * @since 2.0.0
66
+ */
67
+ export interface TimelineClipData {
68
+ asset: PlayableAsset;
69
+ }
@@ -1,4 +1,6 @@
1
1
  import { TrackAsset } from '../track';
2
+ import type { PlayableGraph, Playable } from '../../cal/playable-graph';
2
3
  export declare class SubCompositionTrack extends TrackAsset {
3
4
  resolveBinding(parentBinding: object): object;
5
+ createTrackMixer(graph: PlayableGraph): Playable;
4
6
  }
package/dist/ticker.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export declare const DEFAULT_FPS = 60;
1
2
  /**
2
3
  * 定时器类
3
4
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/effects-core",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "Galacean Effects runtime core for the web",
5
5
  "module": "./dist/index.mjs",
6
6
  "main": "./dist/index.js",