Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions assets/animations/fx-runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,17 @@

window.__hpxActive = window.__hpxActive || new Map();

/* querySelectorAll never matches root itself, but decks put data-fx on the
* <section class="slide"> too (e.g. a cover starfield) — include it. */
function fxEls(root){
const els = Array.from(root.querySelectorAll('[data-fx]'));
if (root.matches && root.matches('[data-fx]')) els.unshift(root);
return els;
}

function initFxIn(root){
if (!window.HPX) return;
const els = root.querySelectorAll('[data-fx]');
const els = fxEls(root);
els.forEach((el) => {
if (window.__hpxActive.has(el)) return;
const name = el.getAttribute('data-fx');
Expand All @@ -54,7 +62,7 @@
}

function stopFxIn(root){
const els = root.querySelectorAll('[data-fx]');
const els = fxEls(root);
els.forEach((el) => {
const h = window.__hpxActive.get(el);
if (h && typeof h.stop === 'function'){
Expand Down