File size: 2,577 Bytes
aca769c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b26fa8a
aca769c
b26fa8a
aca769c
b26fa8a
aca769c
b26fa8a
aca769c
b26fa8a
aca769c
 
b26fa8a
aca769c
 
b26fa8a
aca769c
b26fa8a
 
 
 
 
 
 
 
aca769c
 
 
 
 
 
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
80
81
82
83
84
85
86
87
88
89
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)`;
});