master merc/website / src / .js / rfont.js
 1document.addEventListener("DOMContentLoaded", function() {
 2    function rnd(el) {
 3        const text = el.textContent;
 4        el.innerHTML = text.split("").map(function(char) {
 5            if (char.trim() === "") return char;
 6            const rot = (Math.random() - 0.5) * 4;
 7            const size = 0.85 + Math.random() * 0.1;
 8            return `<span style="display:inline-block;transform-origin:center;transform:rotate(${rot}deg) scale(${size});">${char}</span>`;
 9        }).join("");
10    }
11
12    const rfontEl = document.querySelectorAll(".rfont, h1, h2, h3, h4, h5, h6");
13    rfontEl.forEach(function(el) {
14        rnd(el);
15    });
16
17    setInterval(function() {
18        rfontEl.forEach(function(el) {
19            rnd(el);
20        });
21    }, 150);
22});