@esengine/ecs-framework-math 1.0.3 → 2.8.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.
Files changed (60) hide show
  1. package/LICENSE +21 -0
  2. package/bin/Animation/Easing.d.ts +150 -150
  3. package/bin/Animation/Easing.d.ts.map +1 -1
  4. package/bin/Animation/Easing.js +151 -151
  5. package/bin/Animation/Easing.js.map +1 -1
  6. package/bin/Animation/Interpolation.d.ts +102 -102
  7. package/bin/Animation/Interpolation.d.ts.map +1 -1
  8. package/bin/Animation/Interpolation.js +104 -104
  9. package/bin/Animation/Interpolation.js.map +1 -1
  10. package/bin/Animation/index.d.ts.map +1 -1
  11. package/bin/Animation/index.js.map +1 -1
  12. package/bin/Circle.d.ts +159 -159
  13. package/bin/Circle.d.ts.map +1 -1
  14. package/bin/Circle.js +159 -159
  15. package/bin/Circle.js.map +1 -1
  16. package/bin/Collision/CollisionDetector.d.ts +64 -64
  17. package/bin/Collision/CollisionDetector.d.ts.map +1 -1
  18. package/bin/Collision/CollisionDetector.js +66 -66
  19. package/bin/Collision/CollisionDetector.js.map +1 -1
  20. package/bin/Color.d.ts +277 -0
  21. package/bin/Color.d.ts.map +1 -0
  22. package/bin/Color.js +470 -0
  23. package/bin/Color.js.map +1 -0
  24. package/bin/Fixed32.d.ts +266 -0
  25. package/bin/Fixed32.d.ts.map +1 -0
  26. package/bin/Fixed32.js +381 -0
  27. package/bin/Fixed32.js.map +1 -0
  28. package/bin/FixedMath.d.ts +109 -0
  29. package/bin/FixedMath.d.ts.map +1 -0
  30. package/bin/FixedMath.js +264 -0
  31. package/bin/FixedMath.js.map +1 -0
  32. package/bin/FixedVector2.d.ts +293 -0
  33. package/bin/FixedVector2.d.ts.map +1 -0
  34. package/bin/FixedVector2.js +413 -0
  35. package/bin/FixedVector2.js.map +1 -0
  36. package/bin/MathUtils.d.ts +205 -205
  37. package/bin/MathUtils.d.ts.map +1 -1
  38. package/bin/MathUtils.js +206 -206
  39. package/bin/MathUtils.js.map +1 -1
  40. package/bin/Matrix3.d.ts +158 -139
  41. package/bin/Matrix3.d.ts.map +1 -1
  42. package/bin/Matrix3.js +179 -151
  43. package/bin/Matrix3.js.map +1 -1
  44. package/bin/Rectangle.d.ts +144 -144
  45. package/bin/Rectangle.d.ts.map +1 -1
  46. package/bin/Rectangle.js +144 -144
  47. package/bin/Rectangle.js.map +1 -1
  48. package/bin/Vector2.d.ts +202 -186
  49. package/bin/Vector2.d.ts.map +1 -1
  50. package/bin/Vector2.js +198 -188
  51. package/bin/Vector2.js.map +1 -1
  52. package/bin/Vector3.d.ts +257 -0
  53. package/bin/Vector3.d.ts.map +1 -0
  54. package/bin/Vector3.js +372 -0
  55. package/bin/Vector3.js.map +1 -0
  56. package/bin/index.d.ts +8 -1
  57. package/bin/index.d.ts.map +1 -1
  58. package/bin/index.js +9 -0
  59. package/bin/index.js.map +1 -1
  60. package/package.json +66 -67
