@galacean/effects-specification 2.0.0-alpha.8 → 2.0.0-beta.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 (101) hide show
  1. package/README.md +2 -10
  2. package/es/animation-clip-data.d.ts +26 -0
  3. package/es/animation-clip-data.js +1 -0
  4. package/{dist/src → es}/binary.d.ts +4 -2
  5. package/es/binary.js +1 -0
  6. package/es/buitin-object-guid.d.ts +5 -0
  7. package/es/buitin-object-guid.js +5 -0
  8. package/{dist/src → es}/components.d.ts +81 -4
  9. package/es/components.js +129 -0
  10. package/{dist/src → es}/composition.d.ts +28 -70
  11. package/es/composition.js +12 -0
  12. package/{dist/src → es}/constants.d.ts +23 -0
  13. package/es/constants.js +34 -0
  14. package/{dist/src → es}/image.d.ts +13 -6
  15. package/es/image.js +9 -0
  16. package/{dist/src → es}/index.d.ts +2 -1
  17. package/es/index.js +28 -0
  18. package/{dist/src → es}/item/base-item.d.ts +27 -7
  19. package/es/item/base-item.js +27 -0
  20. package/{dist/src → es}/item/camera-item.d.ts +5 -5
  21. package/es/item/camera-item.js +1 -0
  22. package/{dist/src → es}/item/composition-item.d.ts +4 -4
  23. package/es/item/composition-item.js +1 -0
  24. package/{dist/src → es}/item/effect-item.d.ts +2 -2
  25. package/es/item/effect-item.js +1 -0
  26. package/{dist/src → es}/item/interact-item.d.ts +3 -3
  27. package/es/item/interact-item.js +1 -0
  28. package/es/item/model/binary.js +1 -0
  29. package/{dist/src → es}/item/model/camera.d.ts +2 -2
  30. package/es/item/model/camera.js +5 -0
  31. package/es/item/model/index.js +35 -0
  32. package/{dist/src → es}/item/model/light.d.ts +2 -2
  33. package/es/item/model/light.js +19 -0
  34. package/{dist/src → es}/item/model/material.d.ts +3 -3
  35. package/es/item/model/material.js +16 -0
  36. package/{dist/src → es}/item/model/mesh.d.ts +6 -5
  37. package/es/item/model/mesh.js +5 -0
  38. package/es/item/model/render.js +42 -0
  39. package/{dist/src → es}/item/model/skybox.d.ts +9 -3
  40. package/es/item/model/skybox.js +1 -0
  41. package/{dist/src → es}/item/model/tree.d.ts +10 -0
  42. package/es/item/model/tree.js +1 -0
  43. package/es/item/null-item.d.ts +46 -0
  44. package/es/item/null-item.js +1 -0
  45. package/{dist/src → es}/item/particle-item.d.ts +20 -20
  46. package/es/item/particle-item.js +14 -0
  47. package/es/item/particle-shape.js +19 -0
  48. package/{dist/src → es}/item/plugin-item.d.ts +3 -3
  49. package/es/item/plugin-item.js +1 -0
  50. package/{dist/src → es}/item/spine-item.d.ts +44 -20
  51. package/es/item/spine-item.js +1 -0
  52. package/{dist/src → es}/item/sprite-item.d.ts +3 -3
  53. package/es/item/sprite-item.js +1 -0
  54. package/{dist/src → es}/item/text-item.d.ts +3 -3
  55. package/es/item/text-item.js +1 -0
  56. package/{dist/src → es}/item.d.ts +1 -3
  57. package/es/item.js +1 -0
  58. package/{dist/src → es}/number-expression.d.ts +21 -8
  59. package/es/number-expression.js +91 -0
  60. package/{dist/src → es}/scene.d.ts +17 -14
  61. package/es/scene.js +1 -0
  62. package/{dist/src → es}/text.d.ts +3 -49
  63. package/es/text.js +84 -0
  64. package/es/timeline/index.d.ts +5 -0
  65. package/es/timeline/index.js +5 -0
  66. package/es/timeline/playables/sprite-color-playable-asset-data.d.ts +8 -0
  67. package/es/timeline/playables/sprite-color-playable-asset-data.js +1 -0
  68. package/es/timeline/playables/transform-playable-asset-data.d.ts +17 -0
  69. package/es/timeline/playables/transform-playable-asset-data.js +1 -0
  70. package/es/timeline/timeline-asset-data.d.ts +8 -0
  71. package/es/timeline/timeline-asset-data.js +1 -0
  72. package/es/timeline/timeline-clip-data.d.ts +11 -0
  73. package/es/timeline/timeline-clip-data.js +1 -0
  74. package/es/timeline/track/track-asset-data.d.ts +9 -0
  75. package/es/timeline/track/track-asset-data.js +1 -0
  76. package/{dist/src → es}/type.d.ts +25 -12
  77. package/es/type.js +342 -0
  78. package/{dist/src → es}/vfx-item-data.d.ts +8 -9
  79. package/es/vfx-item-data.js +1 -0
  80. package/package.json +27 -48
  81. package/dist/fallback/camera.d.ts +0 -2
  82. package/dist/fallback/index.d.ts +0 -12
  83. package/dist/fallback/interact.d.ts +0 -2
  84. package/dist/fallback/migration.d.ts +0 -13
  85. package/dist/fallback/particle.d.ts +0 -2
  86. package/dist/fallback/sprite.d.ts +0 -3
  87. package/dist/fallback/utils.d.ts +0 -36
  88. package/dist/fallback.js +0 -2093
  89. package/dist/fallback.js.map +0 -1
  90. package/dist/fallback.mjs +0 -2065
  91. package/dist/fallback.mjs.map +0 -1
  92. package/dist/index.js +0 -802
  93. package/dist/index.js.map +0 -1
  94. package/dist/index.mjs +0 -787
  95. package/dist/index.mjs.map +0 -1
  96. package/dist/src/buitin-object-guid.d.ts +0 -5
  97. package/dist/src/item/null-item.d.ts +0 -94
  98. /package/{dist/src → es}/item/model/binary.d.ts +0 -0
  99. /package/{dist/src → es}/item/model/index.d.ts +0 -0
  100. /package/{dist/src → es}/item/model/render.d.ts +0 -0
  101. /package/{dist/src → es}/item/particle-shape.d.ts +0 -0
