added random cybersigilism generation

This commit is contained in:
2026-05-16 17:48:52 +02:00
parent c576794951
commit 2dc224abc4
4 changed files with 222 additions and 0 deletions
+15
View File
@@ -21,12 +21,27 @@
</div>
<script>
import { buildCybersigil } from '../lib/cybersigil';
function initCyberFx() {
const root = document.documentElement;
if (!root.classList.contains('cybersigil')) return;
const reduced = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
/* ─── Generated sigil growths in the four corners ─── */
/* One sigil per page load; the four corner transforms in global.css
* (scaleX / scaleY / scale) splay it into each corner. */
const corners = document.querySelectorAll<HTMLElement>('.cs-fx-corner');
if (corners.length) {
const svg = buildCybersigil();
corners.forEach((c) => {
if (c.classList.contains('cs-fx-corner--sig')) return;
c.innerHTML = svg;
c.classList.add('cs-fx-corner--sig');
});
}
/* ─── Scroll-entry databend on images ─── */
if (!reduced && 'IntersectionObserver' in window) {
const targets = document.querySelectorAll<HTMLElement>(