@galacean/effects-specification 2.6.0-alpha.1 → 2.6.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.
- package/es/item/sprite-item.d.ts +5 -0
- package/es/item/text-item.d.ts +21 -1
- package/es/shape/index.d.ts +0 -1
- package/es/shape/index.js +0 -1
- package/es/shape/shape-component-data.d.ts +59 -6
- package/es/shape/shape-component-data.js +15 -1
- package/es/shape/shape-stroke-param.d.ts +0 -22
- package/es/text.d.ts +22 -4
- package/es/text.js +23 -4
- package/package.json +11 -13
- package/es/shape/shape-fill-param.d.ts +0 -45
- package/es/shape/shape-fill-param.js +0 -18
package/es/item/sprite-item.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export interface SpriteContentOptions {
|
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* 图层元素渲染属性
|
|
28
|
+
* @deprecated Please use SpriteComponentData instead
|
|
28
29
|
*/
|
|
29
30
|
export interface SpriteContent {
|
|
30
31
|
/**
|
|
@@ -78,4 +79,8 @@ export interface SpriteContent {
|
|
|
78
79
|
* 图层组件属性
|
|
79
80
|
*/
|
|
80
81
|
export interface SpriteComponentData extends ComponentData, SpriteContent {
|
|
82
|
+
/**
|
|
83
|
+
* 图层帧动画是否循环播放
|
|
84
|
+
*/
|
|
85
|
+
loop?: boolean;
|
|
81
86
|
}
|
package/es/item/text-item.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BaseItem, EndBehavior, MaskOptions } from './base-item';
|
|
2
2
|
import type { SizeOverLifetime, RotationOverLifetime, PositionOverLifetime, ColorOverLifetime, ItemType, TextureSheetAnimation, RendererOptions, InteractBehavior } from '../type';
|
|
3
3
|
import type { RGBAColorValue } from '../number-expression';
|
|
4
|
-
import type { FontStyle, TextAlignment, TextBaseline, TextOverflow, TextWeight } from '../text';
|
|
4
|
+
import type { FontStyle, TextAlignment, TextBaseline, TextOverflow, TextWeight, TextSizeMode } from '../text';
|
|
5
5
|
import type { ComponentData } from '../components';
|
|
6
6
|
/**
|
|
7
7
|
* 文本元素
|
|
@@ -38,6 +38,26 @@ export interface TextContentOptions extends BaseTextContentOptions {
|
|
|
38
38
|
* @default false
|
|
39
39
|
*/
|
|
40
40
|
autoWidth?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* 尺寸模式
|
|
43
|
+
* @default TextSizeMode.autoWidth
|
|
44
|
+
*/
|
|
45
|
+
sizeMode?: TextSizeMode;
|
|
46
|
+
/**
|
|
47
|
+
* 文本框宽度,用来排版和控制文本溢出行为
|
|
48
|
+
* @default undefined
|
|
49
|
+
*/
|
|
50
|
+
maxTextWidth?: number;
|
|
51
|
+
/**
|
|
52
|
+
* 文本框高度,用来排版和控制文本溢出行为
|
|
53
|
+
* @default undefined
|
|
54
|
+
*/
|
|
55
|
+
maxTextHeight?: number;
|
|
56
|
+
/**
|
|
57
|
+
* 是否开启自动换行
|
|
58
|
+
* @default false
|
|
59
|
+
*/
|
|
60
|
+
wrapEnabled?: boolean;
|
|
41
61
|
}
|
|
42
62
|
export interface BaseTextContentOptions {
|
|
43
63
|
/**
|
package/es/shape/index.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export * from './ellipse-data';
|
|
|
3
3
|
export * from './polygon-data';
|
|
4
4
|
export * from './rectangle-data';
|
|
5
5
|
export * from './shape-component-data';
|
|
6
|
-
export * from './shape-fill-param';
|
|
7
6
|
export * from './shape-primitive-type';
|
|
8
7
|
export * from './shape-stroke-param';
|
|
9
8
|
export * from './star-data';
|
package/es/shape/index.js
CHANGED
|
@@ -3,7 +3,6 @@ export * from './ellipse-data';
|
|
|
3
3
|
export * from './polygon-data';
|
|
4
4
|
export * from './rectangle-data';
|
|
5
5
|
export * from './shape-component-data';
|
|
6
|
-
export * from './shape-fill-param';
|
|
7
6
|
export * from './shape-primitive-type';
|
|
8
7
|
export * from './shape-stroke-param';
|
|
9
8
|
export * from './star-data';
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SideMode, BlendingMode } from '../type';
|
|
2
2
|
import type { ComponentData, DataPath } from '../components/component-data';
|
|
3
3
|
import type { MaskOptions } from '../item/base-item';
|
|
4
|
-
import type { ShapeFillParam } from './shape-fill-param';
|
|
5
4
|
import type { ShapePrimitiveType } from './shape-primitive-type';
|
|
6
|
-
import type {
|
|
5
|
+
import type { LineCap, LineJoin } from './shape-stroke-param';
|
|
6
|
+
import type { Vector2Data } from '../math/vector-data';
|
|
7
|
+
import type { GradientColor } from '../number-expression';
|
|
8
|
+
import type { ColorData } from '../math/color-data';
|
|
7
9
|
/**
|
|
8
10
|
* 矢量图形组件
|
|
9
11
|
*/
|
|
@@ -12,14 +14,17 @@ export interface ShapeComponentData extends ComponentData {
|
|
|
12
14
|
* 矢量类型
|
|
13
15
|
*/
|
|
14
16
|
type: ShapePrimitiveType;
|
|
17
|
+
strokeWidth?: number;
|
|
18
|
+
strokeCap?: LineCap;
|
|
19
|
+
strokeJoin?: LineJoin;
|
|
15
20
|
/**
|
|
16
21
|
* 描边属性
|
|
17
22
|
*/
|
|
18
|
-
|
|
23
|
+
strokes: PaintData[];
|
|
19
24
|
/**
|
|
20
25
|
* 填充属性
|
|
21
26
|
*/
|
|
22
|
-
|
|
27
|
+
fills: PaintData[];
|
|
23
28
|
/**
|
|
24
29
|
* 蒙版属性,传入表示需要作为蒙版/被遮挡/反向遮挡
|
|
25
30
|
*/
|
|
@@ -30,10 +35,58 @@ export interface ShapeComponentData extends ComponentData {
|
|
|
30
35
|
renderer?: ShapeRendererOptions;
|
|
31
36
|
}
|
|
32
37
|
export interface ShapeRendererOptions {
|
|
33
|
-
renderMode?: RenderMode;
|
|
34
38
|
side?: SideMode;
|
|
35
39
|
occlusion?: boolean;
|
|
36
40
|
transparentOcclusion?: boolean;
|
|
37
41
|
blending?: BlendingMode;
|
|
38
42
|
texture?: DataPath;
|
|
39
43
|
}
|
|
44
|
+
export type PaintData = SolidPaintData | GradientPaintData | TexturePaintData;
|
|
45
|
+
export declare enum FillType {
|
|
46
|
+
Solid = 0,
|
|
47
|
+
GradientLinear = 1,
|
|
48
|
+
GradientRadial = 2,
|
|
49
|
+
GradientAngular = 3,
|
|
50
|
+
Texture = 4
|
|
51
|
+
}
|
|
52
|
+
export interface SolidPaintData {
|
|
53
|
+
type: FillType.Solid;
|
|
54
|
+
/**
|
|
55
|
+
* 填充颜色
|
|
56
|
+
*/
|
|
57
|
+
color: ColorData;
|
|
58
|
+
}
|
|
59
|
+
export interface GradientPaintData {
|
|
60
|
+
type: FillType.GradientLinear | FillType.GradientAngular | FillType.GradientRadial;
|
|
61
|
+
/**
|
|
62
|
+
* 渐变颜色
|
|
63
|
+
*/
|
|
64
|
+
gradientStops: GradientColor;
|
|
65
|
+
/**
|
|
66
|
+
* 渐变起点
|
|
67
|
+
*/
|
|
68
|
+
startPoint: Vector2Data;
|
|
69
|
+
/**
|
|
70
|
+
* 渐变终点
|
|
71
|
+
*/
|
|
72
|
+
endPoint: Vector2Data;
|
|
73
|
+
}
|
|
74
|
+
export interface TexturePaintData {
|
|
75
|
+
type: FillType.Texture;
|
|
76
|
+
texture: DataPath;
|
|
77
|
+
scaleMode: TexturePaintScaleMode;
|
|
78
|
+
scalingFactor?: number;
|
|
79
|
+
textureTransform?: TextureTransformData;
|
|
80
|
+
opacity?: number;
|
|
81
|
+
}
|
|
82
|
+
export interface TextureTransformData {
|
|
83
|
+
offset?: Vector2Data;
|
|
84
|
+
rotation?: number;
|
|
85
|
+
scale?: Vector2Data;
|
|
86
|
+
}
|
|
87
|
+
export declare enum TexturePaintScaleMode {
|
|
88
|
+
Fill = 0,
|
|
89
|
+
Fit = 1,
|
|
90
|
+
Crop = 2,
|
|
91
|
+
Tile = 3
|
|
92
|
+
}
|
|
@@ -1 +1,15 @@
|
|
|
1
|
-
export
|
|
1
|
+
export var FillType;
|
|
2
|
+
(function (FillType) {
|
|
3
|
+
FillType[FillType["Solid"] = 0] = "Solid";
|
|
4
|
+
FillType[FillType["GradientLinear"] = 1] = "GradientLinear";
|
|
5
|
+
FillType[FillType["GradientRadial"] = 2] = "GradientRadial";
|
|
6
|
+
FillType[FillType["GradientAngular"] = 3] = "GradientAngular";
|
|
7
|
+
FillType[FillType["Texture"] = 4] = "Texture";
|
|
8
|
+
})(FillType || (FillType = {}));
|
|
9
|
+
export var TexturePaintScaleMode;
|
|
10
|
+
(function (TexturePaintScaleMode) {
|
|
11
|
+
TexturePaintScaleMode[TexturePaintScaleMode["Fill"] = 0] = "Fill";
|
|
12
|
+
TexturePaintScaleMode[TexturePaintScaleMode["Fit"] = 1] = "Fit";
|
|
13
|
+
TexturePaintScaleMode[TexturePaintScaleMode["Crop"] = 2] = "Crop";
|
|
14
|
+
TexturePaintScaleMode[TexturePaintScaleMode["Tile"] = 3] = "Tile";
|
|
15
|
+
})(TexturePaintScaleMode || (TexturePaintScaleMode = {}));
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ColorData } from '../math/color-data';
|
|
2
1
|
export declare enum LineCap {
|
|
3
2
|
/** 默认值。向线条的每个末端添加平直的边缘 */
|
|
4
3
|
Butt = 0,
|
|
@@ -15,24 +14,3 @@ export declare enum LineJoin {
|
|
|
15
14
|
/** 创建尖角 */
|
|
16
15
|
Miter = 2
|
|
17
16
|
}
|
|
18
|
-
/**
|
|
19
|
-
* 矢量描边参数
|
|
20
|
-
*/
|
|
21
|
-
export interface ShapeStrokeParam {
|
|
22
|
-
/**
|
|
23
|
-
* 线宽
|
|
24
|
-
*/
|
|
25
|
-
width: number;
|
|
26
|
-
/**
|
|
27
|
-
* 线颜色
|
|
28
|
-
*/
|
|
29
|
-
color: ColorData;
|
|
30
|
-
/**
|
|
31
|
-
* 线段端点的样式
|
|
32
|
-
*/
|
|
33
|
-
cap: LineCap;
|
|
34
|
-
/**
|
|
35
|
-
* 线段连接处的样式
|
|
36
|
-
*/
|
|
37
|
-
join: LineJoin;
|
|
38
|
-
}
|
package/es/text.d.ts
CHANGED
|
@@ -52,17 +52,35 @@ export interface FontBase {
|
|
|
52
52
|
}
|
|
53
53
|
export declare enum TextOverflow {
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
55
|
+
* visible 模式下,文本内容超出边界框时,会继续显示内容,不进行裁剪或缩放。
|
|
56
56
|
*/
|
|
57
|
-
|
|
57
|
+
visible = 0,
|
|
58
|
+
/**
|
|
59
|
+
* display 模式下,会显示所有文本,文本字号大小会根据边界框调整。
|
|
60
|
+
*/
|
|
61
|
+
display = 1,
|
|
58
62
|
/**
|
|
59
63
|
* clip 模式下,当文本内容超出边界框时,多余的会被截断。
|
|
60
64
|
*/
|
|
61
|
-
clip =
|
|
65
|
+
clip = 2,
|
|
62
66
|
/**
|
|
63
67
|
* ellipsis 模式下,会使用(...)来代替超出边界框的内容。
|
|
64
68
|
*/
|
|
65
|
-
ellipsis =
|
|
69
|
+
ellipsis = 3
|
|
70
|
+
}
|
|
71
|
+
export declare enum TextSizeMode {
|
|
72
|
+
/**
|
|
73
|
+
* 自适应宽度
|
|
74
|
+
*/
|
|
75
|
+
autoWidth = 0,
|
|
76
|
+
/**
|
|
77
|
+
* 自适应高度
|
|
78
|
+
*/
|
|
79
|
+
autoHeight = 1,
|
|
80
|
+
/**
|
|
81
|
+
* 固定宽高
|
|
82
|
+
*/
|
|
83
|
+
fixed = 2
|
|
66
84
|
}
|
|
67
85
|
export declare enum TextBaseline {
|
|
68
86
|
/**
|
package/es/text.js
CHANGED
|
@@ -1,18 +1,37 @@
|
|
|
1
1
|
export var TextOverflow;
|
|
2
2
|
(function (TextOverflow) {
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* visible 模式下,文本内容超出边界框时,会继续显示内容,不进行裁剪或缩放。
|
|
5
5
|
*/
|
|
6
|
-
TextOverflow[TextOverflow["
|
|
6
|
+
TextOverflow[TextOverflow["visible"] = 0] = "visible";
|
|
7
|
+
/**
|
|
8
|
+
* display 模式下,会显示所有文本,文本字号大小会根据边界框调整。
|
|
9
|
+
*/
|
|
10
|
+
TextOverflow[TextOverflow["display"] = 1] = "display";
|
|
7
11
|
/**
|
|
8
12
|
* clip 模式下,当文本内容超出边界框时,多余的会被截断。
|
|
9
13
|
*/
|
|
10
|
-
TextOverflow[TextOverflow["clip"] =
|
|
14
|
+
TextOverflow[TextOverflow["clip"] = 2] = "clip";
|
|
11
15
|
/**
|
|
12
16
|
* ellipsis 模式下,会使用(...)来代替超出边界框的内容。
|
|
13
17
|
*/
|
|
14
|
-
TextOverflow[TextOverflow["ellipsis"] =
|
|
18
|
+
TextOverflow[TextOverflow["ellipsis"] = 3] = "ellipsis";
|
|
15
19
|
})(TextOverflow || (TextOverflow = {}));
|
|
20
|
+
export var TextSizeMode;
|
|
21
|
+
(function (TextSizeMode) {
|
|
22
|
+
/**
|
|
23
|
+
* 自适应宽度
|
|
24
|
+
*/
|
|
25
|
+
TextSizeMode[TextSizeMode["autoWidth"] = 0] = "autoWidth";
|
|
26
|
+
/**
|
|
27
|
+
* 自适应高度
|
|
28
|
+
*/
|
|
29
|
+
TextSizeMode[TextSizeMode["autoHeight"] = 1] = "autoHeight";
|
|
30
|
+
/**
|
|
31
|
+
* 固定宽高
|
|
32
|
+
*/
|
|
33
|
+
TextSizeMode[TextSizeMode["fixed"] = 2] = "fixed";
|
|
34
|
+
})(TextSizeMode || (TextSizeMode = {}));
|
|
16
35
|
export var TextBaseline;
|
|
17
36
|
(function (TextBaseline) {
|
|
18
37
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/effects-specification",
|
|
3
|
-
"version": "2.6.0
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"description": "Galacean Effects JSON Specification",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"main": "./es/index.js",
|
|
@@ -15,17 +15,6 @@
|
|
|
15
15
|
"types": "./es/index.d.ts"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
|
-
"scripts": {
|
|
19
|
-
"prebuild": "pnpm clean",
|
|
20
|
-
"build": "pnpm build:lib",
|
|
21
|
-
"build:lib": "tsc -b tsconfig.build.json",
|
|
22
|
-
"lint": "eslint src --ext .ts,.mjs",
|
|
23
|
-
"lint:fix": "eslint src --fix --quiet --ext .ts,.mjs",
|
|
24
|
-
"check:ts": "tsc -b tsconfig.check.json",
|
|
25
|
-
"clean": "rimraf es/**",
|
|
26
|
-
"prepare": "husky install",
|
|
27
|
-
"prepublishOnly": "npm run build"
|
|
28
|
-
},
|
|
29
18
|
"browserslist": [
|
|
30
19
|
"iOS 9"
|
|
31
20
|
],
|
|
@@ -48,5 +37,14 @@
|
|
|
48
37
|
"publishConfig": {
|
|
49
38
|
"access": "public",
|
|
50
39
|
"registry": "https://registry.npmjs.org"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"prebuild": "pnpm clean",
|
|
43
|
+
"build": "pnpm build:lib",
|
|
44
|
+
"build:lib": "tsc -b tsconfig.build.json",
|
|
45
|
+
"lint": "eslint src --ext .ts,.mjs",
|
|
46
|
+
"lint:fix": "eslint src --fix --quiet --ext .ts,.mjs",
|
|
47
|
+
"check:ts": "tsc -b tsconfig.check.json",
|
|
48
|
+
"clean": "rimraf es/**"
|
|
51
49
|
}
|
|
52
|
-
}
|
|
50
|
+
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { Vector2Data } from '../math/vector-data';
|
|
2
|
-
import type { ColorData } from '../math/color-data';
|
|
3
|
-
import type { GradientColor } from '../number-expression';
|
|
4
|
-
/**
|
|
5
|
-
* 填充类型
|
|
6
|
-
*/
|
|
7
|
-
export declare enum FillType {
|
|
8
|
-
/**
|
|
9
|
-
* 纯色
|
|
10
|
-
*/
|
|
11
|
-
Solid = 0,
|
|
12
|
-
/**
|
|
13
|
-
* 线性渐变
|
|
14
|
-
*/
|
|
15
|
-
LinearGradient = 1,
|
|
16
|
-
/**
|
|
17
|
-
* 径向渐变
|
|
18
|
-
*/
|
|
19
|
-
RadialGradient = 2
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* 矢量填充参数
|
|
23
|
-
*/
|
|
24
|
-
export interface ShapeFillParam {
|
|
25
|
-
/**
|
|
26
|
-
* 填充颜色
|
|
27
|
-
*/
|
|
28
|
-
color: ColorData;
|
|
29
|
-
/**
|
|
30
|
-
* 填充类型
|
|
31
|
-
*/
|
|
32
|
-
fillType?: FillType;
|
|
33
|
-
/**
|
|
34
|
-
* 渐变颜色
|
|
35
|
-
*/
|
|
36
|
-
gradient?: GradientColor;
|
|
37
|
-
/**
|
|
38
|
-
* 渐变起点
|
|
39
|
-
*/
|
|
40
|
-
startPoint?: Vector2Data;
|
|
41
|
-
/**
|
|
42
|
-
* 渐变终点
|
|
43
|
-
*/
|
|
44
|
-
endPoint?: Vector2Data;
|
|
45
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 填充类型
|
|
3
|
-
*/
|
|
4
|
-
export var FillType;
|
|
5
|
-
(function (FillType) {
|
|
6
|
-
/**
|
|
7
|
-
* 纯色
|
|
8
|
-
*/
|
|
9
|
-
FillType[FillType["Solid"] = 0] = "Solid";
|
|
10
|
-
/**
|
|
11
|
-
* 线性渐变
|
|
12
|
-
*/
|
|
13
|
-
FillType[FillType["LinearGradient"] = 1] = "LinearGradient";
|
|
14
|
-
/**
|
|
15
|
-
* 径向渐变
|
|
16
|
-
*/
|
|
17
|
-
FillType[FillType["RadialGradient"] = 2] = "RadialGradient";
|
|
18
|
-
})(FillType || (FillType = {}));
|