Quantum Chrysalis - TSX
Quantum Chrysalis - TSX
useEffect(() => {
const mutate = () => {
setState(prev => {
const next = (prev + (Math.random() - 0.5) * intensity) % 1;
return next < 0 ? 1 + next : next;
});
timeoutRef.current = setTimeout(mutate, Math.random() * 2000 + 500);
};
mutate();
return () => clearTimeout(timeoutRef.current);
}, [intensity]);
return (
<div
className={`absolute w-4 h-4 rounded-full transition-all duration-1000
${state > 0.8 ? 'bg-purple-500' : state > 0.6 ? 'bg-blue-400' : state > 0.4
? 'bg-green-400' : 'bg-yellow-300'}`}
style={{
left: `${x * 100}%`,
top: `${y * 100}%`,
opacity: state,
transform: `scale(${state * 2})`,
}}
/>
);
};
useEffect(() => {
const newCells = Array.from({ length: 30 }, (_, i) => ({
id: i,
x: Math.random(),
y: Math.random(),
}));
setCells(newCells);
}, []);
return (
<div className="w-full h-screen bg-black relative overflow-hidden"
onMouseMove={handleMouseMove} ref={containerRef}>
<div className="absolute inset-0 flex items-center justify-center text-white
opacity-20 pointer-events-none">
<span className="text-xl tracking-widest">observe your observation</span>
</div>
{cells.map(cell => (
<ParadoxCell
key={cell.id}
x={cell.x}
y={cell.y}
intensity={1 - Math.hypot(cell.x - focus.x, cell.y - focus.y)}
/>
))}
<div className="absolute bottom-4 left-4 text-white opacity-50 text-sm">
This is not what you think it is
</div>
<div className="absolute top-4 right-4 text-white opacity-50 text-sm">
This is not what it thinks it is
</div>
</div>
);
};