From 133d07d5e7781c86cc11cd86e80ad1ff5325fc36 Mon Sep 17 00:00:00 2001 From: Charlie Stanton Date: Sun, 6 Apr 2025 18:19:16 +0100 Subject: add nelson transparency --- src/index.html.in | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/index.html.in') diff --git a/src/index.html.in b/src/index.html.in index 119d646..46d39e4 100644 --- a/src/index.html.in +++ b/src/index.html.in @@ -118,7 +118,6 @@ async function main() { ctx.fillStyle = "#000000"; ctx.fillRect(0, 0, width, height); - console.log("frame"); for (let i = 0; i < len; i++) { let op = ops.subarray(7*i, 7*i+7); const color = new Uint8Array(new Uint32Array(op.subarray(4, 6)).buffer); @@ -128,9 +127,11 @@ async function main() { ctx.strokeStyle = `#${color[4].toString(16).padStart(2, "0")}${color[5].toString(16).padStart(2, "0")}${color[6].toString(16).padStart(2, "0")}`; ctx.globalAlpha = color[7] / 255; ctx.strokeRect(op[0], op[1], op[2], op[3]); - if (op[6] !== 0) { - ctx.globalAlpha = 1; - ctx.drawImage(images[op[6]], op[0], op[1], op[2], op[3]); + const image = new Uint8Array(new Uint32Array(op.subarray(6, 7)).buffer); + if (image[0] !== 0) { + console.log(image); + ctx.globalAlpha = image[1] / 255; + ctx.drawImage(images[image[0]], op[0], op[1], op[2], op[3]); } } } -- cgit v1.2.3