copy states first

This commit is contained in:
2025-11-21 23:43:10 +00:00
parent 82744e6a4a
commit c1f8fd77a8

View File

@@ -295,6 +295,9 @@ export function renderToCanvas(canvas, width, height, sn = 0, dn = 0) {
const img = ctx.createImageData(width, height); const img = ctx.createImageData(width, height);
const data = img.data; const data = img.data;
const colorOn = [0, 0, 139]; // dark blue (active cell)
const colorOff = [0, 0, 70]; // darker blue (inactive cell)
for (let y = 0; y < height; y++) { for (let y = 0; y < height; y++) {
for (let x = 0; x < width; x++) { for (let x = 0; x < width; x++) {
const idx = (y * width + x) * 4; const idx = (y * width + x) * 4;
@@ -307,9 +310,6 @@ export function renderToCanvas(canvas, width, height, sn = 0, dn = 0) {
} }
} }
const colorOn = [0, 0, 139]; // dark blue (active cell)
const colorOff = [0, 0, 70]; // darker blue (inactive cell)
ctx.putImageData(img); ctx.putImageData(img);
function step() { function step() {