File size: 5,256 Bytes
2a84c8b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | document.addEventListener('DOMContentLoaded', () => {
const starsContainer = document.getElementById('stars-container');
const modal = document.getElementById('modal');
const starName = document.getElementById('star-name');
const starLore = document.getElementById('star-lore');
const closeModal = document.getElementById('close-modal');
// Star names and lore
const starData = [
{ name: "Nebula Prime", lore: "Ancient texts speak of this star as the birthplace of cosmic energy. Its blue hue suggests high concentrations of ionized particles." },
{ name: "Aetheris", lore: "A binary star system with twin suns locked in eternal dance. Legends say time flows differently near this celestial pair." },
{ name: "Void's Eye", lore: "This mysterious dark star emits no visible light, yet gravitational readings suggest immense mass. Some believe it's a portal to another dimension." },
{ name: "Solara", lore: "The brightest star in this sector, worshipped by ancient civilizations as a deity of warmth and life." },
{ name: "Chronos", lore: "A pulsar with perfect rhythmic emissions. Scientists use it as the galactic standard for time measurement." },
{ name: "Phantom Star", lore: "Appears and disappears from observation. Some claim it's a cloaked alien megastructure rather than a natural phenomenon." },
{ name: "Ember", lore: "A dying red giant in its final stages. Poets write of its beauty as the 'last sigh of a celestial titan'." },
{ name: "Quantum Beacon", lore: "Emits strange particles that defy conventional physics. Research stations orbit at a safe distance to study its properties." },
{ name: "Celestia", lore: "A young star surrounded by protoplanetary dust. The perfect laboratory for studying solar system formation." },
{ name: "Oblivion's Maw", lore: "A black hole star binary system. The star's material is slowly being consumed, creating spectacular light shows." },
{ name: "Starborn", lore: "This star's unique spectral signature suggests it originated from another galaxy before being captured by our own." },
{ name: "The Watcher", lore: "Named for its position directly above the galactic north pole. Many cultures used it for navigation and prophecy." },
{ name: "Singularity", lore: "A neutron star with such intense gravity that light bends around it in visible rings. Approaching ships report time dilation effects." },
{ name: "Phoenix", lore: "A variable star that periodically dims then flares brighter than before. Some believe it's a sentient entity." },
{ name: "Eclipse", lore: "A star system with perfect planetary alignment that creates annual total eclipses visible from multiple worlds." },
{ name: "The Forge", lore: "A blue supergiant where heavy elements are created in its core. The source of many rare minerals in the galaxy." },
{ name: "Dreamer's Star", lore: "Emits unusual radiation patterns that affect brain waves. Nearby colonies report vivid dreams and enhanced creativity." },
{ name: "Oracle", lore: "Ancient ruins on multiple planets align with this star during significant astronomical events. Its purpose remains unknown." },
{ name: "The Sentinel", lore: "A rogue star traveling between galaxies. Its trajectory suggests it may have been deliberately set on its path." },
{ name: "Infinity", lore: "A perfect sphere of plasma with no observable surface features. Some believe it's the physical manifestation of a mathematical concept." }
];
// Create stars
for (let i = 0; i < 20; i++) {
const star = document.createElement('div');
star.className = 'star';
// Random position
const x = Math.random() * 100;
const y = Math.random() * 100;
star.style.left = `${x}%`;
star.style.top = `${y}%`;
// Random size variation
const size = 4 + Math.random() * 6;
star.style.width = `${size}px`;
star.style.height = `${size}px`;
// Random color variation
const hue = 180 + Math.random() * 60; // Blue-cyan range
const saturation = 70 + Math.random() * 30;
star.style.background = `radial-gradient(circle, hsl(${hue}, ${saturation}%, 90%) 30%, transparent 70%)`;
star.style.boxShadow = `0 0 10px 2px hsla(${hue}, ${saturation}%, 70%, 0.7)`;
// Random animation delay
star.style.animationDelay = `${Math.random() * 5}s`;
// Click event
star.addEventListener('click', () => {
const randomStar = starData[Math.floor(Math.random() * starData.length)];
starName.textContent = randomStar.name;
starLore.textContent = randomStar.lore;
modal.classList.remove('hidden');
});
starsContainer.appendChild(star);
}
// Close modal
closeModal.addEventListener('click', () => {
modal.classList.add('hidden');
});
// Close modal when clicking outside content
modal.addEventListener('click', (e) => {
if (e.target === modal) {
modal.classList.add('hidden');
}
});
}); |