@fulate/share 2.0.11 → 3.0.2
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 +11 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
# `@fulate/share`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
提供点、矩形、矩阵、颜色、渐变和相交计算。
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
| 用途 | 常用 API |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| 点 | `PointView`、`createPointView()`、`transformPoint()` |
|
|
8
|
+
| 边界 | `Rect`、`BoundingBox`、`Bound` |
|
|
9
|
+
| 矩阵 | `Matrix2D`、`ReadonlyMatrix2D`、`qrDecompose()` |
|
|
10
|
+
| 几何 | `Intersection`、`clipPolygonToRect()` |
|
|
11
|
+
| 颜色 | 颜色解析、格式化、混色、alpha 合成和 Canvas gradient |
|
|
11
12
|
|
|
12
13
|
```ts
|
|
13
|
-
import {
|
|
14
|
-
Bound,
|
|
15
|
-
createPointView,
|
|
16
|
-
transformPoint,
|
|
17
|
-
colorWithAlpha
|
|
18
|
-
} from "@fulate/share";
|
|
14
|
+
import { Bound, Matrix2D, createPointView, transformPoint, colorWithAlpha } from "@fulate/share";
|
|
19
15
|
|
|
16
|
+
const matrix = new Matrix2D().translateSelf(20, 10);
|
|
20
17
|
const point = transformPoint(matrix, createPointView(10, 20));
|
|
21
18
|
const bounds = Bound.fromPoints([point]);
|
|
22
19
|
const overlay = colorWithAlpha("#6750a4", 0.12);
|
|
23
20
|
```
|
|
24
21
|
|
|
25
|
-
|
|
26
|
-
语义工作;调用方需要独立结果时使用明确的 `copy()` 或在自身 owner 内创建新值。
|
|
22
|
+
`Bound` 可修改;需要独立边界时调用 `copy()`。
|