@eva/plugin-renderer-graphics 2.0.1-beta.27 → 2.0.1-beta.28
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.
|
@@ -9,15 +9,50 @@ var pluginRenderer = require('@eva/plugin-renderer');
|
|
|
9
9
|
class Graphics$3 extends pixi_js.Graphics {
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* 图形绘制组件
|
|
14
|
+
*
|
|
15
|
+
* Graphics 组件提供矢量图形绘制能力,可以动态绘制各种几何图形。
|
|
16
|
+
* 它基于 PixiJS Graphics,支持绘制线条、矩形、圆形、多边形等,
|
|
17
|
+
* 适用于调试可视化、动态UI、简单特效等场景。
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const shape = new GameObject('shape');
|
|
22
|
+
* const graphics = new Graphics();
|
|
23
|
+
* shape.addComponent(graphics);
|
|
24
|
+
*
|
|
25
|
+
* // 在组件初始化后使用 graphics 对象绘制
|
|
26
|
+
* graphics.graphics.clear();
|
|
27
|
+
* graphics.graphics.beginFill(0xff0000);
|
|
28
|
+
* graphics.graphics.drawCircle(100, 100, 50); // 绘制圆形
|
|
29
|
+
* graphics.graphics.endFill();
|
|
30
|
+
*
|
|
31
|
+
* // 绘制矩形
|
|
32
|
+
* graphics.graphics.lineStyle(2, 0x0000ff);
|
|
33
|
+
* graphics.graphics.drawRect(0, 0, 100, 100);
|
|
34
|
+
*
|
|
35
|
+
* // 绘制多边形
|
|
36
|
+
* graphics.graphics.beginFill(0x00ff00);
|
|
37
|
+
* graphics.graphics.drawPolygon([0,0, 100,0, 100,100, 0,100]);
|
|
38
|
+
* graphics.graphics.endFill();
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
12
41
|
class Graphics$2 extends eva_js.Component {
|
|
13
42
|
constructor() {
|
|
14
43
|
super(...arguments);
|
|
44
|
+
/** PixiJS Graphics 实例,用于绘制矢量图形 */
|
|
15
45
|
this.graphics = null;
|
|
16
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* 初始化组件
|
|
49
|
+
* 创建 Graphics 绘图对象实例
|
|
50
|
+
*/
|
|
17
51
|
init() {
|
|
18
52
|
this.graphics = new Graphics$3();
|
|
19
53
|
}
|
|
20
54
|
}
|
|
55
|
+
/** 组件名称 */
|
|
21
56
|
Graphics$2.componentName = 'Graphics';
|
|
22
57
|
|
|
23
58
|
/*! *****************************************************************************
|
|
@@ -6,9 +6,44 @@ import { Renderer } from '@eva/plugin-renderer';
|
|
|
6
6
|
import { RendererManager } from '@eva/plugin-renderer';
|
|
7
7
|
import { RendererSystem } from '@eva/plugin-renderer';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* 图形绘制组件
|
|
11
|
+
*
|
|
12
|
+
* Graphics 组件提供矢量图形绘制能力,可以动态绘制各种几何图形。
|
|
13
|
+
* 它基于 PixiJS Graphics,支持绘制线条、矩形、圆形、多边形等,
|
|
14
|
+
* 适用于调试可视化、动态UI、简单特效等场景。
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const shape = new GameObject('shape');
|
|
19
|
+
* const graphics = new Graphics();
|
|
20
|
+
* shape.addComponent(graphics);
|
|
21
|
+
*
|
|
22
|
+
* // 在组件初始化后使用 graphics 对象绘制
|
|
23
|
+
* graphics.graphics.clear();
|
|
24
|
+
* graphics.graphics.beginFill(0xff0000);
|
|
25
|
+
* graphics.graphics.drawCircle(100, 100, 50); // 绘制圆形
|
|
26
|
+
* graphics.graphics.endFill();
|
|
27
|
+
*
|
|
28
|
+
* // 绘制矩形
|
|
29
|
+
* graphics.graphics.lineStyle(2, 0x0000ff);
|
|
30
|
+
* graphics.graphics.drawRect(0, 0, 100, 100);
|
|
31
|
+
*
|
|
32
|
+
* // 绘制多边形
|
|
33
|
+
* graphics.graphics.beginFill(0x00ff00);
|
|
34
|
+
* graphics.graphics.drawPolygon([0,0, 100,0, 100,100, 0,100]);
|
|
35
|
+
* graphics.graphics.endFill();
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
9
38
|
export declare class Graphics extends Component {
|
|
39
|
+
/** 组件名称 */
|
|
10
40
|
static componentName: string;
|
|
41
|
+
/** PixiJS Graphics 实例,用于绘制矢量图形 */
|
|
11
42
|
graphics: Graphics_2;
|
|
43
|
+
/**
|
|
44
|
+
* 初始化组件
|
|
45
|
+
* 创建 Graphics 绘图对象实例
|
|
46
|
+
*/
|
|
12
47
|
init(): void;
|
|
13
48
|
}
|
|
14
49
|
|
|
@@ -5,15 +5,50 @@ import { Renderer, RendererSystem } from '@eva/plugin-renderer';
|
|
|
5
5
|
class Graphics$3 extends Graphics$4 {
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* 图形绘制组件
|
|
10
|
+
*
|
|
11
|
+
* Graphics 组件提供矢量图形绘制能力,可以动态绘制各种几何图形。
|
|
12
|
+
* 它基于 PixiJS Graphics,支持绘制线条、矩形、圆形、多边形等,
|
|
13
|
+
* 适用于调试可视化、动态UI、简单特效等场景。
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const shape = new GameObject('shape');
|
|
18
|
+
* const graphics = new Graphics();
|
|
19
|
+
* shape.addComponent(graphics);
|
|
20
|
+
*
|
|
21
|
+
* // 在组件初始化后使用 graphics 对象绘制
|
|
22
|
+
* graphics.graphics.clear();
|
|
23
|
+
* graphics.graphics.beginFill(0xff0000);
|
|
24
|
+
* graphics.graphics.drawCircle(100, 100, 50); // 绘制圆形
|
|
25
|
+
* graphics.graphics.endFill();
|
|
26
|
+
*
|
|
27
|
+
* // 绘制矩形
|
|
28
|
+
* graphics.graphics.lineStyle(2, 0x0000ff);
|
|
29
|
+
* graphics.graphics.drawRect(0, 0, 100, 100);
|
|
30
|
+
*
|
|
31
|
+
* // 绘制多边形
|
|
32
|
+
* graphics.graphics.beginFill(0x00ff00);
|
|
33
|
+
* graphics.graphics.drawPolygon([0,0, 100,0, 100,100, 0,100]);
|
|
34
|
+
* graphics.graphics.endFill();
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
8
37
|
class Graphics$2 extends Component {
|
|
9
38
|
constructor() {
|
|
10
39
|
super(...arguments);
|
|
40
|
+
/** PixiJS Graphics 实例,用于绘制矢量图形 */
|
|
11
41
|
this.graphics = null;
|
|
12
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* 初始化组件
|
|
45
|
+
* 创建 Graphics 绘图对象实例
|
|
46
|
+
*/
|
|
13
47
|
init() {
|
|
14
48
|
this.graphics = new Graphics$3();
|
|
15
49
|
}
|
|
16
50
|
}
|
|
51
|
+
/** 组件名称 */
|
|
17
52
|
Graphics$2.componentName = 'Graphics';
|
|
18
53
|
|
|
19
54
|
/*! *****************************************************************************
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eva/plugin-renderer-graphics",
|
|
3
|
-
"version": "2.0.1-beta.
|
|
3
|
+
"version": "2.0.1-beta.28",
|
|
4
4
|
"description": "@eva/plugin-renderer-graphics",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-renderer-graphics.esm.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"homepage": "https://eva.js.org",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@eva/plugin-renderer": "2.0.1-beta.
|
|
22
|
-
"@eva/eva.js": "2.0.1-beta.
|
|
21
|
+
"@eva/plugin-renderer": "2.0.1-beta.28",
|
|
22
|
+
"@eva/eva.js": "2.0.1-beta.28"
|
|
23
23
|
}
|
|
24
24
|
}
|