@galacean/effects-specification 2.0.0-alpha.2 → 2.0.0-alpha.21

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 (104) 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 +9 -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/es/components.d.ts +209 -0
  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 +21 -27
  15. package/es/image.js +9 -0
  16. package/{dist/src → es}/index.d.ts +4 -2
  17. package/es/index.js +28 -0
  18. package/{dist/src → es}/item/base-item.d.ts +27 -8
  19. package/es/item/base-item.js +27 -0
  20. package/{dist/src → es}/item/camera-item.d.ts +6 -6
  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/es/item/effect-item.d.ts +35 -0
  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 +9 -8
  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 -23
  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 +2 -5
  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 +19 -19
  61. package/es/scene.js +1 -0
  62. package/{dist/src → es}/text.d.ts +3 -55
  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 +45 -20
  77. package/es/type.js +342 -0
  78. package/{dist/src → es}/vfx-item-data.d.ts +10 -11
  79. package/es/vfx-item-data.js +1 -0
  80. package/package.json +26 -47
  81. package/dist/fallback/camera.d.ts +0 -2
  82. package/dist/fallback/filter.d.ts +0 -2
  83. package/dist/fallback/index.d.ts +0 -12
  84. package/dist/fallback/interact.d.ts +0 -2
  85. package/dist/fallback/migration.d.ts +0 -13
  86. package/dist/fallback/particle.d.ts +0 -2
  87. package/dist/fallback/sprite.d.ts +0 -3
  88. package/dist/fallback/utils.d.ts +0 -36
  89. package/dist/fallback.js +0 -2155
  90. package/dist/fallback.js.map +0 -1
  91. package/dist/fallback.mjs +0 -2127
  92. package/dist/fallback.mjs.map +0 -1
  93. package/dist/index.js +0 -758
  94. package/dist/index.js.map +0 -1
  95. package/dist/index.mjs +0 -743
  96. package/dist/index.mjs.map +0 -1
  97. package/dist/src/components.d.ts +0 -93
  98. package/dist/src/item/effect-item.d.ts +0 -17
  99. package/dist/src/item/filter-item.d.ts +0 -99
  100. package/dist/src/item/null-item.d.ts +0 -94
  101. /package/{dist/src → es}/item/model/binary.d.ts +0 -0
  102. /package/{dist/src → es}/item/model/index.d.ts +0 -0
  103. /package/{dist/src → es}/item/model/render.d.ts +0 -0
  104. /package/{dist/src → es}/item/particle-shape.d.ts +0 -0
@@ -1,11 +1,12 @@
1
- import type { Composition } from './composition';
1
+ import type { Composition, CompositionData } from './composition';
2
2
  import type { SpineResource } from './item/spine-item';
3
3
  import type { PlayerVersion, Shape } from './type';
4
4
  import type { TemplateImage, Image, CompressedImage, TextureDefine } from './image';
5
5
  import type { FontBase, FontDefine } from './text';
6
6
  import type { BinaryFile } from './binary';
7
- import type { ComponentData, GeometryData, MaterialData, ShaderData } from './components';
7
+ import type { ComponentData, EffectsObjectData, GeometryData, MaterialData, ShaderData } from './components';
8
8
  import type { VFXItemData } from './vfx-item-data';
9
+ import type { AnimationClipData } from './animation-clip-data';
9
10
  /**
10
11
  * runtime 2.0 之前的场景信息
11
12
  * 素材信息存放于统一数据结构中
@@ -23,8 +24,10 @@ export interface JSONSceneLegacy {
23
24
  * 2.0 改造升级
24
25
  * 2.1 增加文本元素
25
26
  * 2.2 数据类型兼容
27
+ * 2.3 新增动态视频、陀螺仪支持旋转
28
+ * 2.4 支持贝塞尔曲线
26
29
  */
27
- version: '1.0' | '1.1' | '1.2' | '1.3' | '1.5' | '1.8' | '2.0' | '2.1' | '2.2';
30
+ version: '1.0' | '1.1' | '1.2' | '1.3' | '1.5' | '1.8' | '2.0' | '2.1' | '2.2' | '2.3' | '2.4';
28
31
  /**
29
32
  * 播放器版本信息
30
33
  */