package/bin/Color.d.ts ADDED
@@ -0,0 +1,277 @@
1
+ /**
2
+ * Color utility class for game engine
3
+ * 游戏引擎颜色工具类
4
+ *
5
+ * Provides color conversion, manipulation, and packing utilities.
6
+ * 提供颜色转换、操作和打包工具。
7
+ */
8
+ /**
9
+ * RGBA color components
10
+ * RGBA 颜色分量
11
+ */
12
+ export interface RGBA {
13
+ r: number;
14
+ g: number;
15
+ b: number;
16
+ a: number;
17
+ }
18
+ /**
19
+ * HSL color components
20
+ * HSL 颜色分量
21
+ */
22
+ export interface HSL {
23
+ h: number;
24
+ s: number;
25
+ l: number;
26
+ }
27
+ /**
28
+ * Color class for color manipulation and conversion
29
+ * 颜色类,用于颜色操作和转换
30
+ */
31
+ export declare class Color {
32
+ /** Red component (0-255) | 红色分量 (0-255) */
33
+ r: number;
34
+ /** Green component (0-255) | 绿色分量 (0-255) */
35
+ g: number;
36
+ /** Blue component (0-255) | 蓝色分量 (0-255) */
37
+ b: number;
38
+ /** Alpha component (0-1) | 透明度分量 (0-1) */
39
+ a: number;
40
+ /** White (0xFFFFFF) | 白色 */
41
+ static readonly WHITE: Color;
42
+ /** Black (0x000000) | 黑色 */
43
+ static readonly BLACK: Color;
44
+ /** Red (0xFF0000) | 红色 */
45
+ static readonly RED: Color;
46
+ /** Green (0x00FF00) | 绿色 */
47
+ static readonly GREEN: Color;
48
+ /** Blue (0x0000FF) | 蓝色 */
49
+ static readonly BLUE: Color;
50
+ /** Yellow (0xFFFF00) | 黄色 */
51
+ static readonly YELLOW: Color;
52
+ /** Cyan (0x00FFFF) | 青色 */
53
+ static readonly CYAN: Color;
54
+ /** Magenta (0xFF00FF) | 品红色 */
55
+ static readonly MAGENTA: Color;
56
+ /** Transparent (0x00000000) | 透明 */
57
+ static readonly TRANSPARENT: Color;
58
+ /** Gray (0x808080) | 灰色 */
59
+ static readonly GRAY: Color;
60
+ /**
61
+ * Create a new Color instance
62
+ * 创建新的 Color 实例
63
+ */
64
+ constructor(r?: number, g?: number, b?: number, a?: number);
65
+ /**
66
+ * Create color from hex string
67
+ * 从十六进制字符串创建颜色
68
+ * @param hex Hex string (e.g., "#FF0000", "#F00", "FF0000") | 十六进制字符串
69
+ * @param alpha Optional alpha value (0-1) | 可选的透明度值
70
+ */
71
+ static fromHex(hex: string, alpha?: number): Color;
72
+ /**
73
+ * Create color from packed uint32 (0xRRGGBB or 0xAARRGGBB)
74
+ * 从打包的 uint32 创建颜色
75
+ * @param value Packed color value | 打包的颜色值
76
+ * @param hasAlpha Whether value includes alpha | 是否包含透明度
77
+ */
78
+ static fromUint32(value: number, hasAlpha?: boolean): Color;
79
+ /**
80
+ * Create color from HSL values
81
+ * 从 HSL 值创建颜色
82
+ * @param h Hue (0-360) | 色相
83
+ * @param s Saturation (0-1) | 饱和度
84
+ * @param l Lightness (0-1) | 亮度
85
+ * @param a Alpha (0-1) | 透明度
86
+ */
87
+ static fromHSL(h: number, s: number, l: number, a?: number): Color;
88
+ /**
89
+ * Create color from normalized float values (0-1)
90
+ * 从归一化浮点值创建颜色 (0-1)
91
+ */
92
+ static fromFloat(r: number, g: number, b: number, a?: number): Color;
93
+ /**
94
+ * Convert hex string to RGB
95
+ * 将十六进制字符串转换为 RGB
96
+ */
97
+ static hexToRgb(hex: string): {
98
+ r: number;
99
+ g: number;
100
+ b: number;
101
+ };
102
+ /**
103
+ * Convert RGB to hex string
104
+ * 将 RGB 转换为十六进制字符串
105
+ */
106
+ static rgbToHex(r: number, g: number, b: number): string;
107
+ /**
108
+ * Convert HSL to RGB
109
+ * 将 HSL 转换为 RGB
110
+ */
111
+ static hslToRgb(h: number, s: number, l: number): {
112
+ r: number;
113
+ g: number;
114
+ b: number;
115
+ };
116
+ /**
117
+ * Convert RGB to HSL
118
+ * 将 RGB 转换为 HSL
119
+ */
120
+ static rgbToHsl(r: number, g: number, b: number): HSL;
121
+ /**
122
+ * Pack color to uint32 (0xRRGGBB)
123
+ * 打包颜色为 uint32 (0xRRGGBB)
124
+ */
125
+ static packRGB(r: number, g: number, b: number): number;
126
+ /**
127
+ * Pack color to uint32 (0xAARRGGBB)
128
+ * 打包颜色为 uint32 (0xAARRGGBB)
129
+ */
130
+ static packARGB(r: number, g: number, b: number, a: number): number;
131
+ /**
132
+ * Pack color to uint32 for WebGL (0xAABBGGRR)
133
+ * 打包颜色为 WebGL 格式的 uint32 (0xAABBGGRR)
134
+ */
135
+ static packABGR(r: number, g: number, b: number, a: number): number;
136
+ /**
137
+ * Pack hex string and alpha to WebGL uint32 (0xAABBGGRR)
138
+ * 将十六进制字符串和透明度打包为 WebGL 格式 uint32
139
+ */
140
+ static packHexAlpha(hex: string, alpha: number): number;
141
+ /**
142
+ * Unpack uint32 to RGBA (assumes 0xAARRGGBB)
143
+ * 解包 uint32 为 RGBA (假设格式为 0xAARRGGBB)
144
+ */
145
+ static unpackARGB(value: number): RGBA;
146
+ /**
147
+ * Unpack uint32 to RGBA (assumes 0xAABBGGRR - WebGL format)
148
+ * 解包 uint32 为 RGBA (假设格式为 0xAABBGGRR - WebGL 格式)
149
+ */
150
+ static unpackABGR(value: number): RGBA;
151
+ /**
152
+ * Interpolate between two colors
153
+ * 在两个颜色之间插值
154
+ */
155
+ static lerp(from: Color, to: Color, t: number): Color;
156
+ /**
157
+ * Interpolate between two packed uint32 colors (0xRRGGBB)
158
+ * 在两个打包的 uint32 颜色之间插值
159
+ */
160
+ static lerpUint32(from: number, to: number, t: number): number;
161
+ /**
162
+ * Mix two colors
163
+ * 混合两个颜色
164
+ */
165
+ static mix(color1: Color, color2: Color, ratio?: number): Color;
166
+ /**
167
+ * Lighten a color
168
+ * 使颜色变亮
169
+ */
170
+ static lighten(color: Color, amount: number): Color;
171
+ /**
172
+ * Darken a color
173
+ * 使颜色变暗
174
+ */
175
+ static darken(color: Color, amount: number): Color;
176
+ /**
177
+ * Saturate a color
178
+ * 增加颜色饱和度
179
+ */
180
+ static saturate(color: Color, amount: number): Color;
181
+ /**
182
+ * Desaturate a color
183
+ * 降低颜色饱和度
184
+ */
185
+ static desaturate(color: Color, amount: number): Color;
186
+ /**
187
+ * Invert a color
188
+ * 反转颜色
189
+ */
190
+ static invert(color: Color): Color;
191
+ /**
192
+ * Convert color to grayscale
193
+ * 将颜色转换为灰度
194
+ */
195
+ static grayscale(color: Color): Color;
196
+ /**
197
+ * Get color luminance (perceived brightness)
198
+ * 获取颜色亮度(感知亮度)
199
+ */
200
+ static luminance(color: Color): number;
201
+ /**
202
+ * Get contrast ratio between two colors
203
+ * 获取两个颜色之间的对比度
204
+ */
205
+ static contrastRatio(color1: Color, color2: Color): number;
206
+ /**
207
+ * Convert to hex string
208
+ * 转换为十六进制字符串
209
+ */
210
+ toHex(): string;
211
+ /**
212
+ * Convert to hex string with alpha
213
+ * 转换为带透明度的十六进制字符串
214
+ */
215
+ toHexAlpha(): string;
216
+ /**
217
+ * Convert to CSS rgba string
218
+ * 转换为 CSS rgba 字符串
219
+ */
220
+ toRgba(): string;
221
+ /**
222
+ * Convert to CSS rgb string
223
+ * 转换为 CSS rgb 字符串
224
+ */
225
+ toRgb(): string;
226
+ /**
227
+ * Convert to HSL
228
+ * 转换为 HSL
229
+ */
230
+ toHSL(): HSL;
231
+ /**
232
+ * Pack to uint32 (0xRRGGBB)
233
+ * 打包为 uint32 (0xRRGGBB)
234
+ */
235
+ toUint32(): number;
236
+ /**
237
+ * Pack to uint32 with alpha (0xAARRGGBB)
238
+ * 打包为带透明度的 uint32 (0xAARRGGBB)
239
+ */
240
+ toUint32Alpha(): number;
241
+ /**
242
+ * Pack to WebGL uint32 (0xAABBGGRR)
243
+ * 打包为 WebGL 格式 uint32 (0xAABBGGRR)
244
+ */
245
+ toWebGL(): number;
246
+ /**
247
+ * Get normalized float array [r, g, b, a] (0-1)
248
+ * 获取归一化浮点数组 [r, g, b, a] (0-1)
249
+ */
250
+ toFloatArray(): [number, number, number, number];
251
+ /**
252
+ * Clone this color
253
+ * 克隆此颜色
254
+ */
255
+ clone(): Color;
256
+ /**
257
+ * Set color values
258
+ * 设置颜色值
259
+ */
260
+ set(r: number, g: number, b: number, a?: number): this;
261
+ /**
262
+ * Copy from another color
263
+ * 从另一个颜色复制
264
+ */
265
+ copy(other: Color): this;
266
+ /**
267
+ * Check equality with another color
268
+ * 检查与另一个颜色是否相等
269
+ */
270
+ equals(other: Color): boolean;
271
+ /**
272
+ * String representation
273
+ * 字符串表示
274
+ */
275
+ toString(): string;
276
+ }
277
+ //# sourceMappingURL=Color.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Color.d.ts","sourceRoot":"","sources":["../src/Color.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,MAAM,WAAW,IAAI;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;;GAGG;AACH,MAAM,WAAW,GAAG;IAChB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAA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