music: change bg text function scope

This commit is contained in:
Agahnim 2026-05-13 14:22:54 +02:00
parent 62ba9dceff
commit fd2b768475
Signed by: Agahnim
SSH key fingerprint: SHA256:Zj65PJnE0dRYye8Ltk/qDglynyXUxJngQ9qqx/VI+b4

View file

@ -5,21 +5,24 @@
</cute-container>
</music>
<script>
const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
const container = document.getElementById("bg-text");
const colWidth = 20;
const rowHeight = 24;
const cols = Math.ceil(window.innerWidth / colWidth);
const rows = Math.ceil(window.innerHeight / rowHeight);
(function () {
const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
const container = document.getElementById("bg-text");
if (!container) return;
const colWidth = 20;
const rowHeight = 24;
const cols = Math.ceil(window.innerWidth / colWidth);
const rows = Math.ceil(window.innerHeight / rowHeight);
for (let c = 0; c < cols; c++) {
const col = document.createElement("vertical-marquee-inner");
col.style.left = c * colWidth + "px";
for (let r = 0; r < rows; r++) {
const span = document.createElement("text");
span.textContent = chars[Math.floor(Math.random() * chars.length)];
col.appendChild(span);
for (let c = 0; c < cols; c++) {
const col = document.createElement("vertical-marquee-inner");
col.style.left = c * colWidth + "px";
for (let r = 0; r < rows; r++) {
const span = document.createElement("text");
span.textContent = chars[Math.floor(Math.random() * chars.length)];
col.appendChild(span);
}
container.appendChild(col);
}
container.appendChild(col);
}
})();
</script>