Uncover your hiddenhidden(function(){const componentId = "pixel-reveal-oer1buze6";
const decodeCharsStr = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,0,1,2,3,4,5,6,7,8,9";
const cycles = 11;
(function() {
const container = document.getElementById(componentId);
if (!container) return;
if (container.hasAttribute('data-initialized')) return;
container.setAttribute('data-initialized', 'true');
const decorativeElement = container.querySelector('.pixel-reveal-decorative');
if (!decorativeElement) return;
const isAutoplay = container.getAttribute('data-autoplay') !== 'false';
const decodeChars = decodeCharsStr.split(',');
// Brand color for pixel effects
const BRAND_COLOR = '#4C4CFF';
// Animation configuration
const SCRAMBLE_INTERVAL = 45;
const SCRAMBLE_DURATION = cycles * SCRAMBLE_INTERVAL;
const STAGGER_DELAY = 50;
const REVEAL_STAGGER = 70;
const SPARKLE_CHANCE = 0.3;
// Pixel dot configuration
const DOTS_PER_CHAR = 6;
const DOT_SIZE = 3;
// Track active timeouts/intervals for cleanup on hover mode
let activeTimers = [];
let activeIntervals = [];
// Seeded random for consistent results
function seededRandom(seed) {
const x = Math.sin(seed * 12.9898 + seed * 78.233) * 43758.5453;
return x - Math.floor(x);
}
// Create pixel dots for a character
function createPixelDots(dotsContainer, charIndex) {
dotsContainer.innerHTML = '';
for (let i = 0; i < DOTS_PER_CHAR; i++) {
const dot = document.createElement('span');
dot.className = 'pixel-dot';
// Random position within character bounds
const seed = charIndex * 100 + i;
const x = seededRandom(seed) * 100;
const y = seededRandom(seed + 1000) * 100;
// Random animation phase for pulsing
const phase = seededRandom(seed + 2000) * Math.PI * 2;
const speed = 0.5 + seededRandom(seed + 3000) * 0.5;
dot.style.cssText = `
left: ${x}%;
top: ${y}%;
width: ${DOT_SIZE}px;
height: ${DOT_SIZE}px;
--phase: ${phase};
--speed: ${speed};
`;
dot.dataset.phase = String(phase);
dot.dataset.speed = String(speed);
dotsContainer.appendChild(dot);
}
}
// Animate pixel dots with pulsing opacity (like hero dot grid)
let dotsAnimationId = null;
const allDots = [];
function animateDots(time) {
for (const { dot, phase, speed } of allDots) {
// Dual sine wave for complex pulsing (matching hero dot grid)
const wave1 = Math.sin(time * 0.003 * speed + phase);
const wave2 = Math.sin(time * 0.003 * 0.7 + phase * 1.3);
const combinedWave = wave1 * 0.7 + wave2 * 0.3;
// Normalize and sharpen
const normalizedWave = (combinedWave + 1) / 2;
const sharpenedWave = Math.pow(normalizedWave, 1.5);
// Occasional sparkle
const sparkleChance = Math.sin(time * 0.001 + parseFloat(dot.dataset.phase || '0')) * 0.5 + 0.5;
const sparkle = sparkleChance > 0.95 ? 1.5 : 1;
const opacity = Math.min((0.2 + sharpenedWave * 0.8) * sparkle, 1);
dot.style.opacity = String(opacity);
}
dotsAnimationId = requestAnimationFrame(animateDots);
}
function startDotsAnimation() {
if (!dotsAnimationId) {
dotsAnimationId = requestAnimationFrame(animateDots);
}
}
function stopDotsAnimation() {
if (dotsAnimationId) {
cancelAnimationFrame(dotsAnimationId);
dotsAnimationId = null;
}
}
function clearAllTimers() {
activeTimers.forEach(t => clearTimeout(t));
activeIntervals.forEach(i => clearInterval(i));
activeTimers = [];
activeIntervals = [];
}
function resetAnimation() {
clearAllTimers();
stopDotsAnimation();
allDots.length = 0;
// Reset state attributes
container.removeAttribute('data-animated');
container.removeAttribute('data-complete');
// Reset all decorative chars to their original state
const chars = decorativeElement.querySelectorAll('.pixel-char');
chars.forEach((charEl) => {
charEl.classList.remove('scrambling', 'revealed', 'sparkle');
const currentDisplay = charEl.querySelector('.pixel-char-current');
const finalChar = charEl.getAttribute('data-char') || '';
if (currentDisplay) currentDisplay.textContent = finalChar;
const dotsContainer = charEl.querySelector('.pixel-dots');
if (dotsContainer) dotsContainer.innerHTML = '';
});
}
function startPixelAnimation() {
// If already animating in hover mode, reset first
if (!isAutoplay) {
resetAnimation();
}
const chars = decorativeElement.querySelectorAll('.pixel-char');
const totalChars = chars.length;
// Set brand color CSS variable
container.style.setProperty('--brand-color', BRAND_COLOR);
// Read computed text color for final state
const rootColor = getComputedStyle(container).color;
container.style.setProperty('--pixel-color', rootColor);
// Mark as animated
container.setAttribute('data-animated', 'true');
// Initialize pixel dots for each character
chars.forEach((charEl, index) => {
const dotsContainer = charEl.querySelector('.pixel-dots');
if (dotsContainer) {
createPixelDots(dotsContainer, index);
// Register dots for animation
const dots = dotsContainer.querySelectorAll('.pixel-dot');
dots.forEach(dot => {
allDots.push({
dot,
phase: parseFloat(dot.dataset.phase || '0'),
speed: parseFloat(dot.dataset.speed || '1')
});
});
}
});
// Start dots pulsing animation
startDotsAnimation();
// Process each character
chars.forEach((charEl, index) => {
const currentDisplay = charEl.querySelector('.pixel-char-current');
const finalChar = charEl.getAttribute('data-char') || '';
const startDelay = index * STAGGER_DELAY;
const revealTime = startDelay + SCRAMBLE_DURATION + (index * REVEAL_STAGGER);
// Start scrambling after stagger delay
const t = setTimeout(() => {
charEl.classList.add('scrambling');
// Scramble at intervals with occasional sparkle
let scrambleCount = 0;
const scrambleInterval = setInterval(() => {
const randomChar = decodeChars[Math.floor(Math.random() * decodeChars.length)];
currentDisplay.textContent = randomChar;
// Random sparkle during scramble
if (Math.random() < SPARKLE_CHANCE) {
charEl.classList.add('sparkle');
const st = setTimeout(() => charEl.classList.remove('sparkle'), 150);
activeTimers.push(st);
}
scrambleCount++;
}, SCRAMBLE_INTERVAL);
activeIntervals.push(scrambleInterval);
// Stop scrambling and reveal final character
const rt = setTimeout(() => {
clearInterval(scrambleInterval);
charEl.classList.remove('scrambling');
charEl.classList.add('revealed');
currentDisplay.textContent = finalChar;
}, revealTime - startDelay);
activeTimers.push(rt);
}, startDelay);
activeTimers.push(t);
});
// Calculate total animation duration
const lastCharIndex = totalChars - 1;
const totalDuration = (lastCharIndex * STAGGER_DELAY) + SCRAMBLE_DURATION + (lastCharIndex * REVEAL_STAGGER) + 400;
// Mark complete and cleanup
const completeTimer = setTimeout(() => {
container.setAttribute('data-complete', 'true');
stopDotsAnimation();
}, totalDuration);
activeTimers.push(completeTimer);
}
if (isAutoplay) {
// Autoplay mode: trigger on scroll into view (original behavior)
if (container.hasAttribute('data-animated')) return;
const observer = new IntersectionObserver(
(entries) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
startPixelAnimation();
observer.disconnect();
}
});
},
{ threshold: 0.1, rootMargin: '0px' }
);
observer.observe(container);
} else {
// Hover mode: trigger on mouseenter, reset on mouseleave
container.addEventListener('mouseenter', () => {
startPixelAnimation();
});
container.addEventListener('mouseleave', () => {
resetAnimation();
});
}
})();
})(); website visitors