More fun
This commit is contained in:
parent
a1fb6755c7
commit
fc9df09ee1
1 changed files with 2012 additions and 252 deletions
6
shared/src/physics/interpolate-angles.ts
Normal file
6
shared/src/physics/interpolate-angles.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
export const interpolateAngles = (from: number, to: number, q: number) => {
|
||||
const max = Math.PI * 2;
|
||||
const possibleDistance = (to - from) % max;
|
||||
const shorterDistance = ((2 * possibleDistance) % max) - possibleDistance;
|
||||
return from + shorterDistance * q;
|
||||
};
|
||||
Loading…
Reference in a new issue