package/README.md CHANGED
@@ -8,15 +8,7 @@
8
8
 
9
9
  ``` bash
10
10
  # 1. Install dependencies (first time)
11
- npm install
11
+ pnpm install
12
12
  # 2. Build
13
- npm run build
13
+ pnpm run build
14
14
  ```
15
-
16
- ## Testing
17
-
18
- ``` bash
19
- npm run test
20
- ```
21
-
22
- > Open browser and open: http://localhost:9003/test/
@@ -0,0 +1,26 @@
1
+ import type { EffectsObjectData } from './components';
2
+ import type { FixedNumberExpression, FixedVec3Expression, FixedQuatExpression } from './number-expression';
3
+ export interface AnimationClipData extends EffectsObjectData {
4
+ positionCurves: PositionCurveData[];
5
+ rotationCurves: RotationCurveData[];
6
+ scaleCurves: ScaleCurveData[];
7
+ floatCurves: FloatCurveData[];
8
+ }
9
+ export interface PositionCurveData {
10
+ path: string;
11
+ keyFrames: FixedVec3Expression;
12
+ }
13
+ export interface RotationCurveData {
14
+ path: string;
15
+ keyFrames: FixedQuatExpression;
16
+ }
17
+ export interface ScaleCurveData {
18
+ path: string;
19
+ keyFrames: FixedVec3Expression;
20
+ }
21
+ export interface FloatCurveData {
22
+ path: string;
23
+ property: string;
24
+ className: string;
25
+ keyFrames: FixedNumberExpression;
26
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,4 @@
1
+ import type { DataType, EffectsObjectData } from './components';
1
2
  import type { RenderLevel } from './type';
2
3
  import type { ValueType } from './number-expression';
3
4
  /**
@@ -19,12 +20,13 @@ import type { ValueType } from './number-expression';
19
20
  */
20
21
  export type BinaryPointerContent = [index: number, start?: number, byteLength?: number, type?: BinaryType];
21
22
  export type BinaryPointer = [ValueType.BINARY, BinaryPointerContent];
22
- export type BinaryType = 'u8' | 'i8' | 'i16' | 'u16' | 'f32' | 'u32' | 'i32' | 'f64' | string;
23
+ export type BinaryType = 'u8' | 'i8' | 'i16' | 'u16' | 'f32' | 'u32' | 'i32' | 'f64' | '';
23
24
  /**
24
25
  * 线上二进制地址
25
26
  */
26
- export interface BinaryFile {
27
+ export interface BinaryFile extends EffectsObjectData {
27
28
  url: string;
29
+ dataType: DataType.BinaryAsset;
28
30
  renderLevel?: RenderLevel;
29
31
  }
30
32
  export type BinaryEnv = 'studio' | 'runtime' | 'json';
package/es/binary.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export declare const BuiltinObjectGUID: {
2
+ WhiteTexture: string;
3
+ PBRShader: string;
4
+ UnlitShader: string;
5
+ };
@@ -0,0 +1,5 @@
1
+ export const BuiltinObjectGUID = {
2
+ WhiteTexture: 'whitetexture00000000000000000000',
3
+ PBRShader: 'pbr00000000000000000000000000000',
4
+ UnlitShader: 'unlit000000000000000000000000000',
5
+ };
@@ -10,13 +10,29 @@ export declare enum DataType {
10
10
  CameraController = "CameraController",
11
11
  Geometry = "Geometry",
12
12
  Texture = "Texture",
13
+ AnimationClip = "AnimationClip",
13
14
  TextComponent = "TextComponent",
15
+ BinaryAsset = "BinaryAsset",
16
+ TrackAsset = "TrackAsset",
17
+ TimelineAsset = "TimelineAsset",
18
+ ObjectBindingTrack = "ObjectBindingTrack",
19
+ TransformTrack = "TransformTrack",
20
+ SpriteColorTrack = "SpriteColorTrack",
21
+ ActivationTrack = "ActivationTrack",
22
+ SubCompositionTrack = "SubCompositionTrack",
23
+ TransformPlayableAsset = "TransformPlayableAsset",
24
+ SpriteColorPlayableAsset = "SpriteColorPlayableAsset",
25
+ ActivationPlayableAsset = "ActivationPlayableAsset",
26
+ SubCompositionPlayableAsset = "SubCompositionPlayableAsset",
14
27
  MeshComponent = "MeshComponent",
15
28
  SkyboxComponent = "SkyboxComponent",
16
29
  LightComponent = "LightComponent",
17
30
  CameraComponent = "CameraComponent",
18
31
  ModelPluginComponent = "ModelPluginComponent",
19
- TreeComponent = "TreeComponent"
32
+ TreeComponent = "TreeComponent",
33
+ AnimationComponent = "AnimationComponent",
34
+ SpineComponent = "SpineComponent",
35
+ TimelineClip = "TimelineClip"
20
36
  }
21
37
  export interface DataPath {
22
38
  id: string;
@@ -52,6 +68,7 @@ export interface MaterialData extends EffectsObjectData {
52
68
  zWrite?: boolean;
53
69
  zTest?: boolean;
54
70
  stringTags: Record<string, string>;
71
+ macros: string[];
55
72
  ints: Record<string, number>;
56
73
  floats: Record<string, number>;
57
74
  vector4s: Record<string, Vector4Data>;
@@ -60,8 +77,9 @@ export interface MaterialData extends EffectsObjectData {
60
77
  }
61
78
  export interface GeometryData extends EffectsObjectData {
62
79
  vertexData: VertexData;
63
- indexFormat: number;
80
+ indexFormat: IndexFormatType;
64
81
  indexOffset: number;
82
+ subMeshes: SubMesh[];
65
83
  /**
66
84
  * 模型绘制模式,默认为 GeometryType.TRIANGLES(三角形)
67
85
  * @default GeometryType.TRIANGLES
@@ -70,7 +88,22 @@ export interface GeometryData extends EffectsObjectData {
70
88
  /**
71
89
  * 存放 position, uv, normal, indices 的打包数据
72
90
  */
73
- buffer: string;
91
+ buffer?: string;
92
+ /**
93
+ * 存放 position, uv, normal, indices 的二进制数据,用于序列化二进制数据
94
+ */
95
+ binaryData?: Uint8Array;
96
+ /**
97
+ * 所有的骨骼名称
98
+ */
99
+ boneNames?: string[];
100
+ rootBoneName?: string;
101
+ inverseBindMatrices?: number[];
102
+ }
103
+ export interface SubMesh {
104
+ offset: number;
105
+ indexCount?: number;
106
+ vertexCount: number;
74
107
  }
75
108
  export declare enum GeometryType {
76
109
  /**
@@ -106,10 +139,54 @@ export interface VertexData {
106
139
  vertexCount: number;
107
140
  channels: VertexChannel[];
108
141
  }
142
+ export declare enum VertexFormatType {
143
+ Float16 = 0,
144
+ Float32 = 1,
145
+ Int8 = 2,
146
+ Int16 = 3,
147
+ Int32 = 4,
148
+ UInt8 = 5,
149
+ UInt16 = 6,
150
+ UInt32 = 7
151
+ }
152
+ export declare enum IndexFormatType {
153
+ None = -1,
154
+ UInt8 = 0,
155
+ UInt16 = 1,
156
+ UInt32 = 2
157
+ }
109
158
  export interface VertexChannel {
159
+ semantic: string;
110
160
  offset: number;
111
- format: number;
161
+ format: VertexFormatType;
112
162
  dimension: number;
163
+ normalize?: boolean;
164
+ }
165
+ export declare enum VertexBufferSemantic {
166
+ Position = "POSITION",
167
+ Uv = "TEXCOORD0",
168
+ Uv2 = "TEXCOORD1",
169
+ Normal = "NORMAL",
170
+ Tangent = "TANGENT",
171
+ Color = "COLOR",
172
+ Joints = "JOINTS",
173
+ Weights = "WEIGHTS",
174
+ PositionBS0 = "POSITION_BS0",
175
+ PositionBS1 = "POSITION_BS1",
176
+ PositionBS2 = "POSITION_BS2",
177
+ PositionBS3 = "POSITION_BS3",
178
+ PositionBS4 = "POSITION_BS4",
179
+ PositionBS5 = "POSITION_BS5",
180
+ PositionBS6 = "POSITION_BS6",
181
+ PositionBS7 = "POSITION_BS7",
182
+ NormalBS0 = "NORMAL_BS0",
183
+ NormalBS1 = "NORMAL_BS1",
184
+ NormalBS2 = "NORMAL_BS2",
185
+ NormalBS3 = "NORMAL_BS3",
186
+ TangentBS0 = "TANGENT_BS0",
187
+ TangentBS1 = "TANGENT_BS1",
188
+ TangentBS2 = "TANGENT_BS2",
189
+ TangentBS3 = "TANGENT_BS3"
113
190
  }
114
191
  export interface ShaderData extends EffectsObjectData {
115
192
  vertex: string;
@@ -0,0 +1,129 @@
1
+ export var DataType;
2
+ (function (DataType) {
3
+ DataType["VFXItemData"] = "VFXItemData";
4
+ DataType["EffectComponent"] = "EffectComponent";
5
+ DataType["Material"] = "Material";
6
+ DataType["Shader"] = "Shader";
7
+ DataType["SpriteComponent"] = "SpriteComponent";
8
+ DataType["ParticleSystem"] = "ParticleSystem";
9
+ DataType["InteractComponent"] = "InteractComponent";
10
+ DataType["CameraController"] = "CameraController";
11
+ DataType["Geometry"] = "Geometry";
12
+ DataType["Texture"] = "Texture";
13
+ DataType["AnimationClip"] = "AnimationClip";
14
+ DataType["TextComponent"] = "TextComponent";
15
+ DataType["BinaryAsset"] = "BinaryAsset";
16
+ // Timeline
17
+ DataType["TrackAsset"] = "TrackAsset";
18
+ DataType["TimelineAsset"] = "TimelineAsset";
19
+ DataType["ObjectBindingTrack"] = "ObjectBindingTrack";
20
+ DataType["TransformTrack"] = "TransformTrack";
21
+ DataType["SpriteColorTrack"] = "SpriteColorTrack";
22
+ DataType["ActivationTrack"] = "ActivationTrack";
23
+ DataType["SubCompositionTrack"] = "SubCompositionTrack";
24
+ DataType["TransformPlayableAsset"] = "TransformPlayableAsset";
25
+ DataType["SpriteColorPlayableAsset"] = "SpriteColorPlayableAsset";
26
+ DataType["ActivationPlayableAsset"] = "ActivationPlayableAsset";
27
+ DataType["SubCompositionPlayableAsset"] = "SubCompositionPlayableAsset";
28
+ // FIXME: 先完成ECS的场景转换,后面移到spec中
29
+ DataType["MeshComponent"] = "MeshComponent";
30
+ DataType["SkyboxComponent"] = "SkyboxComponent";
31
+ DataType["LightComponent"] = "LightComponent";
32
+ DataType["CameraComponent"] = "CameraComponent";
33
+ DataType["ModelPluginComponent"] = "ModelPluginComponent";
34
+ DataType["TreeComponent"] = "TreeComponent";
35
+ DataType["AnimationComponent"] = "AnimationComponent";
36
+ DataType["SpineComponent"] = "SpineComponent";
37
+ // Non-EffectObject
38
+ DataType["TimelineClip"] = "TimelineClip";
39
+ })(DataType || (DataType = {}));
40
+ export var GeometryType;
41
+ (function (GeometryType) {
42
+ /**
43
+ * Draw single points.
44
+ */
45
+ GeometryType[GeometryType["POINTS"] = 0] = "POINTS";
46
+ /**
47
+ * Draw lines. Each vertex connects to the one after it.
48
+ */
49
+ GeometryType[GeometryType["LINES"] = 1] = "LINES";
50
+ /**
51
+ * Draw lines. Each set of two vertices is treated as a separate line segment.
52
+ */
53
+ GeometryType[GeometryType["LINE_LOOP"] = 2] = "LINE_LOOP";
54
+ /**
55
+ * Draw a connected group of line segments from the first vertex to the last.
56
+ */
57
+ GeometryType[GeometryType["LINE_STRIP"] = 3] = "LINE_STRIP";
58
+ /**
59
+ * Draw triangles. Each set of three vertices creates a separate triangle.
60
+ */
61
+ GeometryType[GeometryType["TRIANGLES"] = 4] = "TRIANGLES";
62
+ /**
63
+ * Draw a connected strip of triangles.
64
+ */
65
+ GeometryType[GeometryType["TRIANGLE_STRIP"] = 5] = "TRIANGLE_STRIP";
66
+ /**
67
+ * Draw a connected group of triangles. Each vertex connects to the previous and the first vertex in the fan.
68
+ */
69
+ GeometryType[GeometryType["TRIANGLE_FAN"] = 6] = "TRIANGLE_FAN";
70
+ })(GeometryType || (GeometryType = {}));
71
+ export var VertexFormatType;
72
+ (function (VertexFormatType) {
73
+ VertexFormatType[VertexFormatType["Float16"] = 0] = "Float16";
74
+ VertexFormatType[VertexFormatType["Float32"] = 1] = "Float32";
75
+ VertexFormatType[VertexFormatType["Int8"] = 2] = "Int8";
76
+ VertexFormatType[VertexFormatType["Int16"] = 3] = "Int16";
77
+ VertexFormatType[VertexFormatType["Int32"] = 4] = "Int32";
78
+ VertexFormatType[VertexFormatType["UInt8"] = 5] = "UInt8";
79
+ VertexFormatType[VertexFormatType["UInt16"] = 6] = "UInt16";
80
+ VertexFormatType[VertexFormatType["UInt32"] = 7] = "UInt32";
81
+ })(VertexFormatType || (VertexFormatType = {}));
82
+ export var IndexFormatType;
83
+ (function (IndexFormatType) {
84
+ IndexFormatType[IndexFormatType["None"] = -1] = "None";
85
+ IndexFormatType[IndexFormatType["UInt8"] = 0] = "UInt8";
86
+ IndexFormatType[IndexFormatType["UInt16"] = 1] = "UInt16";
87
+ IndexFormatType[IndexFormatType["UInt32"] = 2] = "UInt32";
88
+ })(IndexFormatType || (IndexFormatType = {}));
89
+ // BINORMAL[n] Binormal float4
90
+ // BLENDINDICES[n] 混合索引 uint
91
+ // BLENDWEIGHT[n] 混合权重 FLOAT
92
+ // COLOR[n] 漫射和反射颜色 float4
93
+ // NORMAL[n] 法向矢量 float4
94
+ // POSITION[n] 对象空间中的顶点位置。 float4
95
+ // POSITIONT 变换的顶点位置。 float4
96
+ // PSIZE[n] 点大小 FLOAT
97
+ // TANGENT[n] 正切 float4
98
+ // TEXCOORD[n] 纹理坐标 float4
99
+ // POSITION_BS[n] Blend Shape 空间中的顶点位置 float4
100
+ // NORMAL_BS[n] Blend Shape 空间中的法向矢量 float4
101
+ // TANGENT_BS[n] Blend Shape 空间中的正切矢量 float4
102
+ export var VertexBufferSemantic;
103
+ (function (VertexBufferSemantic) {
104
+ VertexBufferSemantic["Position"] = "POSITION";
105
+ VertexBufferSemantic["Uv"] = "TEXCOORD0";
106
+ VertexBufferSemantic["Uv2"] = "TEXCOORD1";
107
+ VertexBufferSemantic["Normal"] = "NORMAL";
108
+ VertexBufferSemantic["Tangent"] = "TANGENT";
109
+ VertexBufferSemantic["Color"] = "COLOR";
110
+ VertexBufferSemantic["Joints"] = "JOINTS";
111
+ VertexBufferSemantic["Weights"] = "WEIGHTS";
112
+ //
113
+ VertexBufferSemantic["PositionBS0"] = "POSITION_BS0";
114
+ VertexBufferSemantic["PositionBS1"] = "POSITION_BS1";
115
+ VertexBufferSemantic["PositionBS2"] = "POSITION_BS2";
116
+ VertexBufferSemantic["PositionBS3"] = "POSITION_BS3";
117
+ VertexBufferSemantic["PositionBS4"] = "POSITION_BS4";
118
+ VertexBufferSemantic["PositionBS5"] = "POSITION_BS5";
119
+ VertexBufferSemantic["PositionBS6"] = "POSITION_BS6";
120
+ VertexBufferSemantic["PositionBS7"] = "POSITION_BS7";
121
+ VertexBufferSemantic["NormalBS0"] = "NORMAL_BS0";
122
+ VertexBufferSemantic["NormalBS1"] = "NORMAL_BS1";
123
+ VertexBufferSemantic["NormalBS2"] = "NORMAL_BS2";
124
+ VertexBufferSemantic["NormalBS3"] = "NORMAL_BS3";
125
+ VertexBufferSemantic["TangentBS0"] = "TANGENT_BS0";
126
+ VertexBufferSemantic["TangentBS1"] = "TANGENT_BS1";
127
+ VertexBufferSemantic["TangentBS2"] = "TANGENT_BS2";
128
+ VertexBufferSemantic["TangentBS3"] = "TANGENT_BS3";
129
+ })(VertexBufferSemantic || (VertexBufferSemantic = {}));
@@ -1,14 +1,15 @@
1
- import type { Item } from './item';
2
1
  import type { DataPath } from './components';
2
+ import type { Item } from './item';
3
+ import type { EndBehavior } from './item/base-item';
3
4
  export declare enum CameraClipMode {
4
5
  /**
5
6
  * 剪裁上下
6
7
  */
7
- portrait,
8
+ portrait = 1,
8
9
  /**
9
10
  * 剪裁左右
10
11
  */
11
- landscape
12
+ landscape = 0
12
13
  }
13
14
  /**
14
15
  * 相机属性
@@ -41,39 +42,7 @@ export interface CameraOptions {
41
42
  */
42
43
  clipMode: CameraClipMode;
43
44
  }
44
- /**
45
- * 结束行为
46
- */
47
- export declare enum CompositionEndBehavior {
48
- /**
49
- * 销毁
50
- */
51
- destroy,
52
- /**
53
- * 暂停
54
- */
55
- pause,
56
- /**
57
- * 重播
58
- */
59
- restart,
60
- /**
61
- * 无限播放
62
- */
63
- forward,
64
- /**
65
- * 销毁并保留最后一帧
66
- */
67
- pause_destroy,
68
- /**
69
- * 冻结
70
- */
71
- freeze
72
- }
73
- /**
74
- * 合成信息
75
- */
76
- export interface Composition {
45
+ interface CompositionBase {
77
46
  /**
78
47
  * 合成ID
79
48
  */
@@ -94,15 +63,11 @@ export interface Composition {
94
63
  /**
95
64
  * 合成结束行为
96
65
  */
97
- endBehavior: CompositionEndBehavior;
66
+ endBehavior: EndBehavior;
98
67
  /**
99
68
  * 合成相机信息
100
69
  */
101
70
  camera: CameraOptions;
102
- /**
103
- * 元素信息
104
- */
105
- items: Item[];
106
71
  /**
107
72
  * 合成视窗预览大小
108
73
  * 如果没有提供,默认为 player 的 container 大小
@@ -115,46 +80,39 @@ export interface Composition {
115
80
  fallbackImage?: string;
116
81
  }
117
82
  /**
118
- * 合成数据
83
+ * 合成信息
119
84
  */
120
- export interface CompositionData {
85
+ export interface Composition extends CompositionBase {
121
86
  /**
122
- * 合成ID
123
- */
124
- id: string;
125
- /**
126
- * 合成名称
127
- */
128
- name: string;
129
- /**
130
- * 合成持续时间
131
- */
132
- duration: number;
133
- /**
134
- * 合成开始播放的时间,单位妙
135
- * @default 0
87
+ * 元素信息
136
88
  */
137
- startTime?: number;
89
+ items: Item[];
90
+ }
91
+ /**
92
+ * 合成数据
93
+ */
94
+ export interface CompositionData extends CompositionBase {
138
95
  /**
139
- * 合成结束行为
96
+ * 元素信息
140
97
  */
141
- endBehavior: CompositionEndBehavior;
98
+ items: DataPath[];
142
99
  /**
143
- * 合成相机信息
100
+ * 时间轴资产(TimelineAssetData)
144
101
  */
145
- camera: CameraOptions;
102
+ timelineAsset: DataPath;
146
103
  /**
147
- * 元素信息
104
+ * 轨道的场景绑定
148
105
  */
149
- items: DataPath[];
106
+ sceneBindings: SceneBindingData[];
107
+ }
108
+ export interface SceneBindingData {
150
109
  /**
151
- * 合成视窗预览大小
152
- * 如果没有提供,默认为 player 的 container 大小
153
- * @default [0,0]
110
+ * 绑定的轨道资产(TrackAssetData)
154
111
  */
155
- previewSize?: [width: number, height: number];
112
+ key: DataPath;
156
113
  /**
157
- * 降级图
114
+ * 被绑定的场景对象(VFXItemData)
158
115
  */
159
- fallbackImage?: string;
116
+ value: DataPath;
160
117
  }
118
+ export {};
@@ -0,0 +1,12 @@
1
+ import { CAMERA_CLIP_MODE_NORMAL, CAMERA_CLIP_MODE_VERTICAL } from './constants';
2
+ export var CameraClipMode;
3
+ (function (CameraClipMode) {
4
+ /**
5
+ * 剪裁上下
6
+ */
7
+ CameraClipMode[CameraClipMode["portrait"] = 1] = "portrait";
8
+ /**
9
+ * 剪裁左右
10
+ */
11
+ CameraClipMode[CameraClipMode["landscape"] = 0] = "landscape";
12
+ })(CameraClipMode || (CameraClipMode = {}));
@@ -1,9 +1,32 @@
1
+ /**
2
+ * 销毁
3
+ */
1
4
  export declare const END_BEHAVIOR_DESTROY = 0;
5
+ /**
6
+ * 暂停
7
+ * @deprecated since 2.0 - use `END_BEHAVIOR_FREEZE` instead
8
+ */
2
9
  export declare const END_BEHAVIOR_PAUSE = 1;
10
+ /**
11
+ * 无限播放
12
+ */
3
13
  export declare const END_BEHAVIOR_FORWARD = 2;
14
+ /**
15
+ * 销毁并保留最后一帧
16
+ * @deprecated since 2.0
17
+ */
4
18
  export declare const END_BEHAVIOR_PAUSE_AND_DESTROY = 3;
19
+ /**
20
+ * 冻结
21
+ */
5
22
  export declare const END_BEHAVIOR_FREEZE = 4;
23
+ /**
24
+ * 重播
25
+ */
6
26
  export declare const END_BEHAVIOR_RESTART = 5;
27
+ /**
28
+ *
29
+ */
7
30
  export declare const END_BEHAVIOR_DESTROY_CHILDREN = 6;
8
31
  export declare const CAMERA_CLIP_MODE_VERTICAL = 1;
9
32
  export declare const CAMERA_CLIP_MODE_NORMAL = 0;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * 销毁
3
+ */
4
+ export const END_BEHAVIOR_DESTROY = 0;
5
+ /**
6
+ * 暂停
7
+ * @deprecated since 2.0 - use `END_BEHAVIOR_FREEZE` instead
8
+ */
9
+ export const END_BEHAVIOR_PAUSE = 1;
10
+ /**
11
+ * 无限播放
12
+ */
13
+ export const END_BEHAVIOR_FORWARD = 2;
14
+ /**
15
+ * 销毁并保留最后一帧
16
+ * @deprecated since 2.0
17
+ */
18
+ export const END_BEHAVIOR_PAUSE_AND_DESTROY = 3;
19
+ /**
20
+ * 冻结
21
+ */
22
+ export const END_BEHAVIOR_FREEZE = 4;
23
+ /**
24
+ * 重播
25
+ */
26
+ export const END_BEHAVIOR_RESTART = 5;
27
+ /**
28
+ *
29
+ */
30
+ export const END_BEHAVIOR_DESTROY_CHILDREN = 6;
31
+ export const CAMERA_CLIP_MODE_VERTICAL = 1;
32
+ export const CAMERA_CLIP_MODE_NORMAL = 0;
33
+ export const MESSAGE_ITEM_PHRASE_BEGIN = 2;
34
+ export const MESSAGE_ITEM_PHRASE_END = 1;
@@ -53,7 +53,6 @@ export declare enum BackgroundType {
53
53
  image = "image"
54
54
  }
55
55
  export interface TemplateContent {
56
- variables: Record<string, number | string>;
57
56
  /**
58
57
  * 当 template 宽高和 image 不相同时,会对 template 进行缩放,使其和 image 相同。
59
58
  */
@@ -62,22 +61,30 @@ export interface TemplateContent {
62
61
  background?: {
63
62
  type: BackgroundType;
64
63
  name: string;
65
- url: string;
64
+ url: string | HTMLImageElement;
66
65
  };
67
66
  }
67
+ export type TemplateVariables = Record<string, string | string[] | HTMLImageElement | HTMLImageElement[]>;
68
68
  /**
69
69
  * 纹理贴图属性
70
70
  */
71
71
  export interface Image {
72
+ id: string;
72
73
  /**
73
74
  * 纹理贴图地址
74
75
  */
75
76
  url: string;
76
77
  /**
77
- * webp 地址
78
- * 如果运行时支持 webp,则尽量使用 webp
78
+ * WebP 地址
79
+ * 如果运行时支持 WebP,则优先使用 WebP
79
80
  */
80
81
  webp?: string;
82
+ /**
83
+ * AVIF 地址
84
+ * 如果运行时支持 AVIF,则优先使用 AVIF
85
+ * @since 2.0.0
86
+ */
87
+ avif?: string;
81
88
  /**
82
89
  * 纹理贴图渲染等级
83
90
  * 如果没有设置,按照 B+ 处理
@@ -90,8 +97,8 @@ export interface Image {
90
97
  */
91
98
  mipmap?: boolean;
92
99
  /**
93
- * 图片Y轴的方向,如果Y轴向上(与OpenGL相同)则为 1
94
- * 如果Y轴向下(与OpenGL相反)则为 -1 ,图片再绘制数据模板的时候需要翻转绘制
100
+ * 图片 Y 轴的方向,如果 Y 轴向上(与 OpenGL 相同)则为 1
101
+ * 如果 Y 轴向下(与 OpenGL 相反)则为 -1,图片再绘制数据模板的时候需要翻转绘制
95
102
  * @default 1
96
103
  */
97
104
  oriY?: 1 | -1;
package/es/image.js ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * 动态换图类型
3
+ * @since 1.1.0
4
+ */
5
+ export var BackgroundType;
6
+ (function (BackgroundType) {
7
+ BackgroundType["video"] = "video";
8
+ BackgroundType["image"] = "image";
9
+ })(BackgroundType || (BackgroundType = {}));
@@ -1,4 +1,3 @@
1
- export * from 'uuid/dist/esm-browser/v4';
2
1
  export * from './type';
3
2
  export * from './composition';
4
3
  export * from './image';
@@ -20,8 +19,10 @@ export * from './item/effect-item';
20
19
  export * from './item/text-item';
21
20
  export * from './item/model';
22
21
  export * from './vfx-item-data';
22
+ export * from './animation-clip-data';
23
23
  export * from './binary';
24
24
  export * from './text';
25
25
  export * from './components';
26
26
  export * from './vfx-item-data';
27
27
  export * from './buitin-object-guid';
28
+ export * from './timeline';
package/es/index.js ADDED
@@ -0,0 +1,28 @@
1
+ export * from './type';
2
+ export * from './composition';
3
+ export * from './image';
4
+ export * from './constants';
5
+ export * from './number-expression';
6
+ export * from './scene';
7
+ export * from './item';
8
+ export * from './item/base-item';
9
+ export * from './item/camera-item';
10
+ export * from './item/composition-item';
11
+ export * from './item/interact-item';
12
+ export * from './item/null-item';
13
+ export * from './item/particle-item';
14
+ export * from './item/particle-shape';
15
+ export * from './item/plugin-item';
16
+ export * from './item/sprite-item';
17
+ export * from './item/spine-item';
18
+ export * from './item/effect-item';
19
+ export * from './item/text-item';
20
+ export * from './item/model';
21
+ export * from './vfx-item-data';
22
+ export * from './animation-clip-data';
23
+ export * from './binary';
24
+ export * from './text';
25
+ export * from './components';
26
+ export * from './vfx-item-data';
27
+ export * from './buitin-object-guid';
28
+ export * from './timeline';