improving responsiviness
All checks were successful
Homepage Build and Deploy / Build Homepage Image (push) Successful in 10m21s
Homepage Build and Deploy / Deploy Homepage (push) Successful in 31s

This commit is contained in:
2025-08-28 17:41:49 -03:00
parent 552ae580ea
commit 0293a5fa9d
9 changed files with 332 additions and 99 deletions

View File

@@ -5,11 +5,11 @@ class MatrixBackground {
this.dots = [];
this.connections = [];
this.config = {
dotCount: 50,
dotCount: this.getMobileDotCount(),
dotSpeed: 0.2,
connectionDuration: { min: 2000, max: 6000 },
connectionChance: 0.0002,
maxConnections: 8,
maxConnections: this.getMobileMaxConnections(),
dotSize: 3,
colors: {
dotDefault: 'rgba(255, 255, 255, 0.8)',
@@ -27,6 +27,20 @@ class MatrixBackground {
this.init();
}
getMobileDotCount() {
// Reduce dot count on mobile devices for better performance
if (window.innerWidth <= 480) return 25;
if (window.innerWidth <= 768) return 35;
return 50;
}
getMobileMaxConnections() {
// Reduce max connections on mobile devices
if (window.innerWidth <= 480) return 4;
if (window.innerWidth <= 768) return 6;
return 8;
}
init() {
this.handleResize();
this.animate();
@@ -36,6 +50,11 @@ class MatrixBackground {
handleResize() {
this.canvas.width = window.innerWidth;
this.canvas.height = window.innerHeight;
// Update mobile-specific configurations
this.config.dotCount = this.getMobileDotCount();
this.config.maxConnections = this.getMobileMaxConnections();
this.createDots();
}