@galacean/engine-math 1.1.0-alpha.0 → 1.1.0-alpha.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/dist/main.js +65 -12
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +65 -12
- package/dist/module.js +65 -12
- package/dist/module.js.map +1 -1
- package/package.json +1 -1
- package/types/Gradient.d.ts +103 -0
- package/types/Rand.d.ts +30 -0
- package/types/Rect.d.ts +20 -8
- package/types/enums/GradientMode.d.ts +9 -0
package/package.json
CHANGED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { GradientMode } from "./enums/GradientMode";
|
|
2
|
+
import { IClone } from "./IClone";
|
|
3
|
+
import { ICopy } from "./ICopy";
|
|
4
|
+
import { Vector4 } from "./Vector4";
|
|
5
|
+
import { Color } from "./Color";
|
|
6
|
+
/**
|
|
7
|
+
* Gradient used for animating colors.
|
|
8
|
+
*/
|
|
9
|
+
export declare class Gradient implements IClone<Gradient>, ICopy<Gradient, Gradient> {
|
|
10
|
+
private _mode;
|
|
11
|
+
private readonly _maxColorRGBKeysCount;
|
|
12
|
+
private readonly _maxColorAlphaKeysCount;
|
|
13
|
+
private _colorRGBKeysCount;
|
|
14
|
+
private _colorAlphaKeysCount;
|
|
15
|
+
/**
|
|
16
|
+
* element key range
|
|
17
|
+
* x: colorKey min
|
|
18
|
+
* y: colorKey max
|
|
19
|
+
* z: alphaKey min
|
|
20
|
+
* w: alphaKey max
|
|
21
|
+
*/
|
|
22
|
+
keyRanges: Vector4;
|
|
23
|
+
/** All alpha keys defined in the gradient. */
|
|
24
|
+
alphaElements: Float32Array;
|
|
25
|
+
/** All color keys defined in the gradient. */
|
|
26
|
+
rgbElements: Float32Array;
|
|
27
|
+
/**
|
|
28
|
+
* Control how the gradient is evaluated.
|
|
29
|
+
*/
|
|
30
|
+
get mode(): GradientMode;
|
|
31
|
+
set mode(value: GradientMode);
|
|
32
|
+
/**
|
|
33
|
+
* Get RGB keys count.
|
|
34
|
+
*/
|
|
35
|
+
get colorRGBKeysCount(): number;
|
|
36
|
+
/**
|
|
37
|
+
* Get Alpha keys count
|
|
38
|
+
*/
|
|
39
|
+
get colorAlphaKeysCount(): number;
|
|
40
|
+
/**
|
|
41
|
+
* Get max RGB keys count
|
|
42
|
+
*/
|
|
43
|
+
get maxColorRGBKeysCount(): number;
|
|
44
|
+
/**
|
|
45
|
+
* Get max alpha keys count
|
|
46
|
+
*/
|
|
47
|
+
get maxColorAlphaKeysCount(): number;
|
|
48
|
+
/**
|
|
49
|
+
* @param maxColorRGBKeyCount - The max rgb key count
|
|
50
|
+
* @param maxColorAlphaKeyCount - Thw max alpha key count
|
|
51
|
+
*/
|
|
52
|
+
constructor(maxColorRGBKeyCount: number, maxColorAlphaKeyCount: number);
|
|
53
|
+
/**
|
|
54
|
+
* Add rgb keyframe.
|
|
55
|
+
* @param key - The lifetime from 0 to 1
|
|
56
|
+
* @param value - The rgb value
|
|
57
|
+
*/
|
|
58
|
+
addColorRGB(key: number, value: Color): void;
|
|
59
|
+
/**
|
|
60
|
+
* Add alpha keyframe
|
|
61
|
+
* @param key - The lifetime from 0 to 1
|
|
62
|
+
* @param value - The alpha value
|
|
63
|
+
*/
|
|
64
|
+
addColorAlpha(key: number, value: number): void;
|
|
65
|
+
/**
|
|
66
|
+
* Update rgb keyframe
|
|
67
|
+
* @param index - The index
|
|
68
|
+
* @param key - The lifetime from 0 to 1
|
|
69
|
+
* @param value - The alpha value
|
|
70
|
+
*/
|
|
71
|
+
updateColorRGB(index: number, key: number, value: Color): void;
|
|
72
|
+
/**
|
|
73
|
+
* Update alpha keyframe
|
|
74
|
+
* @param index - The index
|
|
75
|
+
* @param key - The lifetime from 0 to 1
|
|
76
|
+
* @param value - The alpha value
|
|
77
|
+
*/
|
|
78
|
+
updateColorAlpha(index: number, key: number, value: number): void;
|
|
79
|
+
/**
|
|
80
|
+
* interpolate the keyframe to get rgb value
|
|
81
|
+
* @param lerpFactor - The ratio
|
|
82
|
+
* @param out - The result
|
|
83
|
+
* @param startSearchIndex - The start search index
|
|
84
|
+
* @param reverseSearch - Whether reverse search
|
|
85
|
+
*/
|
|
86
|
+
evaluateColorRGB(lerpFactor: number, out: Color, startSearchIndex?: number, reverseSearch?: boolean): number;
|
|
87
|
+
/**
|
|
88
|
+
* interpolate the keyframe to get alpha value
|
|
89
|
+
* @param lerpFactor - The ratio
|
|
90
|
+
* @param outColor - The result
|
|
91
|
+
* @param startSearchIndex - The start search index
|
|
92
|
+
* @param reverseSearch - Whether reverse search
|
|
93
|
+
*/
|
|
94
|
+
evaluateColorAlpha(lerpFactor: number, outColor: Color, startSearchIndex?: number, reverseSearch?: boolean): number;
|
|
95
|
+
/**
|
|
96
|
+
* @override
|
|
97
|
+
*/
|
|
98
|
+
copyFrom(source: Gradient): Gradient;
|
|
99
|
+
/**
|
|
100
|
+
* @override
|
|
101
|
+
*/
|
|
102
|
+
clone(): Gradient;
|
|
103
|
+
}
|
package/types/Rand.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Random number generator based on the xorshift128+ algorithm.
|
|
3
|
+
* https://vigna.di.unimi.it/ftp/papers/xorshiftplus.pdf
|
|
4
|
+
*/
|
|
5
|
+
export declare class Rand {
|
|
6
|
+
private _state0;
|
|
7
|
+
private _state1;
|
|
8
|
+
/**
|
|
9
|
+
* Create a random number generator.
|
|
10
|
+
* @param seed0 - Seed 0 used to initialize the generator
|
|
11
|
+
* @param seed1 - Seed 1 used to initialize the generator
|
|
12
|
+
*/
|
|
13
|
+
constructor(seed0: number, seed1: number);
|
|
14
|
+
/**
|
|
15
|
+
* Generate a integer 32bit random number.
|
|
16
|
+
* @returns - A random number
|
|
17
|
+
*/
|
|
18
|
+
randomInt32(): number;
|
|
19
|
+
/**
|
|
20
|
+
* Generate a number between 0 and 1.
|
|
21
|
+
* @returns - A random number
|
|
22
|
+
*/
|
|
23
|
+
random(): number;
|
|
24
|
+
/**
|
|
25
|
+
* Reset the generator by new seeds.
|
|
26
|
+
* @param seed0 - Random seed0
|
|
27
|
+
* @param seed1 - Random seed1
|
|
28
|
+
*/
|
|
29
|
+
reset(seed0: number, seed1: number): void;
|
|
30
|
+
}
|
package/types/Rect.d.ts
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
import { IClone } from "./IClone";
|
|
2
2
|
import { ICopy } from "./ICopy";
|
|
3
3
|
export declare class Rect implements IClone<Rect>, ICopy<Rect, Rect> {
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The x coordinate of the rectangle.
|
|
6
|
+
*/
|
|
7
|
+
get x(): number;
|
|
8
|
+
set x(value: number);
|
|
9
|
+
/**
|
|
10
|
+
* The y coordinate of the rectangle.
|
|
11
|
+
*/
|
|
12
|
+
get y(): number;
|
|
13
|
+
set y(value: number);
|
|
14
|
+
/**
|
|
15
|
+
* The width of the rectangle, measured from the x position.
|
|
16
|
+
*/
|
|
17
|
+
get width(): number;
|
|
18
|
+
set width(value: number);
|
|
19
|
+
/**
|
|
20
|
+
* The height of the rectangle, measured from the y position.
|
|
21
|
+
*/
|
|
22
|
+
get height(): number;
|
|
23
|
+
set height(value: number);
|
|
12
24
|
/**
|
|
13
25
|
* Constructor of Rect.
|
|
14
26
|
* @param x - The x coordinate of the rectangle, default 0
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Select how gradients will be evaluated.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum GradientMode {
|
|
5
|
+
/** Find the 2 keys adjacent to the requested evaluation time, and linearly interpolate between them to obtain a blended color. */
|
|
6
|
+
Blend = 0,
|
|
7
|
+
/** Return a fixed color, by finding the first key whose time value is greater than the requested evaluation time. */
|
|
8
|
+
Fixed = 1
|
|
9
|
+
}
|