Download script.js from GGGG128193/cosmic-singularity-wordscape: direct link, hf CLI and curl.
- Browser
- Download file 2.58 kB
-
https://huggingface.co/spaces/GGGG128193/cosmic-singularity-wordscape/resolve/main/script.js
- Command line
-
hf download hf://spaces/GGGG128193/cosmic-singularity-wordscape/script.js
-
curl -L -o script.js https://huggingface.co/spaces/GGGG128193/cosmic-singularity-wordscape/resolve/main/script.js
2.58 kB
| let currentEffect = 0; | |
| const effects = [ | |
| () => VANTA.NET({ | |
| el: "#vanta-bg", | |
| mouseControls: true, | |
| touchControls: true, | |
| gyroControls: false, | |
| minHeight: 200.00, | |
| minWidth: 200.00, | |
| scale: 1.00, | |
| scaleMobile: 1.00, | |
| color: 0x9c4dff, | |
| backgroundColor: 0x0, | |
| points: 12.00, | |
| maxDistance: 22.00, | |
| spacing: 18.00 | |
| }), | |
| () => VANTA.WAVES({ | |
| el: "#vanta-bg", | |
| mouseControls: true, | |
| touchControls: true, | |
| gyroControls: false, | |
| minHeight: 200.00, | |
| minWidth: 200.00, | |
| scale: 1.00, | |
| scaleMobile: 1.00, | |
| color: 0xff3f81, | |
| shininess: 35.00, | |
| waveHeight: 20.00, | |
| waveSpeed: 0.90, | |
| zoom: 0.75 | |
| }), | |
| () => VANTA.GLOBE({ | |
| el: "#vanta-bg", | |
| mouseControls: true, | |
| touchControls: true, | |
| gyroControls: false, | |
| minHeight: 200.00, | |
| minWidth: 200.00, | |
| scale: 1.00, | |
| scaleMobile: 1.00, | |
| color: 0x2e86de, | |
| backgroundColor: 0x0, | |
| size: 1.00 | |
| }) | |
| ]; | |
| // Initialize first effect | |
| let vantaEffect = effects[0](); | |
| // Change background effect | |
| document.getElementById('change-bg').addEventListener('click', () => { | |
| currentEffect = (currentEffect + 1) % effects.length; | |
| if (vantaEffect) vantaEffect.destroy(); | |
| vantaEffect = effects[currentEffect](); | |
| }); | |
| // Word animation | |
| const word = document.getElementById('main-word'); | |
| const words = ['INFINITY', 'ETERNITY', 'COSMOS', 'NEBULA', 'GALAXY', 'QUANTUM', 'SINGULARITY', 'UNIVERSE', 'STELLAR', 'VOID', 'PLASMA', 'GRAVITY', 'LIGHT', 'STARS', 'DARK MATTER', 'BLACK HOLE', 'SUPERNOVA']; | |
| let currentWordIndex = 0; | |
| let animationInterval = setInterval(animateWord, 3000); | |
| function animateWord() { | |
| currentWordIndex = (currentWordIndex + 1) % words.length; | |
| word.style.transform = 'translateY(30px)'; | |
| word.style.opacity = 0; | |
| setTimeout(() => { | |
| word.textContent = words[currentWordIndex]; | |
| word.style.transform = 'translateY(0)'; | |
| word.style.opacity = 1; | |
| }, 500); | |
| } | |
| // Pause animation on hover | |
| word.addEventListener('mouseenter', () => { | |
| clearInterval(animationInterval); | |
| }); | |
| word.addEventListener('mouseleave', () => { | |
| animationInterval = setInterval(animateWord, 3000); | |
| }); | |
| // Mouse move parallax effect | |
| document.addEventListener('mousemove', (e) => { | |
| const x = e.clientX / window.innerWidth; | |
| const y = e.clientY / window.innerHeight; | |
| word.style.transform = `translate(${x * 20 - 10}px, ${y * 20 - 10}px)`; | |
| }); |