const { useEffect, useRef } = React; const Candle = () => { const flickerRef = useRef(null); const flameRef = useRef(null); const glowRef = useRef(null); useEffect(() => { let t = 0; flickerRef.current = setInterval(() => { t += 0.12; if (!flameRef.current || !glowRef.current) return; const scaleX = 1 + Math.sin(t * 2.3) * 0.06; const scaleY = 1 + Math.sin(t * 1.7) * 0.08; const tx = Math.sin(t * 3.1) * 1.5; flameRef.current.style.transform = `translate(${tx}px, 0) scaleX(${scaleX}) scaleY(${scaleY})`; glowRef.current.setAttribute('opacity', 0.7 + Math.sin(t * 2) * 0.2); }, 50); return () => { if (flickerRef.current) clearInterval(flickerRef.current); }; }, []); return ( {/* Glow halo */} {/* Flame — always lit, never blows out */} {/* Candle body */} {/* Top rim */} {/* Wax pool */} {/* Wick */} {/* Base / holder */} ); }; Object.assign(window, { Candle });