/* Decretando Disney — Mickey 3D animado (animación real `wave` del GLB). Exporta window.Mickey3D */ (function(){ const { useState, useRef, useEffect } = React; const FRASES = ["¡Oh boy!", "¡Hot dog!", "¡Nos vamos de viaje! ✈️", "¡Decretalo! ✨", "¡Te espero en Orlando!", "¡Ja-já!"]; const COLORES = ["#ffd76a", "#ff9bd0", "#a880ff", "#7fd4ff", "#ffffff"]; function Mickey3D(){ const mvRef = useRef(null); const downRef = useRef(null); const timerRef = useRef(null); const [sparks, setSparks] = useState([]); const [frase, setFrase] = useState(null); const [burst, setBurst] = useState(0); /* reproducir el saludo real del modelo (en loop continuo) */ const playWave = ()=>{ const mv = mvRef.current; if(!mv) return; try{ mv.animationName = 'wave'; mv.play(); }catch(err){} }; useEffect(()=>{ /* saluda siempre: arranca al cargar y queda en loop */ const mv = mvRef.current; const hello = ()=>playWave(); if(mv){ mv.addEventListener('load', hello); } return ()=>{ clearTimeout(timerRef.current); if(mv) mv.removeEventListener('load', hello); }; },[]); const saluda = ()=>{ const mv = mvRef.current; if(!mv) return; playWave(); /* rebote */ mv.classList.remove('jump'); void mv.offsetWidth; mv.classList.add('jump'); /* chispas mágicas */ setSparks(Array.from({length:16}, (_,i)=>{ const a = (i / 16) * Math.PI * 2 + Math.random() * .5; const d = 90 + Math.random() * 110; return { id: burst + '-' + i, dx: Math.cos(a) * d, dy: Math.sin(a) * d - 30, s: 6 + Math.random() * 9, c: COLORES[(Math.random() * COLORES.length) | 0], dl: Math.random() * .15 }; })); /* frase */ setFrase(FRASES[(Math.random() * FRASES.length) | 0]); setBurst(b => b + 1); clearTimeout(timerRef.current); timerRef.current = setTimeout(()=>setFrase(null), 1900); }; /* distinguir click de arrastre (girarlo no debe hacerlo saludar) */ const onDown = (e)=>{ downRef.current = { x: e.clientX, y: e.clientY }; }; const onUp = (e)=>{ const d = downRef.current; if(!d) return; if(Math.hypot(e.clientX - d.x, e.clientY - d.y) < 8) saluda(); downRef.current = null; }; return (

Saludá a Mickey ✨

Hacé un click sobre él para que te salude.

{frase &&
{frase}
} {sparks.map(s=>( ))}
); } window.Mickey3D = Mickey3D; })();