@@ -103,7 +106,7 @@ export interface JSONScene {
103
106
  /**
104
107
  * JSON 版本
105
108
  *
106
- * 3.0 EC 改造
109
+ * 3.0 EC 改造、移除滤镜元素
107
110
  */
108
111
  version: string;
109
112
  /**
@@ -116,25 +119,25 @@ export interface JSONScene {
116
119
  type: string;
117
120
  /*************************************** 用于加载 json 后复原合成 **************************************/
118
121
  /**
119
- * 选中合成ID
122
+ * 选中合成 ID
120
123
  * 如果没有设置,选择合成中的第一个
121
124
  */
122
125
  compositionId?: string;
123
126
  /**
124
127
  * 渲染所需合成列表
125
128
  */
126
- compositions: Composition[];
129
+ compositions: CompositionData[];
127
130
  /******************************** 以下皆为可复用信息,加载在对应 Manager 中 *******************************/
128
131
  /**
129
132
  * 贴图信息
130
133
  */
131
134
  images: (TemplateImage | Image | CompressedImage)[];
132
135
  /**
133
- * 根据合成ID,每个合成用到的 image 的数组索引
136
+ * 根据合成 ID,每个合成用到的 image 的数组索引
134
137
  */
135
138
  imgUsage?: Record<string, number[]>;
136
139
  /**
137
- * 根据合成id,每个合成用到的 bin 的数组索引
140
+ * 根据合成 ID,每个合成用到的 bin 的数组索引
138
141
  */
139
142
  binUsage?: Record<string, number[]>;
140
143
  /**
@@ -146,28 +149,17 @@ export interface JSONScene {
146
149
  * 'model@1.0'
147
150
  */
148
151
  plugins: string[];
149
- /**
150
- * 保留字段
151
- */
152
- requires: SceneRequire[];
153
152
  /**
154
153
  * 字体资源
155
154
  * 数据模板下掉可以不要 FontBase[]
156
155
  */
157
156
  fonts?: FontBase[] | FontDefine[];
158
- /**
159
- * spine 资源
160
- * @version 1.5
161
- */
162
- spines?: SpineResource[];
163
157
  /**
164
158
  * 二进制文件地址
165
- * @version 1.3
166
159
  */
167
160
  bins?: BinaryFile[];
168
161
  /**
169
162
  * textures 配置
170
- * 从 v1.3 开始,images 数组会对应创建 textures 数组
171
163
  */
172
164
  textures?: TextureDefine[];
173
165
  /**
@@ -190,4 +182,12 @@ export interface JSONScene {
190
182
  * 几何体数据
191
183
  */
192
184
  geometries: GeometryData[];
185
+ /**
186
+ * 动画数据
187
+ */
188
+ animations: AnimationClipData[];
189
+ /**
190
+ * 分类外的资产数据
191
+ */
192
+ miscs: EffectsObjectData[];
193
193
  }
package/es/scene.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -1,9 +1,3 @@
1
- import type { RGBAColor } from './number-expression';
2
- export interface StringTemplate {
3
- fonts: FontBase[];
4
- texts: Text[];
5
- colors: RGBAColor[];
6
- }
7
1
  /**
8
2
  * 字体资源
9
3
  * @version 2.3
@@ -56,52 +50,6 @@ export interface FontBase {
56
50
  */
57
51
  letterSpace?: number;
58
52
  }
