0xa85e2099…e34asent to0x78f6609c…ce19·#25,413,117·view on Etherscan
ionFrame = frame) {
const storageFrame = grPureProceduralEnabled() ? 0 : frame;
let toneLines = toneLineCache[storageFrame];
if (!toneLines) {
toneLines = grGeneratedToneFrame(storedToneFrames, storageFrame).split("\n");
toneLineCache[storageFrame] = toneLines;
}
let styleLines = styleLineCache[storageFrame];
if (!styleLines) {
styleLines = grGeneratedStyleFrame(storedStyleFrames, storageFrame).split("\n");
styleLineCache[storageFrame] = styleLines;
}
svgComputeRowOffsets(frame);
for (let row = 0; row < rows; row += 1) {
const toneLine = toneLines[row] || "";
const styleLine = styleLines[row] || "";
for (let column = 0; column < columns; column += 1) {
const tone = toneValueMap[toneLine[column] || "0"] ?? 0;
const style = grEffectiveStyle(styleLine[column] || "0", tone);
const adaptiveSpec = grAdaptiveBlockSpec(styleLines, column, row, style);
const recoveredAdaptiveDenseAnchor = adaptiveSpec ? adaptiveSpec.recoveredDenseAnchor : false;
const adaptiveScale = adaptiveSpec ? 1 : 1;
const glyph = grEdgeGlyphFromStyle(style) || grGlyphFromTone(tone, column, row, frame);
const index = row * columns + column;
if (style === "1") {
svgClearCell(targetCells[index]);
if (targetGlowCells?.[index]) svgClearCell(targetGlowCells[index]);
continue;
}
const shouldGlow = svgSetCell(targetCells[index], glyph, tone, style, column, row, frame, adaptiveScale, motionFrame, recoveredAdaptiveDenseAnchor, adaptiveSpec);
if (targetGlowCells) {
if (shouldGlow) {
if (!targetGlowCells[index]) targetGlowCells[index] = svgCreateCellNode(targetGlowCells._parent, column, row);
svgSetCell(targetGlowCells[index], glyph, tone, style, column, row, frame, adaptiveScale, motionFrame, recoveredAdaptiveDenseAnchor, adaptiveSpec);
} else if (targetGlowCells[index]) {
svgClearCell(targetGlowCells[index]);
}
}
}
}
}
function svgBuildCachedFrame(frame) {
const group = document.createElementNS(svgNs, "g");
const glowGroup = RENDER_GLOW_ENABLED ? document.createElementNS(svgNs, "g") : null;
group.setAttribute("opacity", "0");
group.style.display = "none";
if (glowGroup) {
glowGroup.setAttribute("opacity", "0");
glowGroup.style.display = "none";
}
const targetCells = [];
const targetGlowCells = [];
if (glowGroup) targetGlowCells._parent = glowGroup;
createCellNodes(group, targetCells);
cellsLayer.appendChild(group);
if (glowGroup) glowCellsLayer.appendChild(glowGroup);
svgPaintCells(targetCells, frame, glowGroup ? targetGlowCells : null);
frameGroups[frame] = { group, glowGroup };
return frameGroups[frame];
}
function svgShowCachedFrame(frame, timelineFrame) {
const entry = frameGroups[frame] || svgBuildCachedFrame(frame);
if (activeFrameGroup && activeFrameGroup !== entry) {
activeFrameGroup.group.style.display = "none";
activeFrameGroup.group.setAttribute("opacity", "0");
if (activeFrameGroup.glowGroup) {
activeFrameGroup.glowGroup.style.display = "none";
activeFrameGroup.glowGroup.setAttribute("opacity", "0");
}
}
entry.group.style.display = "block";
entry.group.setAttribute("opacity", "1");
if (entry.glowGroup) {
entry.glowGroup.style.display = "block";
entry.glowGroup.setAttribute("opacity", "1");
}
activeFrameGroup = entry;
svgQueueWarmFrame(grPlaybackFrame((timelineFrame + 1) % grTimelineFrameCount()));
}
function svgQueueWarmFrame(frame) {
if (!CACHE_FRAME_GROUPS) return;
if (frameGroups[frame] || warmingFrames.has(frame)) return;
warmingFrames.add(frame);
const build = () => {
svgBuildCachedFrame(frame);
warmingFrames.delete(frame);
};
if (typeof requestIdleCallback === "function") requestIdleCallback(build, { timeout: 120 });
else setTimeout(build, 1);
}
function svgPrebuildCachedFrames() {
if (!CACHE_FRAME_GROUPS) return;
svgBuildCachedFrame(0);
svgQueueWarmFrame(grPlaybackFrame(1 % grTimelineFrameCount()));
}
function svgStart() {
const fps = Math.max(1, SIGNAL_RITUAL_ENGINE.fps || 12);
const frameMs = 1000 / fps;
const proceduralFrameMs = 1000 / PROCEDURAL_RENDER_FPS;
let lastTime = 0;
let startTime = 0;
function next(now) {
if (document.hidden) {
lastTime = now;
requestAnimationFrame(next);
return;
}
if (!lastTime) lastTime = now;
if (!startTime) startTime = now;
const elapsed = now - lastTime;
if (grProceduralMotionEnabled() && elapsed >= proceduralFrameMs) {
tick = ((now - startTime) / 1000) * PROCEDURAL_MOTION_CLOCK_FPS;
svgRender(tick);
lastTime += Math.max(1, Math.floor(elapsed / proceduralFrameMs)) * proceduralFrameMs;
} else if (!grProceduralMotionEnabled() && elapsed >= frameMs) {
const steps = Math.max(1, Math.floor(elapsed / frameMs));
tick = (tick + steps) % grTimelineFrameCount();
svgRender(tick);
lastTime += steps * frameMs;
}
requestAnimationFrame(next);
}
if (typeof requestAnimationFrame === "function") requestAnimationFrame(next);
else setInterval(() => {
tick = grProceduralMotionEnabled() ? tick + (PROCEDURAL_MOTION_CLOCK_FPS / PROCEDURAL_RENDER_FPS) : (tick + 1) % grTimelineFrameCount();
svgRender(tick);
}, Math.round(grProceduralMotionEnabled() ? proceduralFrameMs : frameMs));
}
try {
svgPrebuildCachedFrames();
svgRender(0);
tick = 0;
svgStart();
} catch (error) {
const art = document.getElementById("art");
if (art) {
const fallback = document.createElementNS(svgNs, "text");
fallback.setAttribute("x", "50%");
fallback.setAttribute("y", "50%");
fallback.setAttribute("fill", "#f3f0e8");
fallback.setAttribute("font-family", "monospace");
fallback.setAttribute("font-size", Math.max(18, Math.round(cell * 2)));
fallback.setAttribute("text-anchor", "middle");
fallback.textContent = "SIGNAL RITUALS";
art.appendChild(fallback);
}
}