@galacean/effects-specification 0.0.1

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 (49) hide show
  1. package/README.md +28 -0
  2. package/dist/fallback/camera.d.ts +2 -0
  3. package/dist/fallback/filter.d.ts +2 -0
  4. package/dist/fallback/index.d.ts +12 -0
  5. package/dist/fallback/interact.d.ts +2 -0
  6. package/dist/fallback/migration.d.ts +5 -0
  7. package/dist/fallback/particle.d.ts +2 -0
  8. package/dist/fallback/sprite.d.ts +3 -0
  9. package/dist/fallback/utils.d.ts +29 -0
  10. package/dist/fallback.js +1664 -0
  11. package/dist/fallback.js.map +1 -0
  12. package/dist/fallback.mjs +1639 -0
  13. package/dist/fallback.mjs.map +1 -0
  14. package/dist/index.js +689 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/index.mjs +674 -0
  17. package/dist/index.mjs.map +1 -0
  18. package/dist/src/binary.d.ts +60 -0
  19. package/dist/src/composition.d.ts +111 -0
  20. package/dist/src/constants.d.ts +11 -0
  21. package/dist/src/image.d.ts +123 -0
  22. package/dist/src/index.d.ts +22 -0
  23. package/dist/src/item/base-item.d.ts +110 -0
  24. package/dist/src/item/camera-item.d.ts +69 -0
  25. package/dist/src/item/composition-item.d.ts +56 -0
  26. package/dist/src/item/filter-item.d.ts +99 -0
  27. package/dist/src/item/interact-item.d.ts +85 -0
  28. package/dist/src/item/model/binary.d.ts +85 -0
  29. package/dist/src/item/model/camera.d.ts +33 -0
  30. package/dist/src/item/model/index.d.ts +35 -0
  31. package/dist/src/item/model/light.d.ts +72 -0
  32. package/dist/src/item/model/material.d.ts +84 -0
  33. package/dist/src/item/model/mesh.d.ts +69 -0
  34. package/dist/src/item/model/render.d.ts +41 -0
  35. package/dist/src/item/model/skybox.d.ts +50 -0
  36. package/dist/src/item/model/tree.d.ts +65 -0
  37. package/dist/src/item/null-item.d.ts +46 -0
  38. package/dist/src/item/particle-item.d.ts +412 -0
  39. package/dist/src/item/particle-shape.d.ts +212 -0
  40. package/dist/src/item/plugin-item.d.ts +46 -0
  41. package/dist/src/item/spine-item.d.ts +93 -0
  42. package/dist/src/item/sprite-item.d.ts +71 -0
  43. package/dist/src/item/text-item.d.ts +172 -0
  44. package/dist/src/item.d.ts +17 -0
  45. package/dist/src/numberExpression.d.ts +279 -0
  46. package/dist/src/scene.d.ts +92 -0
  47. package/dist/src/text.d.ts +183 -0
  48. package/dist/src/type.d.ts +643 -0
  49. package/package.json +67 -0
