File size: 1,995 Bytes
33b0eee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
export class BackgroundEffects {
    constructor() {
        this.containerElement = document.body;
    }
    
    init() {
        // Initialize any dynamic background effects
        this._createParticles();
    }
    
    _createParticles() {
        // Add particle container if needed
        const particlesContainer = document.getElementById('particles-js') || this._createParticlesContainer();
        const particleCount = 30; // Reduced from 100 for better performance
        
        for (let i = 0; i < particleCount; i++) {
            const particle = this._createParticle();
            particlesContainer.appendChild(particle);
        }
    }
    
    _createParticlesContainer() {
        const container = document.createElement('div');
        container.id = 'particles-js';
        container.style.position = 'fixed';
        container.style.top = '0';
        container.style.left = '0';
        container.style.width = '100%';
        container.style.height = '100%';
        container.style.pointerEvents = 'none';
        container.style.zIndex = '-1';
        document.body.appendChild(container);
        return container;
    }
    
    _createParticle() {
        const particle = document.createElement('div');
        particle.className = 'particle';
        
        const size = Math.random() * 4 + 1; // Smaller size for better performance
        particle.style.width = `${size}px`;
        particle.style.height = `${size}px`;
        
        particle.style.left = `${Math.random() * 100}%`;
        particle.style.top = `${Math.random() * 100}%`;
        
        const tx = (Math.random() - 0.5) * 200;
        const ty = (Math.random() - 0.5) * 200;
        particle.style.setProperty('--tx', `${tx}px`);
        particle.style.setProperty('--ty', `${ty}px`);
        
        const duration = Math.random() * 3 + 2;
        particle.style.animation = `particleAnimation ${duration}s linear infinite alternate`;
        
        return particle;
    }
}