🚀 improve demos

This commit is contained in:
platane
2020-10-24 10:48:18 +02:00
parent 64b04e9eba
commit a9c2cbc763
9 changed files with 71 additions and 54 deletions

View File

@@ -55,5 +55,11 @@ export const createCanvas = ({
drawLerpWorld(ctx, grid, snake0, snake1, stack, k, drawOptions);
};
return { draw, drawLerp, canvas, ctx };
const highlightCell = (x: number, y: number, color = "orange") => {
ctx.fillStyle = color;
ctx.beginPath();
ctx.fillRect((1 + x + 0.5) * 16 - 2, (2 + y + 0.5) * 16 - 2, 4, 4);
};
return { draw, drawLerp, highlightCell, canvas, ctx };
};