@@ -0,0 +1,212 @@
1
+ import type { ShapeType } from '../type';
2
+ import type { NumberExpression, vec3 } from '../numberExpression';
3
+ export declare enum ShapeArcMode {
4
+ /**
5
+ * 随机
6
+ */
7
+ RANDOM = 0,
8
+ /**
9
+ * 单向循环
10
+ */
11
+ UNIDIRECTIONAL_CYCLE = 1,
12
+ /**
13
+ * 双向循环
14
+ */
15
+ BIDIRECTIONAL_CYCLE = 2,
16
+ /**
17
+ * 均匀爆发
18
+ */
19
+ UNIFORM_BURST = 3
20
+ }
21
+ export interface ParticleShapeBase {
22
+ /**
23
+ * 粒子形状类型
24
+ */
25
+ type: ShapeType;
26
+ /**
27
+ * 发射模式
28
+ */
29
+ arcMode: ShapeArcMode;
30
+ /**
31
+ * 运动对齐开关
32
+ */
33
+ alignSpeedDirection?: boolean;
34
+ /**
35
+ * 向上方向
36
+ */
37
+ upDirection?: vec3;
38
+ /**
39
+ * 发射方向旋转
40
+ */
41
+ turbulenceX?: NumberExpression;
42
+ turbulenceY?: NumberExpression;
43
+ turbulenceZ?: NumberExpression;
44
+ }
45
+ export interface ParticleShapeNone {
46
+ type: ShapeType.NONE;
47
+ /**
48
+ * 发射方向旋转
49
+ */
50
+ turbulenceX?: NumberExpression;
51
+ turbulenceY?: NumberExpression;
52
+ turbulenceZ?: NumberExpression;
53
+ upDirection?: number[];
54
+ }
55
+ export declare type ParticleShape = ParticleShapeCone | ParticleShapeCircle | ParticleShapeSphere | ParticleShapeHemisphere | ParticleShapeDonut | ParticleShapeRect | ParticleShapeRectEdge | ParticleShapeTexture | ParticleShapeEdge | ParticleShapeNone;
56
+ /**
57
+ * 圆锥发射器
58
+ */
59
+ export interface ParticleShapeCone extends ParticleShapeBase {
60
+ type: ShapeType.CONE;
61
+ /**
62
+ * 形状角度
63
+ */
64
+ angle: number;
65
+ /**
66
+ * 形状半径
67
+ */
68
+ radius: number;
69
+ /**
70
+ * 形状曲率
71
+ */
72
+ arc: number;
73
+ }
74
+ /**
75
+ * 圆发射器
76
+ */
77
+ export interface ParticleShapeCircle extends ParticleShapeBase {
78
+ type: ShapeType.CIRCLE;
79
+ /**
80
+ * 形状半径
81
+ */
82
+ radius: number;
83
+ /**
84
+ * 形状曲率
85
+ */
86
+ arc: number;
87
+ }
88
+ /**
89
+ * 圆球发射器
90
+ */
91
+ export interface ParticleShapeSphere extends ParticleShapeBase {
92
+ type: ShapeType.SPHERE;
93
+ /**
94
+ * 形状半径
95
+ */
96
+ radius: number;
97
+ /**
98
+ * 形状曲率
99
+ */
100
+ arc: number;
101
+ }
102
+ /**
103
+ * 半球发射器
104
+ */
105
+ export interface ParticleShapeHemisphere extends ParticleShapeBase {
106
+ type: ShapeType.HEMISPHERE;
107
+ /**
108
+ * 形状半径
109
+ */
110
+ radius: number;
111
+ /**
112
+ * 形状曲率
113
+ */
114
+ arc: number;
115
+ }
116
+ /**
117
+ * 圆环发射器
118
+ */
119
+ export interface ParticleShapeDonut extends ParticleShapeBase {
120
+ type: ShapeType.DONUT;
121
+ /**
122
+ * 形状半径
123
+ */
124
+ radius: number;
125
+ /**
126
+ * 圆环半径
127
+ */
128
+ donutRadius: number;
129
+ /**
130
+ * 形状曲率
131
+ */
132
+ arc: number;
133
+ }
134
+ /**
135
+ * 矩形发射器
136
+ */
137
+ export interface ParticleShapeRect extends ParticleShapeBase {
138
+ type: ShapeType.RECTANGLE;
139
+ /**
140
+ * 宽度
141
+ */
142
+ width: number;
143
+ /**
144
+ * 高度
145
+ */
146
+ height: number;
147
+ }
148
+ /**
149
+ * 矩形框发射器
150
+ */
151
+ export interface ParticleShapeRectEdge extends ParticleShapeBase {
152
+ type: ShapeType.RECTANGLE_EDGE;
153
+ /**
154
+ * 宽度
155
+ */
156
+ width: number;
157
+ /**
158
+ * 高度
159
+ */
160
+ height: number;
161
+ }
162
+ /**
163
+ * 直线发射器
164
+ */
165
+ export interface ParticleShapeEdge extends ParticleShapeBase {
166
+ type: ShapeType.EDGE;
167
+ /**
168
+ * 宽度
169
+ */
170
+ width: number;
171
+ }
172
+ /**
173
+ * 贴图发射器
174
+ */
175
+ export interface ParticleShapeTexture extends ParticleShapeBase {
176
+ type: ShapeType.TEXTURE;
177
+ detail: ParticleTextureShapeDetail;
178
+ /**
179
+ * 贴图随机数
180
+ */
181
+ random: number;
182
+ /**
183
+ * 宽度
184
+ */
185
+ width: number;
186
+ /**
187
+ * 高度
188
+ */
189
+ height: number;
190
+ }
191
+ /**
192
+ * 贴图形状数据
193
+ */
194
+ export interface ParticleTextureShapeDetail {
195
+ /**
196
+ * 贴图形状宽度
197
+ */
198
+ width: number;
199
+ /**
200
+ * 贴图形状高度
201
+ */
202
+ height: number;
203
+ /**
204
+ * 编辑器参数
205
+ * 对于图片栅格化时,像素区域的大小
206
+ */
207
+ block: [number, number];
208
+ /**
209
+ * 贴图形状点
210
+ */
211
+ anchors: number[];
212
+ }
@@ -0,0 +1,46 @@
1
+ import type { ItemType, PluginGyroscopeTarget, PluginType, RendererOptions } from '../type';
2
+ import type { BaseItem, ItemEndBehavior } from './base-item';
3
+ /**
4
+ * 插件元素
5
+ */
6
+ export interface PluginItem extends BaseItem {
7
+ /**
8
+ * 元素类型[指定为plugin]
9
+ */
10
+ type: ItemType.plugin;
11
+ /**
12
+ * 插件元素渲染信息
13
+ */
14
+ content: PluginContent;
15
+ endBehavior: ItemEndBehavior;
16
+ }
17
+ /**
18
+ * 插件元素渲染属性
19
+ */
20
+ export interface PluginContent {
21
+ /**
22
+ * 插件元素基础属性
23
+ */
24
+ options: PluginOption;
25
+ /**
26
+ * 插件元素渲染属性
27
+ */
28
+ renderer: RendererOptions;
29
+ }
30
+ /**
31
+ * 插件元素基础属性
32
+ */
33
+ export declare type PluginOption = PluginGyroscopeOption;
34
+ /**
35
+ * 陀螺仪插件基础属性
36
+ */
37
+ export interface PluginGyroscopeOption {
38
+ /**
39
+ * 插件类型
40
+ */
41
+ type: PluginType.GYROSCOPE;
42
+ /**
43
+ * 陀螺仪属性
44
+ */
45
+ targets: PluginGyroscopeTarget[];
46
+ }
@@ -0,0 +1,93 @@
1
+ import type { BinaryPointer } from '../binary';
2
+ import type { SizeOverLifetime, RotationOverLifetime, PositionOverLifetime, ColorOverLifetime, RendererOptions, ItemType } from '../type';
3
+ import type { BaseItem, ItemEndBehavior } from './base-item';
4
+ /**
5
+ * 插件元素
6
+ */
7
+ export interface SpineItem extends BaseItem {
8
+ /**
9
+ * 元素类型 "spine"
10
+ */
11
+ type: ItemType.spine;
12
+ /**
13
+ * 插件元素渲染信息
14
+ */
15
+ content: SpineContent;
16
+ endBehavior: ItemEndBehavior;
17
+ }
18
+ /**
19
+ * Spine元素渲染属性
20
+ */
21
+ export interface SpineContent {
22
+ /**
23
+ * Spine元素基础属性
24
+ */
25
+ options: PluginSpineOption;
26
+ /**
27
+ * Spine元素材质渲染属性
28
+ */
29
+ renderer?: RendererOptions;
30
+ /**
31
+ * Spine元素大小变化属性
32
+ */
33
+ sizeOverLifetime?: SizeOverLifetime;
34
+ /**
35
+ * Spine元素旋转变化属性
36
+ */
37
+ rotationOverLifetime?: RotationOverLifetime;
38
+ /**
39
+ * Spine元素位置变化属性
40
+ */
41
+ positionOverLifetime?: PositionOverLifetime;
42
+ /**
43
+ * Spine元素色彩变化属性
44
+ */
45
+ colorOverLifetime?: ColorOverLifetime;
46
+ }
47
+ /**
48
+ * Spine 插件属性
49
+ */
50
+ export interface PluginSpineOption {
51
+ /**
52
+ * 当前使用的皮肤名称
53
+ */
54
+ activeSkin: string;
55
+ /**
56
+ * 当前使用的动画列表,1.5之前为 string
57
+ */
58
+ activeAnimation: string[] | string;
59
+ /**
60
+ * 在 spines 资源数组中的索引
61
+ */
62
+ spine: number;
63
+ /**
64
+ * 默认融合时间
65
+ */
66
+ mixDuration?: number;
67
+ /**
68
+ * 动画播放的速度
69
+ */
70
+ speed?: number;
71
+ }
72
+ /**
73
+ * spine资源信息
74
+ */
75
+ export declare type skeletonFileType = 'json' | 'skel';
76
+ export interface SpineResource {
77
+ /**
78
+ * atlas 文件在 `bins` 中的指针
79
+ */
80
+ atlas: BinaryPointer;
81
+ /**
82
+ * 骨骼文件
83
+ */
84
+ skeleton: BinaryPointer;
85
+ /**
86
+ * skeleton 文件类型, `.skel/.json`
87
+ */
88
+ skeletonType: skeletonFileType;
89
+ /**
90
+ * 图像文件在 `scene.textures` 数组中的索引
91
+ */
92
+ images: number[];
93
+ }
@@ -0,0 +1,71 @@
1
+ import type { BaseItem, ItemEndBehavior } from './base-item';
2
+ import type { SizeOverLifetime, RotationOverLifetime, PositionOverLifetime, ColorOverLifetime, ItemType, TextureSheetAnimation, RendererOptions, SplitParameter, InteractBehavior } from '../type';
3
+ import type { RGBAColorValue } from '../numberExpression';
4
+ /**
5
+ * 图层元素
6
+ */
7
+ export interface SpriteItem extends BaseItem {
8
+ /**
9
+ * 元素类型[指定为sprite]
10
+ */
11
+ type: ItemType.sprite;
12
+ /**
13
+ * 图层元素渲染信息
14
+ */
15
+ content: SpriteContent;
16
+ endBehavior: ItemEndBehavior;
17
+ }
18
+ export interface SpriteContentOptions {
19
+ /**
20
+ * 元素基础颜色
21
+ * @default [255,255,255,255]
22
+ */
23
+ startColor?: RGBAColorValue;
24
+ }
25
+ /**
26
+ * 图层元素渲染属性
27
+ */
28
+ export interface SpriteContent {
29
+ /**
30
+ * added by loader
31
+ * @default null
32
+ */
33
+ splits?: SplitParameter[];
34
+ /**
35
+ * 图层元素基础属性
36
+ */
37
+ options: SpriteContentOptions;
38
+ /**
39
+ * 图层元素材质渲染属性
40
+ */
41
+ renderer: RendererOptions;
42
+ /**
43
+ * 图层元素大小变化属性
44
+ */
45
+ sizeOverLifetime?: SizeOverLifetime;
46
+ /**
47
+ * 图层元素旋转变化属性
48
+ */
49
+ rotationOverLifetime?: RotationOverLifetime;
50
+ /**
51
+ * 图层元素位置变化属性
52
+ */
53
+ positionOverLifetime?: PositionOverLifetime;
54
+ /**
55
+ * 图层元素色彩变化属性
56
+ */
57
+ colorOverLifetime?: ColorOverLifetime;
58
+ /**
59
+ * 图层元素贴图变化属性
60
+ */
61
+ textureSheetAnimation?: TextureSheetAnimation;
62
+ /**
63
+ * 图层交互
64
+ */
65
+ interaction?: {
66
+ /**
67
+ * 交互行为
68
+ */
69
+ behavior: InteractBehavior;
70
+ };
71
+ }
@@ -0,0 +1,172 @@
1
+ import type { BaseItem, ItemEndBehavior } from './base-item';
2
+ import type { SizeOverLifetime, RotationOverLifetime, PositionOverLifetime, ColorOverLifetime, ItemType, TextureSheetAnimation, RendererOptions, InteractBehavior } from '../type';
3
+ import type { RGBAColorValue } from '../numberExpression';
4
+ import type { FontStyle, TextAlignment, TextBaseline, TextOverflow, TextWeight } from 'src/text';
5
+ /**
6
+ * 文本元素
7
+ */
8
+ export interface TextItem extends BaseItem {
9
+ /**
10
+ * 元素类型[指定为text]
11
+ */
12
+ type: ItemType.text;
13
+ /**
14
+ * 文本元素渲染信息
15
+ */
16
+ content: TextContent;
17
+ endBehavior: ItemEndBehavior;
18
+ }
19
+ export interface TextContentOptions {
20
+ /**
21
+ * 文本内容
22
+ */
23
+ text: string;
24
+ /**
25
+ * 字体大小
26
+ * @default 40
27
+ */
28
+ fontSize: number;
29
+ /**
30
+ * 文本颜色
31
+ * @default [1,1,1,1]
32
+ */
33
+ textColor?: RGBAColorValue;
34
+ /**
35
+ * 文本字体
36
+ * @default 'Arial'
37
+ */
38
+ fontFamily?: string;
39
+ /**
40
+ * 文本间隔
41
+ * @default 0
42
+ */
43
+ letterSpace?: number;
44
+ /**
45
+ * 上下对齐方式
46
+ * @default TextBaseline.middle
47
+ */
48
+ textBaseline?: TextBaseline;
49
+ /**
50
+ * 左右对齐方式
51
+ * @default TextAlignment.left
52
+ */
53
+ textAlign?: TextAlignment;
54
+ /**
55
+ * 文本固定宽度(和自适应宽高冲突)
56
+ * @default 31
57
+ */
58
+ textWidth?: number;
59
+ /**
60
+ * 文本行高
61
+ * @default 31
62
+ */
63
+ lineHeight?: number;
64
+ /**
65
+ * 文本高度
66
+ * @default 31
67
+ */
68
+ textHeight?: number;
69
+ /**
70
+ * 自适应宽高开关(和文本固定宽度冲突)
71
+ * @default false
72
+ */
73
+ autoWidth?: boolean;
74
+ /**
75
+ * 文本字重
76
+ * @default TextWeight.normal
77
+ */
78
+ fontWeight?: TextWeight;
79
+ /**
80
+ * 文本样式
81
+ * @default FontStyle.normal
82
+ */
83
+ fontStyle?: FontStyle;
84
+ /**
85
+ * 当文字超过最大宽度时,文字的表现行为
86
+ * 仅当设置文字最大宽度后生效
87
+ * @default TextOverflow.display
88
+ */
89
+ textOverflow?: TextOverflow;
90
+ /**
91
+ * 文本外描边
92
+ */
93
+ outline?: {
94
+ /**
95
+ * 外描边颜色
96
+ * @default [1,1,1,0]
97
+ */
98
+ outlineColor?: RGBAColorValue;
99
+ /**
100
+ * 外描边宽度
101
+ * @default 1
102
+ */
103
+ outlineWidth?: number;
104
+ };
105
+ /**
106
+ * 文本阴影
107
+ */
108
+ shadow?: {
109
+ /**
110
+ * 文本阴影颜色
111
+ * @default [0,0,0,0]
112
+ */
113
+ shadowColor?: RGBAColorValue;
114
+ /**
115
+ * 阴影模糊
116
+ * @default 2
117
+ */
118
+ shadowBlur?: number;
119
+ /**
120
+ * 阴影水平偏移距离
121
+ * @default 0
122
+ */
123
+ shadowOffsetX?: number;
124
+ /**
125
+ * 阴影高度偏移距离
126
+ * @default 0
127
+ */
128
+ shadowOffsetY?: number;
129
+ };
130
+ }
131
+ /**
132
+ * 文本元素渲染属性
133
+ */
134
+ export interface TextContent {
135
+ /**
136
+ * 文本元素基础属性
137
+ */
138
+ options: TextContentOptions;
139
+ /**
140
+ * 文本元素材质渲染属性
141
+ */
142
+ renderer: RendererOptions;
143
+ /**
144
+ * 文本元素大小变化属性
145
+ */
146
+ sizeOverLifetime?: SizeOverLifetime;
147
+ /**
148
+ * 文本元素旋转变化属性
149
+ */
150
+ rotationOverLifetime?: RotationOverLifetime;
151
+ /**
152
+ * 文本元素位置变化属性
153
+ */
154
+ positionOverLifetime?: PositionOverLifetime;
155
+ /**
156
+ * 文本元素色彩变化属性
157
+ */
158
+ colorOverLifetime?: ColorOverLifetime;
159
+ /**
160
+ * 文本元素贴图变化属性
161
+ */
162
+ textureSheetAnimation?: TextureSheetAnimation;
163
+ /**
164
+ * 图层交互
165
+ */
166
+ interaction?: {
167
+ /**
168
+ * 交互行为
169
+ */
170
+ behavior: InteractBehavior;
171
+ };
172
+ }
@@ -0,0 +1,17 @@
1
+ import type { NullItem } from './item/null-item';
2
+ import type { SpineItem } from './item/spine-item';
3
+ import type { SpriteItem } from './item/sprite-item';
4
+ import type { PluginItem } from './item/plugin-item';
5
+ import type { ParticleItem } from './item/particle-item';
6
+ import type { InteractItem } from './item/interact-item';
7
+ import type { ModelCameraItem, ModelLightItem, ModelMeshItem, ModelSkyboxItem, ModelTreeItem } from './item/model';
8
+ import type { FilterItem } from './item/filter-item';
9
+ import type { CameraItem } from './item/camera-item';
10
+ import type { CompositionItem } from './item/composition-item';
11
+ import type { TextItem } from './item/text-item';
12
+ /**
13
+ * Item Interface,
14
+ * 1.0版本
15
+ * 基类,无对应元素
16
+ */
17
+ export declare type Item = SpriteItem | ParticleItem | NullItem | PluginItem | InteractItem | FilterItem | CameraItem | TextItem | ModelMeshItem<'json'> | ModelSkyboxItem<'json'> | ModelTreeItem<'json'> | ModelLightItem | ModelCameraItem | SpineItem | CompositionItem | ModelMeshItem<'studio'> | ModelSkyboxItem<'studio'> | ModelTreeItem<'studio'>;