life: improve performance
This commit is contained in:
11
common.ts
11
common.ts
@@ -3,6 +3,17 @@ export interface Point {
|
||||
y: number;
|
||||
}
|
||||
|
||||
export const DIRECTIONS: Point[] = [
|
||||
{ x: 0, y: -1}, // N
|
||||
{ x: -1, y: -1}, // NW
|
||||
{ x: 1, y: -1}, // NE
|
||||
{ x: -1, y: 0}, // W
|
||||
{ x: 1, y: 0}, // E
|
||||
{ x: 0, y: 1}, // S
|
||||
{ x: -1, y: 1}, // SW
|
||||
{ x: 1, y: 1}, // SE
|
||||
];
|
||||
|
||||
export function lerp(a: Point, b: Point, p: number) {
|
||||
return {
|
||||
x: a.x + (b.x - a.x) * p,
|
||||
|
Reference in New Issue
Block a user