@vived/app 2.16.0 → 2.17.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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function lerpNumber(start: number, end: number, percent: number, clamp?: boolean): number;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.lerpNumber = void 0;
|
|
4
|
+
function lerpNumber(start, end, percent, clamp = false) {
|
|
5
|
+
const range = end - start;
|
|
6
|
+
if (!clamp) {
|
|
7
|
+
return percent * range + start;
|
|
8
|
+
}
|
|
9
|
+
let clampedP = percent;
|
|
10
|
+
if (clampedP < 0) {
|
|
11
|
+
clampedP = 0;
|
|
12
|
+
}
|
|
13
|
+
else if (clampedP > 1) {
|
|
14
|
+
clampedP = 1;
|
|
15
|
+
}
|
|
16
|
+
return clampedP * range + start;
|
|
17
|
+
}
|
|
18
|
+
exports.lerpNumber = lerpNumber;
|
|
@@ -15,6 +15,7 @@ export declare class Vector3 {
|
|
|
15
15
|
static Cross: (a: Vector3, b: Vector3) => Vector3;
|
|
16
16
|
static Dot: (a: Vector3, b: Vector3) => number;
|
|
17
17
|
static NewVectorOfLength: (vec: Vector3, length: number) => Vector3;
|
|
18
|
+
static Lerp: (initial: Vector3, final: Vector3, percent: number) => Vector3;
|
|
18
19
|
readonly x: number;
|
|
19
20
|
readonly y: number;
|
|
20
21
|
readonly z: number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Vector3 = void 0;
|
|
4
|
+
const lerpNumber_1 = require("../Utilities/lerpNumber");
|
|
4
5
|
class Vector3 {
|
|
5
6
|
constructor(x, y, z) {
|
|
6
7
|
this.x = x;
|
|
@@ -89,3 +90,9 @@ Vector3.NewVectorOfLength = (vec, length) => {
|
|
|
89
90
|
const unit = vec.unit;
|
|
90
91
|
return new Vector3(length * unit.x, length * unit.y, length * unit.z);
|
|
91
92
|
};
|
|
93
|
+
Vector3.Lerp = (initial, final, percent) => {
|
|
94
|
+
const x = lerpNumber_1.lerpNumber(initial.x, final.x, percent);
|
|
95
|
+
const y = lerpNumber_1.lerpNumber(initial.y, final.y, percent);
|
|
96
|
+
const z = lerpNumber_1.lerpNumber(initial.z, final.z, percent);
|
|
97
|
+
return new Vector3(x, y, z);
|
|
98
|
+
};
|