@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.
- package/README.md +28 -0
- package/dist/fallback/camera.d.ts +2 -0
- package/dist/fallback/filter.d.ts +2 -0
- package/dist/fallback/index.d.ts +12 -0
- package/dist/fallback/interact.d.ts +2 -0
- package/dist/fallback/migration.d.ts +5 -0
- package/dist/fallback/particle.d.ts +2 -0
- package/dist/fallback/sprite.d.ts +3 -0
- package/dist/fallback/utils.d.ts +29 -0
- package/dist/fallback.js +1664 -0
- package/dist/fallback.js.map +1 -0
- package/dist/fallback.mjs +1639 -0
- package/dist/fallback.mjs.map +1 -0
- package/dist/index.js +689 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +674 -0
- package/dist/index.mjs.map +1 -0
- package/dist/src/binary.d.ts +60 -0
- package/dist/src/composition.d.ts +111 -0
- package/dist/src/constants.d.ts +11 -0
- package/dist/src/image.d.ts +123 -0
- package/dist/src/index.d.ts +22 -0
- package/dist/src/item/base-item.d.ts +110 -0
- package/dist/src/item/camera-item.d.ts +69 -0
- package/dist/src/item/composition-item.d.ts +56 -0
- package/dist/src/item/filter-item.d.ts +99 -0
- package/dist/src/item/interact-item.d.ts +85 -0
- package/dist/src/item/model/binary.d.ts +85 -0
- package/dist/src/item/model/camera.d.ts +33 -0
- package/dist/src/item/model/index.d.ts +35 -0
- package/dist/src/item/model/light.d.ts +72 -0
- package/dist/src/item/model/material.d.ts +84 -0
- package/dist/src/item/model/mesh.d.ts +69 -0
- package/dist/src/item/model/render.d.ts +41 -0
- package/dist/src/item/model/skybox.d.ts +50 -0
- package/dist/src/item/model/tree.d.ts +65 -0
- package/dist/src/item/null-item.d.ts +46 -0
- package/dist/src/item/particle-item.d.ts +412 -0
- package/dist/src/item/particle-shape.d.ts +212 -0
- package/dist/src/item/plugin-item.d.ts +46 -0
- package/dist/src/item/spine-item.d.ts +93 -0
- package/dist/src/item/sprite-item.d.ts +71 -0
- package/dist/src/item/text-item.d.ts +172 -0
- package/dist/src/item.d.ts +17 -0
- package/dist/src/numberExpression.d.ts +279 -0
- package/dist/src/scene.d.ts +92 -0
- package/dist/src/text.d.ts +183 -0
- package/dist/src/type.d.ts +643 -0
- package/package.json +67 -0
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
/*********************************************/
|
|
2
|
+
/*********************************************/
|
|
3
|
+
export declare enum ValueType {
|
|
4
|
+
/**
|
|
5
|
+
* 常数
|
|
6
|
+
*/
|
|
7
|
+
CONSTANT = 0,
|
|
8
|
+
/**
|
|
9
|
+
* 二维常数向量
|
|
10
|
+
*/
|
|
11
|
+
CONSTANT_VEC2 = 1,
|
|
12
|
+
/**
|
|
13
|
+
* 三维常数向量
|
|
14
|
+
*/
|
|
15
|
+
CONSTANT_VEC3 = 2,
|
|
16
|
+
/**
|
|
17
|
+
* 四维常数向量
|
|
18
|
+
*/
|
|
19
|
+
CONSTANT_VEC4 = 3,
|
|
20
|
+
/**
|
|
21
|
+
* 随机数
|
|
22
|
+
*/
|
|
23
|
+
RANDOM = 4,
|
|
24
|
+
/**
|
|
25
|
+
* 直线
|
|
26
|
+
*/
|
|
27
|
+
LINE = 5,
|
|
28
|
+
/**
|
|
29
|
+
* 曲线
|
|
30
|
+
*/
|
|
31
|
+
CURVE = 6,
|
|
32
|
+
/**
|
|
33
|
+
* 贝塞尔路径
|
|
34
|
+
*/
|
|
35
|
+
BEZIER_PATH = 7,
|
|
36
|
+
/**
|
|
37
|
+
* 颜色
|
|
38
|
+
*/
|
|
39
|
+
RGBA_COLOR = 8,
|
|
40
|
+
/**
|
|
41
|
+
* 渐变色
|
|
42
|
+
*/
|
|
43
|
+
GRADIENT_COLOR = 9,
|
|
44
|
+
/**
|
|
45
|
+
* 蒙版形状点集
|
|
46
|
+
*/
|
|
47
|
+
SHAPE_POINTS = 10,
|
|
48
|
+
/**
|
|
49
|
+
* 蒙版形状切分
|
|
50
|
+
*/
|
|
51
|
+
SHAPE_SPLITS = 11,
|
|
52
|
+
/**
|
|
53
|
+
*直线路径
|
|
54
|
+
*/
|
|
55
|
+
LINEAR_PATH = 12,
|
|
56
|
+
/**
|
|
57
|
+
* 多色
|
|
58
|
+
*/
|
|
59
|
+
COLORS = 13,
|
|
60
|
+
/**
|
|
61
|
+
* 二进制指针
|
|
62
|
+
*/
|
|
63
|
+
BINARY = 20,
|
|
64
|
+
/**
|
|
65
|
+
* 贝塞尔曲线
|
|
66
|
+
*/
|
|
67
|
+
BEZIER_CURVE = 21,
|
|
68
|
+
/**
|
|
69
|
+
* 贝塞尔曲线路径
|
|
70
|
+
*/
|
|
71
|
+
BEZIER_CURVE_PATH = 22
|
|
72
|
+
}
|
|
73
|
+
export declare type vec2 = [x: number, y: number];
|
|
74
|
+
export declare type vec3 = [x: number, y: number, z: number];
|
|
75
|
+
export declare type vec4 = [x: number, y: number, z: number, w: number];
|
|
76
|
+
export declare type mat2 = [m11: number, m12: number, m21: number, m22: number];
|
|
77
|
+
export declare type mat3 = [
|
|
78
|
+
m11: number,
|
|
79
|
+
m12: number,
|
|
80
|
+
m13: number,
|
|
81
|
+
m21: number,
|
|
82
|
+
m22: number,
|
|
83
|
+
m23: number,
|
|
84
|
+
m31: number,
|
|
85
|
+
m32: number,
|
|
86
|
+
m33: number
|
|
87
|
+
];
|
|
88
|
+
export declare type mat4 = [
|
|
89
|
+
m11: number,
|
|
90
|
+
m12: number,
|
|
91
|
+
m13: number,
|
|
92
|
+
m14: number,
|
|
93
|
+
m21: number,
|
|
94
|
+
m22: number,
|
|
95
|
+
m23: number,
|
|
96
|
+
m24: number,
|
|
97
|
+
m31: number,
|
|
98
|
+
m32: number,
|
|
99
|
+
m33: number,
|
|
100
|
+
m34: number,
|
|
101
|
+
m41: number,
|
|
102
|
+
m42: number,
|
|
103
|
+
m43: number,
|
|
104
|
+
m44: number
|
|
105
|
+
];
|
|
106
|
+
/*********************************************/
|
|
107
|
+
/*********************************************/
|
|
108
|
+
export declare type FunctionExpression = LineValue | CurveValue | BezierValue;
|
|
109
|
+
export declare type FixedNumberExpression = ConstantNumber | LineValue | CurveValue | BezierValue;
|
|
110
|
+
export declare type NumberExpression = FixedNumberExpression | RandomValue;
|
|
111
|
+
export declare type FixedVec3Expression = ConstantVec3 | BezierPath | LinearPath | BezierCurvePath;
|
|
112
|
+
/**
|
|
113
|
+
* 常数数值
|
|
114
|
+
* [0,5]
|
|
115
|
+
* [1,[1,2]]
|
|
116
|
+
* [2,[1,2,3]]
|
|
117
|
+
*/
|
|
118
|
+
export declare type ConstantNumber = [type: ValueType.CONSTANT, value: number];
|
|
119
|
+
export declare type ConstantVec2 = [type: ValueType.CONSTANT_VEC2, value: vec2];
|
|
120
|
+
export declare type ConstantVec3 = [type: ValueType.CONSTANT_VEC3, value: vec3];
|
|
121
|
+
export declare type ConstantVec4 = [type: ValueType.CONSTANT_VEC4, value: vec4];
|
|
122
|
+
/**
|
|
123
|
+
* 随机数数值
|
|
124
|
+
*/
|
|
125
|
+
export declare type RandomValue = [type: ValueType.RANDOM, value: [min: number, max: number]];
|
|
126
|
+
/**
|
|
127
|
+
* 直线段数值
|
|
128
|
+
*/
|
|
129
|
+
export declare type LineValue = [type: ValueType.LINE, value: [time: number, value: number][]];
|
|
130
|
+
export declare type CurveEasingPoint = [time: number, value: number, tanIn: number, tanOut: number];
|
|
131
|
+
/**
|
|
132
|
+
* 曲线段数值
|
|
133
|
+
*/
|
|
134
|
+
export declare type CurveValue = [type: ValueType.CURVE, value: CurveEasingPoint[]];
|
|
135
|
+
/**
|
|
136
|
+
* 贝塞尔路径数值
|
|
137
|
+
*/
|
|
138
|
+
export declare type BezierPath = [type: ValueType.BEZIER_PATH, value: BezierPathValue];
|
|
139
|
+
export declare type BezierPathValue = [
|
|
140
|
+
easing: CurveEasingPoint[],
|
|
141
|
+
points: vec3[],
|
|
142
|
+
controlPoints: vec3[]
|
|
143
|
+
];
|
|
144
|
+
export declare type LinearPath = [type: ValueType.LINEAR_PATH, value: LinearPathValue];
|
|
145
|
+
export declare type LinearPathValue = [
|
|
146
|
+
easing: CurveEasingPoint[],
|
|
147
|
+
points: vec3[]
|
|
148
|
+
];
|
|
149
|
+
/**
|
|
150
|
+
* 关键帧类型
|
|
151
|
+
*/
|
|
152
|
+
export declare enum BezierKeyframeType {
|
|
153
|
+
AUTO = 0,
|
|
154
|
+
EASE = 1,
|
|
155
|
+
EASE_IN = 2,
|
|
156
|
+
EASE_OUT = 3,
|
|
157
|
+
LINE = 4,
|
|
158
|
+
HOLD = 5,
|
|
159
|
+
LINE_OUT = 6
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* 缓动关键帧数据(有三个点:左曲线控制点、曲线点、右曲线控制点,auto:自动关键帧)
|
|
163
|
+
*/
|
|
164
|
+
export declare type EaseKeyframeValue = [
|
|
165
|
+
type: BezierKeyframeType.EASE,
|
|
166
|
+
value: [x1: number, y1: number, x2: number, y2: number, x3: number, y3: number],
|
|
167
|
+
markType?: BezierKeyframeType
|
|
168
|
+
];
|
|
169
|
+
/**
|
|
170
|
+
* 缓入关键帧数据(有两个点:左曲线控制点、曲线点)
|
|
171
|
+
*/
|
|
172
|
+
export declare type EaseInKeyframeValue = [
|
|
173
|
+
type: BezierKeyframeType.EASE_IN,
|
|
174
|
+
value: [x1: number, y1: number, x2: number, y2: number],
|
|
175
|
+
markType?: BezierKeyframeType
|
|
176
|
+
];
|
|
177
|
+
/**
|
|
178
|
+
* 缓出关键帧数据(有两个点:曲线点、右曲线控制点)
|
|
179
|
+
*/
|
|
180
|
+
export declare type EaseOutKeyframeValue = [
|
|
181
|
+
type: BezierKeyframeType.EASE_OUT,
|
|
182
|
+
value: [x2: number, y2: number, x3: number, y3: number],
|
|
183
|
+
markType?: BezierKeyframeType
|
|
184
|
+
];
|
|
185
|
+
/**
|
|
186
|
+
* 线性关键帧数据(有一个点:曲线点)
|
|
187
|
+
*/
|
|
188
|
+
export declare type LineKeyframeValue = [
|
|
189
|
+
type: BezierKeyframeType.LINE,
|
|
190
|
+
value: [x2: number, y2: number],
|
|
191
|
+
markType?: BezierKeyframeType
|
|
192
|
+
];
|
|
193
|
+
/**
|
|
194
|
+
* 缓动定格出关键帧(有两个点:左曲线控制点、曲线点)
|
|
195
|
+
*/
|
|
196
|
+
export declare type EaseHoldOutKeyframeValue = [
|
|
197
|
+
type: BezierKeyframeType.HOLD,
|
|
198
|
+
value: [x1: number, y1: number, x2: number, y2: number],
|
|
199
|
+
markType: BezierKeyframeType.EASE_IN
|
|
200
|
+
];
|
|
201
|
+
/**
|
|
202
|
+
* 缓动定格出关键帧(有两个点:曲线点、右曲线控制点)
|
|
203
|
+
*/
|
|
204
|
+
export declare type EaseHoldInKeyframeValue = [
|
|
205
|
+
type: BezierKeyframeType.HOLD,
|
|
206
|
+
value: [x1: number, y1: number, x2: number, y2: number],
|
|
207
|
+
markType: BezierKeyframeType.EASE_OUT
|
|
208
|
+
];
|
|
209
|
+
/**
|
|
210
|
+
* 线性定格出关键帧(有一个点:曲线点)
|
|
211
|
+
*/
|
|
212
|
+
export declare type LineHoldOutKeyframeValue = [
|
|
213
|
+
type: BezierKeyframeType.HOLD,
|
|
214
|
+
value: [x2: number, y2: number],
|
|
215
|
+
markType: BezierKeyframeType.LINE
|
|
216
|
+
];
|
|
217
|
+
/**
|
|
218
|
+
* 线性定格进关键帧(有一个点:曲线点)
|
|
219
|
+
*/
|
|
220
|
+
export declare type LineHoldInKeyframeValue = [
|
|
221
|
+
type: BezierKeyframeType.HOLD,
|
|
222
|
+
value: [x2: number, y2: number],
|
|
223
|
+
markType: BezierKeyframeType.LINE_OUT
|
|
224
|
+
];
|
|
225
|
+
/**
|
|
226
|
+
* 定格进出关键帧(有一个点:曲线点)
|
|
227
|
+
*/
|
|
228
|
+
export declare type HoldInOutKeyframeValue = [
|
|
229
|
+
type: BezierKeyframeType.HOLD,
|
|
230
|
+
value: [x2: number, y2: number],
|
|
231
|
+
markType: BezierKeyframeType.HOLD
|
|
232
|
+
];
|
|
233
|
+
/**
|
|
234
|
+
* 定格关键帧
|
|
235
|
+
*/
|
|
236
|
+
export declare type HoldKeyframeValue = EaseHoldOutKeyframeValue | EaseHoldInKeyframeValue | LineHoldOutKeyframeValue | LineHoldInKeyframeValue | HoldInOutKeyframeValue;
|
|
237
|
+
/**
|
|
238
|
+
* 贝塞尔关键帧值
|
|
239
|
+
*/
|
|
240
|
+
export declare type BezierKeyframeValue = EaseKeyframeValue | EaseInKeyframeValue | EaseOutKeyframeValue | LineKeyframeValue | HoldKeyframeValue;
|
|
241
|
+
/**
|
|
242
|
+
* 贝塞尔关键帧
|
|
243
|
+
*/
|
|
244
|
+
export declare type BezierValue = [type: ValueType.BEZIER_CURVE, value: BezierKeyframeValue[]];
|
|
245
|
+
/**
|
|
246
|
+
* 贝塞尔曲线路径关键帧值
|
|
247
|
+
*/
|
|
248
|
+
export declare type BezierCurvePathValue = [easing: BezierKeyframeValue[], points: vec3[], controlePoints: vec3[]];
|
|
249
|
+
/**
|
|
250
|
+
* 贝塞尔曲线路径关键帧
|
|
251
|
+
*/
|
|
252
|
+
export declare type BezierCurvePath = [type: ValueType.BEZIER_CURVE_PATH, value: BezierCurvePathValue];
|
|
253
|
+
/*********************************************/
|
|
254
|
+
/*********************************************/
|
|
255
|
+
export declare type ColorExpression = RGBAColor | GradientColor | RGBAColors;
|
|
256
|
+
/**
|
|
257
|
+
* rgba range in [0,255]
|
|
258
|
+
*/
|
|
259
|
+
export declare type RGBAColorValue = [r: number, g: number, b: number, a: number];
|
|
260
|
+
/**
|
|
261
|
+
* 颜色数值
|
|
262
|
+
*/
|
|
263
|
+
export declare type RGBAColor = [type: ValueType.RGBA_COLOR, value: RGBAColorValue];
|
|
264
|
+
/**
|
|
265
|
+
* 渐变色数值
|
|
266
|
+
*/
|
|
267
|
+
export declare type GradientStop = [stop: number, r: number, g: number, b: number, a: number];
|
|
268
|
+
export declare type GradientColor = [type: ValueType.GRADIENT_COLOR, value: GradientStop[]];
|
|
269
|
+
export declare type RGBAColors = [type: ValueType.COLORS, value: RGBAColorValue[]];
|
|
270
|
+
/*********************************************/
|
|
271
|
+
/*********************************************/
|
|
272
|
+
/**
|
|
273
|
+
* 蒙版形状控制点数值
|
|
274
|
+
*/
|
|
275
|
+
export declare type ShapePoints = [type: ValueType.SHAPE_POINTS, value: [x: number, y: number, xIn: number, yIn: number, xOut: number, yOut: number][]];
|
|
276
|
+
/**
|
|
277
|
+
* 蒙版形状采样分割点数值
|
|
278
|
+
*/
|
|
279
|
+
export declare type ShapeSplits = [type: ValueType.SHAPE_SPLITS, value: number[][]];
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { Composition } from './composition';
|
|
2
|
+
import type { SpineResource } from './item/spine-item';
|
|
3
|
+
import type { PlayerVersion, Shape } from './type';
|
|
4
|
+
import type { TemplateImage, Image, CompressedImage, TextureDefine } from './image';
|
|
5
|
+
import type { FontBase, FontDefine } from './text';
|
|
6
|
+
import type { BinaryFile } from './binary';
|
|
7
|
+
/**
|
|
8
|
+
* 场景信息
|
|
9
|
+
* 素材信息存放于统一数据结构中
|
|
10
|
+
*/
|
|
11
|
+
export interface JSONScene {
|
|
12
|
+
/************** 文件版本不是 Player 版本,应用于文件变更后在 editor/player 中加载时的分类处理 **************/
|
|
13
|
+
/**
|
|
14
|
+
* JSON 版本
|
|
15
|
+
*
|
|
16
|
+
* 1.1 增加数据模板 https://yuque.antfin.com/ndl7nd/mars/ib13fw
|
|
17
|
+
* 1.2 增加 anchor https://yuque.antfin.com/ndl7nd/mars/dyccyr
|
|
18
|
+
* 1.3 增加二进制文件格式
|
|
19
|
+
* 1.5 增加 Spine 数据
|
|
20
|
+
* 2.0 改造升级
|
|
21
|
+
* 2.1 增加文本元素
|
|
22
|
+
*/
|
|
23
|
+
version: '1.0' | '1.1' | '1.2' | '1.3' | '1.5' | '1.8' | '2.0' | '2.1';
|
|
24
|
+
/**
|
|
25
|
+
* 播放器版本信息
|
|
26
|
+
*/
|
|
27
|
+
playerVersion: PlayerVersion;
|
|
28
|
+
/**
|
|
29
|
+
* 类型为 Galacean Effects
|
|
30
|
+
*/
|
|
31
|
+
type: 'ge';
|
|
32
|
+
/*************************************** 用于加载 json 后复原合成 **************************************/
|
|
33
|
+
/**
|
|
34
|
+
* 选中合成ID
|
|
35
|
+
* 如果没有设置,选择合成中的第一个
|
|
36
|
+
*/
|
|
37
|
+
compositionId?: string;
|
|
38
|
+
/**
|
|
39
|
+
* 渲染所需合成列表
|
|
40
|
+
*/
|
|
41
|
+
compositions: Composition[];
|
|
42
|
+
/******************************** 以下皆为可复用信息,加载在对应 Manager 中 *******************************/
|
|
43
|
+
/**
|
|
44
|
+
* 贴图信息
|
|
45
|
+
*/
|
|
46
|
+
images: (TemplateImage | Image | CompressedImage)[];
|
|
47
|
+
/**
|
|
48
|
+
* 根据合成ID,每个合成用到的 image 的数组索引
|
|
49
|
+
*/
|
|
50
|
+
imgUsage?: Record<string, number[]>;
|
|
51
|
+
/**
|
|
52
|
+
* 根据合成id,每个合成用到的 bin 的数组索引
|
|
53
|
+
*/
|
|
54
|
+
binUsage?: Record<string, number[]>;
|
|
55
|
+
/**
|
|
56
|
+
* 蒙版形状信息
|
|
57
|
+
*/
|
|
58
|
+
shapes: Shape[];
|
|
59
|
+
/**
|
|
60
|
+
* 插件类型信息
|
|
61
|
+
* 'model@1.0'
|
|
62
|
+
*/
|
|
63
|
+
plugins: string[];
|
|
64
|
+
/**
|
|
65
|
+
* 保留字段
|
|
66
|
+
*/
|
|
67
|
+
requires: SceneRequire[];
|
|
68
|
+
/**
|
|
69
|
+
* 字体资源
|
|
70
|
+
* 数据模板下掉可以不要 FontBase[]
|
|
71
|
+
*/
|
|
72
|
+
fonts?: FontBase[] | FontDefine[];
|
|
73
|
+
/**
|
|
74
|
+
* spine 资源
|
|
75
|
+
* @version 1.5
|
|
76
|
+
*/
|
|
77
|
+
spines?: SpineResource[];
|
|
78
|
+
/**
|
|
79
|
+
* 二进制文件地址
|
|
80
|
+
* @version 1.3
|
|
81
|
+
*/
|
|
82
|
+
bins?: BinaryFile[];
|
|
83
|
+
/**
|
|
84
|
+
* textures 配置
|
|
85
|
+
* 从 v1.3 开始,images 数组会对应创建 textures 数组
|
|
86
|
+
*/
|
|
87
|
+
textures?: TextureDefine[];
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* 如果是内置模块,但是需要额外的代码引入,比如滤镜则会加入 requires 数组中
|
|
91
|
+
*/
|
|
92
|
+
export declare type SceneRequire = 'filter';
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import type { RGBAColor } from './numberExpression';
|
|
2
|
+
export interface StringTemplate {
|
|
3
|
+
fonts: FontBase[];
|
|
4
|
+
texts: Text[];
|
|
5
|
+
colors: RGBAColor[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* 字体资源
|
|
9
|
+
* @version 2.3
|
|
10
|
+
*/
|
|
11
|
+
export interface FontDefine {
|
|
12
|
+
/**
|
|
13
|
+
* 字体资源链接
|
|
14
|
+
*/
|
|
15
|
+
fontURL: string;
|
|
16
|
+
/**
|
|
17
|
+
* 字体名称
|
|
18
|
+
*/
|
|
19
|
+
fontFamily: string;
|
|
20
|
+
}
|
|
21
|
+
export interface FontBase {
|
|
22
|
+
/**
|
|
23
|
+
* 字体
|
|
24
|
+
* @default "serif"
|
|
25
|
+
*/
|
|
26
|
+
family?: string;
|
|
27
|
+
/**
|
|
28
|
+
* 像素单位(unit px)
|
|
29
|
+
* @default 16
|
|
30
|
+
*/
|
|
31
|
+
size?: number;
|
|
32
|
+
/**
|
|
33
|
+
* @default 400
|
|
34
|
+
*/
|
|
35
|
+
weight?: number;
|
|
36
|
+
/**
|
|
37
|
+
* index to fonts array, if set it inherits properties
|
|
38
|
+
* 字体属性继承
|
|
39
|
+
* 如果设置了会继承指定的字体属性
|
|
40
|
+
*/
|
|
41
|
+
extends?: number;
|
|
42
|
+
/**
|
|
43
|
+
* url to download font file
|
|
44
|
+
* 字体文件下载地址
|
|
45
|
+
*/
|
|
46
|
+
url?: string;
|
|
47
|
+
/**
|
|
48
|
+
* font style
|
|
49
|
+
* @default 0
|
|
50
|
+
*/
|
|
51
|
+
style?: FontStyle;
|
|
52
|
+
/**
|
|
53
|
+
* space between 2 chars
|
|
54
|
+
* 字间距,两个字符(包括数字,英文和空格等特殊字符)的像素距离
|
|
55
|
+
* @default 0
|
|
56
|
+
*/
|
|
57
|
+
letterSpace?: number;
|
|
58
|
+
}
|
|
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
|
+
export declare enum TextOverflow {
|
|
106
|
+
/**
|
|
107
|
+
* display 模式下,会显示所有文本,存在文本超过边界框的情况。
|
|
108
|
+
*/
|
|
109
|
+
display = 0,
|
|
110
|
+
/**
|
|
111
|
+
* clip 模式下,当文本内容超出边界框时,多余的会被截断。
|
|
112
|
+
*/
|
|
113
|
+
clip = 1,
|
|
114
|
+
/**
|
|
115
|
+
* ellipsis 模式下,会使用(...)来代替超出边界框的内容。
|
|
116
|
+
*/
|
|
117
|
+
ellipsis = 2
|
|
118
|
+
}
|
|
119
|
+
export declare enum TextBaseline {
|
|
120
|
+
/**
|
|
121
|
+
* 文本顶对齐。
|
|
122
|
+
*/
|
|
123
|
+
top = 0,
|
|
124
|
+
/**
|
|
125
|
+
* 文本垂直居中对齐。
|
|
126
|
+
*/
|
|
127
|
+
middle = 1,
|
|
128
|
+
/**
|
|
129
|
+
* 文本底对齐。
|
|
130
|
+
*/
|
|
131
|
+
bottom = 2
|
|
132
|
+
}
|
|
133
|
+
export declare enum TextAlignment {
|
|
134
|
+
/**
|
|
135
|
+
* text alignment starts from(x,y) to right direction
|
|
136
|
+
* 从(x,y)开始第一个字符,向右边延伸
|
|
137
|
+
*/
|
|
138
|
+
left = 0,
|
|
139
|
+
/**
|
|
140
|
+
* (x,y) is middle position of text, where (left + right)/2 =(x,y)
|
|
141
|
+
* (x,y) 为文字中间位置,(最左位置 + 最右位置)/2 = (x,y)
|
|
142
|
+
*/
|
|
143
|
+
middle = 1,
|
|
144
|
+
/**
|
|
145
|
+
* text alignment ends with(x,y) from left direction
|
|
146
|
+
* 从(x,y)结束最后一个字符,向左边延伸
|
|
147
|
+
*/
|
|
148
|
+
right = 2
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* 文本字重
|
|
152
|
+
*/
|
|
153
|
+
export declare enum TextWeight {
|
|
154
|
+
/**
|
|
155
|
+
* 正常
|
|
156
|
+
*/
|
|
157
|
+
normal = "normal",
|
|
158
|
+
/**
|
|
159
|
+
* 粗体
|
|
160
|
+
*/
|
|
161
|
+
bold = "bold",
|
|
162
|
+
/**
|
|
163
|
+
* 瘦体
|
|
164
|
+
*/
|
|
165
|
+
lighter = "lighter"
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* 文本样式
|
|
169
|
+
*/
|
|
170
|
+
export declare enum FontStyle {
|
|
171
|
+
/**
|
|
172
|
+
* 正常
|
|
173
|
+
*/
|
|
174
|
+
normal = "normal",
|
|
175
|
+
/**
|
|
176
|
+
* 斜体
|
|
177
|
+
*/
|
|
178
|
+
italic = "italic",
|
|
179
|
+
/**
|
|
180
|
+
* 倾斜体
|
|
181
|
+
*/
|
|
182
|
+
oblique = "oblique"
|
|
183
|
+
}
|