✨ feat: update neural network background logic for improved performance
This commit is contained in:
@@ -1,12 +1,11 @@
|
|||||||
/**
|
/**
|
||||||
* Neural Network Background Animation
|
* Vereinfachter Neuronales Netzwerk Hintergrund
|
||||||
* Modern, darker, mystical theme using WebGL
|
* Verwendet Canvas 2D anstelle von WebGL für bessere Leistung
|
||||||
* Subtle flowing network aesthetic
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class NeuralNetworkBackground {
|
class NeuralNetworkBackground {
|
||||||
constructor() {
|
constructor() {
|
||||||
// Canvas setup
|
// Canvas einrichten
|
||||||
this.canvas = document.createElement('canvas');
|
this.canvas = document.createElement('canvas');
|
||||||
this.canvas.id = 'neural-network-background';
|
this.canvas.id = 'neural-network-background';
|
||||||
this.canvas.style.position = 'fixed';
|
this.canvas.style.position = 'fixed';
|
||||||
@@ -14,17 +13,18 @@ class NeuralNetworkBackground {
|
|||||||
this.canvas.style.left = '0';
|
this.canvas.style.left = '0';
|
||||||
this.canvas.style.width = '100%';
|
this.canvas.style.width = '100%';
|
||||||
this.canvas.style.height = '100%';
|
this.canvas.style.height = '100%';
|
||||||
this.canvas.style.zIndex = '-10'; // Ensure it's behind content but visible
|
this.canvas.style.zIndex = '-10';
|
||||||
this.canvas.style.pointerEvents = 'none';
|
this.canvas.style.pointerEvents = 'none';
|
||||||
this.canvas.style.opacity = '1'; // Force visibility
|
this.canvas.style.opacity = '1';
|
||||||
this.canvas.style.transition = 'opacity 3.5s ease-in-out'; // Längere Übergangsanimation (von 1.5s auf 3.5s)
|
this.canvas.style.transition = 'opacity 3.5s ease-in-out';
|
||||||
|
|
||||||
// If canvas already exists, remove it first
|
// Falls Canvas bereits existiert, entfernen
|
||||||
const existingCanvas = document.getElementById('neural-network-background');
|
const existingCanvas = document.getElementById('neural-network-background');
|
||||||
if (existingCanvas) {
|
if (existingCanvas) {
|
||||||
existingCanvas.remove();
|
existingCanvas.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// An body anhängen als erstes Kind
|
||||||
// Append to body as first child to ensure it's behind everything
|
// Append to body as first child to ensure it's behind everything
|
||||||
if (document.body.firstChild) {
|
if (document.body.firstChild) {
|
||||||
document.body.insertBefore(this.canvas, document.body.firstChild);
|
document.body.insertBefore(this.canvas, document.body.firstChild);
|
||||||
|
|||||||
Reference in New Issue
Block a user