59
- export interface Text {
60
- x: number;
61
- y: number;
62
- /**
63
- * 变量名
64
- */
65
- n?: string;
66
- /**
67
- * content,
68
- * 文字内容,如果包含 $var$ 样式,内容将被替换
69
- */
70
- t: string;
71
- /**
72
- * width, if not provide use canvas.measureText() to get width
73
- * 文字最大宽度,如果不设置,由系统进行计算
74
- */
75
- w?: number;
76
- /**
77
- * font, index to fonts array
78
- * 字体,指向字体数组
79
- * @default 0
80
- */
81
- f?: number;
82
- /**
83
- * textAlignment
84
- * 字体排列
85
- * @default 0
86
- */
87
- a?: TextAlignment;
88
- /**
89
- * index to color array
90
- * 字体颜色,指向数组
91
- */
92
- c?: number;
93
- /**
94
- * 当文字超过最大宽度时,文字的表现行为
95
- * 仅当设置文字最大宽度后生效
96
- * @default 0
97
- */
98
- of?: TextOverflow;
99
- /**
100
- * 当文字overflow为ellipsis时的替换符号
101
- * @default ".."
102
- */
103
- et?: string;
104
- }
105
53
  export declare enum TextOverflow {
106
54
  /**
107
55
  * display 模式下,会显示所有文本,存在文本超过边界框的情况。
@@ -133,7 +81,7 @@ export declare enum TextBaseline {
133
81
  export declare enum TextAlignment {
134
82
  /**
135
83
  * text alignment starts from(x,y) to right direction
136
- * 从(x,y)开始第一个字符,向右边延伸
84
+ * 从 (x,y) 开始第一个字符,向右边延伸
137
85
  */
138
86
  left = 0,
139
87
  /**
@@ -143,7 +91,7 @@ export declare enum TextAlignment {
143
91
  middle = 1,
144
92
  /**
145
93
  * text alignment ends with(x,y) from left direction
146
- * 从(x,y)结束最后一个字符,向左边延伸
94
+ * 从 (x,y) 结束最后一个字符,向左边延伸
147
95
  */
148
96
  right = 2
149
97
  }
