snake: add catmull-rom rendering mode
This commit is contained in:
@@ -3,17 +3,6 @@ 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 lerpPoint(a: Point, b: Point, p: number) {
|
||||
return {
|
||||
x: a.x + (b.x - a.x) * p,
|
||||
@@ -150,7 +139,7 @@ export function drawLine(ctx: CanvasRenderingContext2D, start: Point, end: Point
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
function rgbToString(color: number) {
|
||||
export function rgbToString(color: number) {
|
||||
return `#${color.toString(16).padStart(6, '0')}`;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user