🐐
This commit is contained in:
@@ -25,34 +25,19 @@ function startHeroTypewriter(nameEl, fullName, restEls) {
|
||||
typeNext();
|
||||
}
|
||||
|
||||
// ── Loader ────────────────────────────────────────────────────
|
||||
// ── Hero intro ────────────────────────────────────────────────
|
||||
(function () {
|
||||
const loader = document.getElementById('loader');
|
||||
const pctEl = document.getElementById('loaderPct');
|
||||
const nameEl = document.querySelector('.hero-name');
|
||||
const restEls = [...document.querySelectorAll('.hero-role, .hero-pronouns, .hero-links, .hero-visual')];
|
||||
|
||||
// Store the name and clear it immediately (loader covers the page anyway)
|
||||
// Store the name and clear it so the typewriter can type it out
|
||||
const fullName = nameEl.textContent.trim();
|
||||
nameEl.textContent = '';
|
||||
|
||||
// Hide hero elements that reveal after typing
|
||||
restEls.forEach(el => el.classList.add('fade-up'));
|
||||
|
||||
let pct = 0;
|
||||
const tick = setInterval(() => {
|
||||
pct += Math.random() * 15;
|
||||
if (pct >= 100) {
|
||||
pct = 100;
|
||||
clearInterval(tick);
|
||||
setTimeout(() => {
|
||||
loader.classList.add('hide');
|
||||
// Wait for the loader fade-out (0.6s), then start typing
|
||||
setTimeout(() => startHeroTypewriter(nameEl, fullName, restEls), 600);
|
||||
}, 300);
|
||||
}
|
||||
pctEl.textContent = Math.floor(pct) + '%';
|
||||
}, 110);
|
||||
startHeroTypewriter(nameEl, fullName, restEls);
|
||||
})();
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user