@@ -171,7 +119,7 @@ export declare enum FontStyle {
171
119
  /**
172
120
  * 正常
173
121
  */
174
- normal = "normal",
122
+ normal = "normal",// default
175
123
  /**
176
124
  * 斜体
177
125
  */
package/es/text.js ADDED
@@ -0,0 +1,84 @@
1
+ export var TextOverflow;
2
+ (function (TextOverflow) {
3
+ /**
4
+ * display 模式下,会显示所有文本,存在文本超过边界框的情况。
5
+ */
6
+ TextOverflow[TextOverflow["display"] = 0] = "display";
7
+ /**
8
+ * clip 模式下,当文本内容超出边界框时,多余的会被截断。
9
+ */
10
+ TextOverflow[TextOverflow["clip"] = 1] = "clip";
11
+ /**
12
+ * ellipsis 模式下,会使用(...)来代替超出边界框的内容。
13
+ */
14
+ TextOverflow[TextOverflow["ellipsis"] = 2] = "ellipsis";
15
+ })(TextOverflow || (TextOverflow = {}));
16
+ export var TextBaseline;
17
+ (function (TextBaseline) {
18
+ /**
19
+ * 文本顶对齐。
20
+ */
21
+ TextBaseline[TextBaseline["top"] = 0] = "top";
22
+ /**
23
+ * 文本垂直居中对齐。
24
+ */
25
+ TextBaseline[TextBaseline["middle"] = 1] = "middle";
26
+ /**
27
+ * 文本底对齐。
28
+ */
29
+ TextBaseline[TextBaseline["bottom"] = 2] = "bottom";
30
+ })(TextBaseline || (TextBaseline = {}));
31
+ export var TextAlignment;
32
+ (function (TextAlignment) {
33
+ /**
34
+ * text alignment starts from(x,y) to right direction
35
+ * 从 (x,y) 开始第一个字符,向右边延伸
36
+ */
37
+ TextAlignment[TextAlignment["left"] = 0] = "left";
38
+ /**
39
+ * (x,y) is middle position of text, where (left + right)/2 =(x,y)
40
+ * (x,y) 为文字中间位置,(最左位置 + 最右位置)/2 = (x,y)
41
+ */
42
+ TextAlignment[TextAlignment["middle"] = 1] = "middle";
43
+ /**
44
+ * text alignment ends with(x,y) from left direction
45
+ * 从 (x,y) 结束最后一个字符,向左边延伸
46
+ */
47
+ TextAlignment[TextAlignment["right"] = 2] = "right";
48
+ })(TextAlignment || (TextAlignment = {}));
49
+ /**
50
+ * 文本字重
51
+ */
52
+ export var TextWeight;
53
+ (function (TextWeight) {
54
+ /**
55
+ * 正常
56
+ */
57
+ TextWeight["normal"] = "normal";
58
+ /**
59
+ * 粗体
60
+ */
61
+ TextWeight["bold"] = "bold";
62
+ /**
63
+ * 瘦体
64
+ */
65
+ TextWeight["lighter"] = "lighter";
66
+ })(TextWeight || (TextWeight = {}));
67
+ /**
68
+ * 文本样式
69
+ */
70
+ export var FontStyle;
71
+ (function (FontStyle) {
72
+ /**
73
+ * 正常
74
+ */
75
+ FontStyle["normal"] = "normal";
76
+ /**
77
+ * 斜体
78
+ */
79
+ FontStyle["italic"] = "italic";
80
+ /**
81
+ * 倾斜体
82
+ */
83
+ FontStyle["oblique"] = "oblique";
84
+ })(FontStyle || (FontStyle = {}));
@@ -0,0 +1,5 @@
1
+ export * from './track/track-asset-data';
2
+ export * from './playables/sprite-color-playable-asset-data';
3
+ export * from './timeline-asset-data';
4
+ export * from './timeline-clip-data';
5
+ export * from './playables/transform-playable-asset-data';
@@ -0,0 +1,5 @@
1
+ export * from './track/track-asset-data';
2
+ export * from './playables/sprite-color-playable-asset-data';
3
+ export * from './timeline-asset-data';
4
+ export * from './timeline-clip-data';
5
+ export * from './playables/transform-playable-asset-data';
@@ -0,0 +1,8 @@
1
+ import type { DataType, EffectsObjectData } from '../../components';
2
+ import type { RGBAColorValue } from '../../number-expression';
3
+ import type { ColorOverLifetime } from '../../type';
4
+ export interface SpriteColorPlayableAssetData extends EffectsObjectData {
5
+ dataType: DataType.SpriteColorPlayableAsset;
6
+ colorOverLifetime?: ColorOverLifetime;
7
+ startColor?: RGBAColorValue;
8
+ }
@@ -0,0 +1,17 @@
1
+ import type { DataType, EffectsObjectData } from '../../components';
2
+ import type { SizeOverLifetime, RotationOverLifetime, PositionOverLifetime } from '../../type';
3
+ export interface TransformPlayableAssetData extends EffectsObjectData {
4
+ dataType: DataType.TransformPlayableAsset;
5
+ /**
6
+ * 元素大小变化属性
7
+ */
8
+ sizeOverLifetime?: SizeOverLifetime;
9
+ /**
10
+ * 元素旋转变化属性
11
+ */
12
+ rotationOverLifetime?: RotationOverLifetime;
13
+ /**
14
+ * 元素位置变化属性
15
+ */
16
+ positionOverLifetime?: PositionOverLifetime;
17
+ }
@@ -0,0 +1,8 @@
1
+ import type { EffectsObjectData, DataPath, DataType } from '../components';
2
+ export interface TimelineAssetData extends EffectsObjectData {
3
+ dataType: DataType.TimelineAsset;
4
+ /**
5
+ * 轨道数据(TrackAssetData)
6
+ */
7
+ tracks: DataPath[];
8
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { EndBehavior } from '../item/base-item';
2
+ import type { DataPath } from '../components';
3
+ export interface TimelineClipData {
4
+ start?: number;
5
+ duration?: number;
6
+ endBehavior?: EndBehavior;
7
+ /**
8
+ * 可播放资产(PlayableAssetData)
9
+ */
10
+ asset: DataPath;
11
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { DataPath, EffectsObjectData } from '../../components';
2
+ import type { TimelineClipData } from '../timeline-clip-data';
3
+ export interface TrackAssetData extends EffectsObjectData {
4
+ /**
5
+ * 子轨道数据(TrackAssetData)
6
+ */
7
+ children: DataPath[];
8
+ clips: TimelineClipData;
9
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -4,11 +4,11 @@ import type { FixedVec3Expression, vec2, vec3, GradientColor, ShapePoints, Shape
4
4
  */
5
5
  export interface PlayerVersion {
6
6
  /**
7
- * Web端版本号
7
+ * Web 端版本号
8
8
  */
9
9
  web: string;
10
10
  /**
11
- * Native端版本号
11
+ * Native 端版本号
12
12
  */
13
13
  native: string;
14
14
  }
@@ -72,15 +72,15 @@ export interface SizeOverLifetime {
72
72
  */
73
73
  size?: FixedNumberExpression;
74
74
  /**
75
- * x轴大小变化信息(分轴模式)
75
+ * x 轴大小变化信息(分轴模式)
76
76
  */
77
77
  x?: FixedNumberExpression;
78
78
  /**
79
- * y轴大小变化信息(分轴模式)
79
+ * y 轴大小变化信息(分轴模式)
80
80
  */
81
81
  y?: FixedNumberExpression;
82
82
  /**
83
- * z轴大小变化信息(分轴模式)
83
+ * z 轴大小变化信息(分轴模式)
84
84
  */
85
85
  z?: FixedNumberExpression;
86
86
  }
@@ -118,15 +118,15 @@ export interface PositionOverLifetime {
118
118
  */
119
119
  asMovement?: boolean;
120
120
  /**
121
- * x轴位置变化信息
121
+ * x 轴位置变化信息
122
122
  */
123
123
  linearX?: FixedNumberExpression;
124
124
  /**
125
- * y轴位置变化信息
125
+ * y 轴位置变化信息
126
126
  */
127
127
  linearY?: FixedNumberExpression;
128
128
  /**
129
- * z轴位置变化信息
129
+ * z 轴位置变化信息
130
130
  */
131
131
  linearZ?: FixedNumberExpression;
132
132
  /**
@@ -134,15 +134,15 @@ export interface PositionOverLifetime {
134
134
  */
135
135
  asRotation?: boolean;
136
136
  /**
137
- * x轴环绕角度变化信息
137
+ * x 轴环绕角度变化信息
138
138
  */
139
139
  orbitalX?: FixedNumberExpression;
140
140
  /**
141
- * y轴环绕角度变化信息
141
+ * y 轴环绕角度变化信息
142
142
  */
143
143
  orbitalY?: FixedNumberExpression;
144
144
  /**
145
- * z轴环绕角度变化信息
145
+ * z 轴环绕角度变化信息
146
146
  */
147
147
  orbitalZ?: FixedNumberExpression;
148
148
  /**
@@ -512,10 +512,6 @@ export declare enum ItemType {
512
512
  * 预合成元素
513
513
  */
514
514
  composition = "7",
515
- /**
516
- * 滤镜图层
517
- */
518
- filter = "8",
519
515
  /**
520
516
  * Spine 元素
521
517
  */
@@ -543,7 +539,11 @@ export declare enum ItemType {
543
539
  /**
544
540
  * 特效元素
545
541
  */
546
- effect = "effect"
542
+ effect = "effect",
543
+ /**
544
+ * 节点元素
545
+ */
546
+ node = "node"
547
547
  }
548
548
  /**
549
549
  * 渲染模式
@@ -616,21 +616,37 @@ export interface PluginGyroscopeTarget {
616
616
  */
617
617
  name: string;
618
618
  /**
619
- * x轴最小值
619
+ * x 轴位移最小值
620
620
  */
621
621
  xMin: number;
622
622
  /**
623
- * x轴最大值
623
+ * x 轴位移最大值
624
624
  */
625
625
  xMax: number;
626
626
  /**
627
- * y轴最小值
627
+ * y 轴位移最小值
628
628
  */
629
629
  yMin: number;
630
630
  /**
631
- * y轴最大值
631
+ * y 轴位移最大值
632
632
  */
633
633
  yMax: number;
634
+ /**
635
+ * 绕 x 轴(水平)旋转角度最小值
636
+ */
637
+ hMin: number;
638
+ /**
639
+ * 绕 x 轴(水平)旋转角度最大值
640
+ */
641
+ hMax: number;
642
+ /**
643
+ * 绕 y 轴(垂直)旋转角度最小值
644
+ */
645
+ vMin: number;
646
+ /**
647
+ * 绕 y 轴(垂直)旋转角度最大值
648
+ */
649
+ vMax: number;
634
650
  }
635
651
  /**
636
652
  * 二维蒙版形状属性
@@ -645,3 +661,12 @@ export interface ShapeGeometry {
645
661
  */
646
662
  s: ShapeSplits;
647
663
  }
664
+ export declare enum RenderType {
665
+ Opaque = "Opaque",
666
+ Transparent = "Transparent"
667
+ }
668
+ export declare enum RenderFace {
669
+ Both = "Both",
670
+ Back = "Back",
671
+ Front = "Front"
672
+ }