add score "edit" mode
This commit is contained in:
14
projects/common/src/utils/curve-point.ts
Normal file
14
projects/common/src/utils/curve-point.ts
Normal file
@ -0,0 +1,14 @@
|
||||
export class CurvePoint {
|
||||
constructor(
|
||||
private acc: number,
|
||||
private multiplier: number
|
||||
) {}
|
||||
|
||||
getAcc(): number {
|
||||
return this.acc;
|
||||
}
|
||||
|
||||
getMultiplier(): number {
|
||||
return this.multiplier;
|
||||
}
|
||||
}
|
29
projects/common/src/utils/math-utils.ts
Normal file
29
projects/common/src/utils/math-utils.ts
Normal file
@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Clamps a value between two values.
|
||||
*
|
||||
* @param value the value
|
||||
* @param min the minimum
|
||||
* @param max the maximum
|
||||
*/
|
||||
export function clamp(value: number, min: number, max: number) {
|
||||
if (min !== null && value < min) {
|
||||
return min;
|
||||
}
|
||||
|
||||
if (max !== null && value > max) {
|
||||
return max;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lerps between two values.
|
||||
*
|
||||
* @param v0 value 0
|
||||
* @param v1 value 1
|
||||
* @param t the amount to lerp
|
||||
*/
|
||||
export function lerp(v0: number, v1: number, t: number) {
|
||||
return v0 + t * (v1 - v0);
|
||||
}
|
Reference in New Issue
Block a user