let txnhash = "bf405B2388q2a01gcvf1v651C3ft4622cHr9vWf3b70gb0d5n2e9baf01avdf2c7"; let dynamo = 1; let increment = true; // Variabile per tracciare se stiamo incrementando o decrementando let powerup = true; // Variabile per tracciare lo stato del powerup let powerupX, powerupY; // Coordinate del powerup let selectedRectType; let selectedDiskType; let rectPercentage = 0.3; // 50% per rect let smallRectPercentage = 0.7; // 50% per small rect let diskPercentage = 0.99; // 50% per disk let ssdPercentage = 0.99; // 50% per SSD let powerupProfiles = [ { type: 'virus', baseSize: 140, maxOffset: 80, probability: 0.10 // 50% di probabilità }, { type: 'virus', baseSize: 60, maxOffset: 40, probability: 0.20 // 50% di probabilità }, { type: 'additionalCPU', baseSize: 140, maxOffset: 30, probability: 0.20 // 50% di probabilità }, { type: 'additionalCPU', baseSize: 200, maxOffset: 30, probability: 0.20 // 50% di probabilità }, { type: 'overclock', baseSize: 50, maxOffset: 50, probability: 0.30 // 50% di probabilità } ]; let powerupX1, powerupY1, powerupX2, powerupY2; let selectedPowerupProfile = powerupProfiles[0]; // Default to virus profile function updateDynamo(value) { dynamo = parseInt(value); document.getElementById('dynamoValue').innerText = dynamo; } // Funzione per modificare automaticamente il valore di dynamo let capacitors = []; let capacitorProfiles = [ { count: 32, radius: 60, horizontalSpacing: 1, verticalSpacing: 1, numCircles: 3, animationSpeed: 0.02, rows: 4, // Numero di righe cols: 3, // Numero di colonne probability: 0.18 // 30% di probabilità }, { count: 32, radius: 130, horizontalSpacing: 1, verticalSpacing: 1, numCircles: 3, animationSpeed: 0.02, rows: 5, // Numero di righe cols: 2, // Numero di colonne probability: 0.18 // 30% di probabilità }, { count: 32, radius: 200, horizontalSpacing: 1, verticalSpacing: 1, numCircles: 4, animationSpeed: 0.02, rows: 3, // Numero di righe cols: 2, // Numero di colonne probability: 0.2 // 30% di probabilità }, { count: 32, radius: 40, horizontalSpacing: 3, verticalSpacing: 1, numCircles: 3, animationSpeed: 0.02, rows: 4, // Numero di righe cols: 5, // Numero di colonne probability: 0.17 // 30% di probabilità }, { count: 32, radius: 350, horizontalSpacing: 1, verticalSpacing: 1, numCircles: 6, animationSpeed: 0.02, rows: 1, // Numero di righe cols: 1, // Numero di colonne probability: 0.03 // 30% di probabilità }, { count: 32, radius: 250, horizontalSpacing: 1, verticalSpacing: 1, numCircles: 5, animationSpeed: 0.02, rows: 2, // Numero di righe cols: 2, // Numero di colonne probability: 0.07 // 30% di probabilità }, { count: 32, radius: 40, horizontalSpacing: 3, verticalSpacing: 1, numCircles: 2, animationSpeed: 0.02, rows: 6, // Numero di righe cols: 3, // Numero di colonne probability: 0.17 // 30% di probabilità }, // Aggiungi altri profili secondo necessità ]; let dataTextProfiles = [ { probability: 1, // Probabilità di apparizione textColor: [255, 255, 255], // Colore del testo (bianco di default) corner: 'top-left' // Posizione (può essere 'top-left', 'top-right', 'bottom-left', 'bottom-right') } ]; let dataTextVisible = false; let nextDataTextToggleTime = 0; let dataTextValues = { "average_fee": 0, "average_fee_rate": 0, "bits": 486604799, "chainwork": "00000000000100010001", "confirmations": 0, "difficulty": 0.0, "hash": "0x19d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f", "feerate_percentiles": [0, 0, 0, 0, 0], "height": 0, "max_fee": 0, "max_fee_rate": 0, "max_tx_size": 0, "median_fee": 0, "median_time": 1231006505, "merkle_root": "000000000000000000", "min_fee": 0, "min_fee_rate": 0, "next_block": null, "nonce": 0, "previous_block": null, "subsidy": 5000000000, "target": "00000000ffff000000000000", "timestamp": 0, "total_fee": 0, "total_size": 0, "total_weight": 0, "transaction_count": 0, "version": 0 }; let selectedDataTextProfile; let showDataText = false; let dataTextUpdateInterval = 500; // Intervallo di aggiornamento in millisecondi let lastDataTextUpdateTime = 0; let quanticRects = []; let quanticCenterX, quanticCenterY; let alphaValue = 200; let lastGradientUpdateTime = 0; let gradientUpdateInterval = 100; let minLightDistance = 50; // Distanza minima tra le luci let selectedLightProfile; let selectedRectAltProfile; let selectedTextProfile; let selectedQuanticProfile; let speedFactor; let baseSpeed; let diskRadius = 45; let diskX, diskY; let diskRotationSpeed = 0.05; let diskAngle = 30; let diskCircles = 0; let rectSize = 30; // Initial size of the rectangle let rectMaxSize = 150; // Maximum size of the rectangle let spRam = 0.3; // Animation speed and rhythm for the RAM let rectX, rectY; let screenWidth = 200; let screenHeight = 100; let screenX, screenY; let useQuantic; let selectedDisquanticProfile; let quanticProfiles = [ { maxDimension: 200, baseSpeed: 0.1, type: 'quantic', probability: 0.2 }, { maxDimension: 250, baseSpeed: 0.1, type: 'quantic', probability: 0.2 }, { maxDimension: 300, baseSpeed: 0.1, type: 'quantic', probability: 0.3 }, { maxDimension: 350, baseSpeed: 0.1, type: 'quantic', probability: 0.25 }, { maxDimension: 420, baseSpeed: 0.1, type: 'quantic', probability: 0.05 } ]; let disquanticProfiles = [ { maxDimension: 270, baseSpeed: 0.1, type: 'disquantic', probability: 0.2 }, { maxDimension: 420, baseSpeed: 0.1, type: 'disquantic', probability: 0.4 }, { maxDimension: 350, baseSpeed: 0.1, type: 'disquantic', probability: 0.4 } ]; let profiles = [ { rows: 2, cols: 2, probability: 0.15 }, // 4 squares, 2x2 { rows: 3, cols: 3, probability: 0.22 }, // 9 squares, 3x3 { rows: 4, cols: 4, probability: 0.21 }, // 16 squares, 4x4 { rows: 8, cols: 8, probability: 0.14 }, // 64 squares, 8x8 { rows: 10, cols: 10, probability: 0.06 }, // 100 squares, 10x10 { type: 'none', probability: 0.21 } // 10% chance of no profile ]; let animationSizes = [ { size: 150, probability: 0.24 }, { size: 200, probability: 0.33 }, { size: 300, probability: 0.33 }, { size: 350, probability: 0.1 } ]; let diskProfiles = [ { radius:150, rotationSpeed: 0.99, angle: 45, probability: 0.12, circles: 60, type: 'original' }, { radius: 200, rotationSpeed: 0.99, angle: 30, probability: 0.13, circles: 70, type: 'original' }, { radius: 200, rotationSpeed: 0.99, angle: 30, probability: 0.12, circles: 45, type: 'original' }, { radius: 150, rotationSpeed: 0.99, angle: 30, probability: 0.13, circles: 45, type: 'original' }, { radius: 40, angle: 45, probability: 0.11, type: 'new', numCircles: 1.6, // Number of concentric circles circleRotationSpeed: 0.3, // Rotation speed of each circle totalSize: 500, // Total size of the disk circleThickness: 4.9, // Thickness of concentric circles circleSpacing: 40 // Increased spacing between concentric circles }, { radius: 40, angle: 45, probability: 0.11, type: 'new', numCircles: 3.6, // Number of concentric circles circleRotationSpeed: 0.4, // Rotation speed of each circle totalSize: 500, // Total size of the disk circleThickness: 2.9, // Thickness of concentric circles circleSpacing: 40 // Increased spacing between concentric circles }, { radius: 40, angle: 45, probability: 0.13, type: 'new', numCircles: 3.2, // Number of concentric circles circleRotationSpeed: 0.1, // Rotation speed of each circle totalSize: 500, // Total size of the disk circleThickness: 4.9, // Thickness of concentric circles circleSpacing: 30 // Increased spacing between concentric circles }, { radius: 40, angle: 45, probability: 0.15, type: 'new', numCircles: 2.2, // Number of concentric circles circleRotationSpeed: 0.14, // Rotation speed of each circle totalSize: 500, // Total size of the disk circleThickness: 4.9, // Thickness of concentric circles circleSpacing: 20 // Increased spacing between concentric circles }, ]; let canvasSize = 1024; let selectedProfile; let selectedAnimationSize; let selectedBackgroundProfile; let selectedColorProfile; let offsetX, offsetY; let lastBackgroundUpdateTime = 0; let backgroundUpdateInterval = 100; let backgroundProfiles = [ { type: 'gradient', probability: 0.3 }, { type: 'diagonal', probability: 0.6 }, { type: 'dynamic', probability: 0.3 } ]; let colorProfiles = [ { //WB background1: [80, 80, 80], background2: [30, 30, 30], background3: [220, 220, 220], squareColor1: [195, 195, 195], squareColor2: [170, 175, 160], squareColor3: [210, 200, 205], rectColor1: [145, 145, 145], rectColor2: [150, 150, 150], rectColor3: [100, 100, 100], diskColor1: [170, 170, 170], // Darker green tone 1 diskColor2: [170, 170, 170], // Darker green tone 2 diskColor3: [170, 170, 170], // Darker green tone 3 screenBackground: [200, 200, 200], screenText: [90, 90, 90], smallRectColor1: [50, 50, 50], // Small rectangle color 1 smallRectColor2: [230, 230, 230], // Small rectangle color 2 smallRectColor3: [130, 130, 130], // Small rectangle color 3 corniceIntColor1: [30, 30, 30], // Corniceint layer color 1 corniceIntColor2: [45, 45, 45], // Corniceint layer color 2 corniceIntColor3: [20, 20, 20], // Corniceint layer color 3 lightColor1: [60, 60, 60], // Light layer color 1 lightColor2: [110, 110, 110], // Light layer color 2 lightColor3: [80, 80, 80], // Light layer color 3 gradientStart: [160, 160, 160], gradientEnd: [255, 255, 255], textColor: [180, 180, 180], // Colore del testo powerupColor1: [155, 150, 150], powerupColor2: [150, 155, 150], powerupColor3: [150, 150, 155], virus1: [250, 50, 70], virus2: [250, 50, 70], virus3: [250, 50, 70], strokeVirus: [235, 50, 0], additionalCPU1: [150, 185, 230, 100], additionalCPU2: [145, 195, 240, 100], additionalCPU3: [150, 1215, 250, 100], strokeaddCPU: [30, 130, 40], strokeAdditionalCPU: [10, 150, 40], probability: 0.18 }, // Nuovo profilo 3 { //Pop background1: [93, 75, 10], background2: [73, 55, 5], background3: [233, 195, 90], squareColor1: [230, 195, 40], squareColor2: [245, 152, 12], squareColor3: [210, 100, 35], rectColor1: [237, 190, 80], rectColor2: [220, 160, 80], rectColor3: [200, 150, 60], diskColor1: [40, 120, 0], // Bright green diskColor2: [40, 120, 0], // Slightly darker green diskColor3: [0, 155, 0], // Even darker green screenBackground: [237, 195, 90], screenText: [33, 41, 74], // Bright green text smallRectColor1: [0, 255, 0], // Bright green smallRectColor2: [0, 200, 0], // Slightly darker green smallRectColor3: [0, 150, 0], // Even darker green corniceIntColor1: [41, 59, 89], // Dark green corniceIntColor2: [33, 41, 74], // Darker green corniceIntColor3: [5, 12, 14], // Darkest green lightColor1: [20, 95, 60], // Bright green light lightColor2: [20, 120, 20], // Slightly darker green light lightColor3: [50, 130, 40], // Even darker green light gradientStart: [255, 185, 0], // Giallo gradientEnd: [255, 185, 0], textColor: [245, 150, 20], // Rosso meno saturo virus1: [155, 15, 20], virus2: [150, 15, 15], virus3: [150, 15, 15], strokeVirus: [255, 18, 0], additionalCPU1: [255, 180, 200], additionalCPU2: [240, 170, 180], additionalCPU3: [200, 200, 190], strokeaddCPU: [30, 130, 40], strokeAdditionalCPU: [10, 150, 40], probability: 0.13 }, { // XFX Green Black background1: [20, 30, 20], // Nero background2: [20, 20, 20], // Grigio molto scuro background3: [98, 140, 40], // Nero squareColor1: [193, 216, 110], // Verde scuro squareColor2: [98, 140, 40], // Verde scuro intermedio squareColor3: [98, 140, 40], // Verde chiaro rectColor1: [120, 170, 80], // Nero rectColor2: [193, 216, 110], // Grigio molto scuro rectColor3: [98, 140, 40], // Grigio scuro diskColor1: [98, 140, 40], // Verde scuro diskColor2: [98, 140, 40], // Verde scuro intermedio diskColor3: [193, 216, 110], // Verde chiaro screenBackground: [25, 25, 25], // Nero screenText: [98, 140, 40], // Verde chiaro smallRectColor1: [98, 140, 40], // Verde scuro smallRectColor2: [193, 216, 110], // Verde chiaro smallRectColor3: [98, 140, 40], // Nero corniceIntColor1: [20, 20, 20], // Nero corniceIntColor2: [39, 25, 24], // Grigio molto scuro corniceIntColor3: [30, 30, 30], // Grigio scuro lightColor1: [170, 161, 166], // Verde intermedio lightColor2: [98, 140, 40], // Verde chiaro lightColor3: [193, 216, 110], // Verde scuro gradientStart: [98, 140, 40], // Nero gradientEnd: [98, 140, 40], // Grigio scuro textColor: [193, 216, 110], // Colore del testo virus1: [255, 150, 50], virus2: [250, 155, 50], virus3: [250, 150, 55], strokeVirus: [225, 90, 0], additionalCPU1: [120, 100, 170], additionalCPU2: [100, 150, 180], additionalCPU3: [150, 120, 160], strokeaddCPU: [30, 130, 40], strokeAdditionalCPU: [70, 150, 240], probability: 0.18 }, { //Black Yellow background1: [60, 40, 0], // Nero scuro background2: [70, 50, 0], // Grigio molto scuro background3: [120, 110, 00], // Grigio molto scuro squareColor1: [200, 130, 10], // Grigio scuro squareColor2: [215, 195, 40], // Grigio medio scuro squareColor3: [215, 115, 20], // Grigio rectColor1: [160, 90, 0], // Grigio scuro rectColor2: [170, 120, 0], // Grigio medio rectColor3: [180, 110, 0], // Grigio chiaro diskColor1: [225, 185, 0], // Grigio scuro diskColor2: [155, 115, 0], // Grigio intermedio diskColor3: [225, 185, 10], // Grigio chiaro screenBackground: [25, 25, 25], // Nero scuro screenText: [255, 215, 0], // Giallo smallRectColor1: [190, 80, 0], // Grigio scuro smallRectColor2: [220, 140, 0], // Grigio chiaro smallRectColor3: [205, 125, 0], // Grigio chiaro corniceIntColor1: [40, 40, 40], // Grigio scuro corniceIntColor2: [50, 50, 50], // Grigio medio corniceIntColor3: [60, 60, 60], // Grigio chiaro lightColor1: [255, 215, 0], // Giallo chiaro lightColor2: [230, 185, 30], // Giallo lightColor3: [220, 165, 60], // Giallo chiaro gradientStart: [255, 215, 0], // Nero gradientEnd: [255, 175, 10], // Grigio molto scuro textColor: [255, 215, 0], // Colore del testo virus1: [255, 50, 50], virus2: [250, 55, 50], virus3: [250, 50, 55], strokeVirus: [235, 0, 0], additionalCPU1: [110, 190, 220], additionalCPU2: [60, 180, 220], additionalCPU3: [70, 170, 230], strokeaddCPU: [30, 130, 40], strokeAdditionalCPU: [10, 150, 240], probability: 0.13 }, {//rcs background1: [5, 6, 21], // Nero molto scuro background2: [15, 16, 41], // Nero molto scuro background3: [155, 76, 160], // Nero molto scuro squareColor1: [159, 74, 181], // Viola scuro squareColor2: [190, 71, 162], // Viola intenso squareColor3: [246, 71, 162], // Rosa brillante rectColor1: [140, 220, 162], // Rosa brillante rectColor2: [159, 244, 181], // Verde chiaro rectColor3: [58, 124, 104], // Viola intenso diskColor1: [123, 36, 81], // Viola scuro diskColor2: [123, 36, 81], // Rosa brillante diskColor3: [123, 36, 81], // Viola intenso screenBackground: [40, 25, 51], // Nero molto scuro screenText: [79, 122, 90], // Verde chiaro smallRectColor1: [40, 25, 51], // Viola scuro smallRectColor2: [246, 71, 162], // Rosa brillante smallRectColor3: [58, 24, 104], // Viola intenso corniceIntColor1: [5, 6, 21], // Rosa brillante corniceIntColor2: [40, 25, 51], // Viola scuro corniceIntColor3: [58, 24, 104], // Viola intenso lightColor1: [123, 36, 81], // Rosa brillante lightColor2: [79, 122, 90], // Verde chiaro lightColor3: [58, 24, 80], // Viola intenso gradientStart: [79, 122, 90], // Nero molto scuro gradientEnd: [159, 244, 181], // Viola scuro textColor: [159, 244, 181], // Verde chiaro virus1: [255, 255, 255], virus2: [255, 255, 255], virus3: [255, 255, 255], strokeVirus: [235, 0, 0], additionalCPU1: [255, 255, 255], additionalCPU2: [255, 255, 255], additionalCPU3: [255, 255, 255], strokeaddCPU: [130, 180, 210], strokeAdditionalCPU: [30, 150, 210], probability: 0.1 }, { // Firewood background1: [185, 112, 25], // "#21322a" convertito in RGB background2: [92, 60, 12], // "#21322a" convertito in RGB background3: [185, 112, 25], // "#21322a" convertito in RGB squareColor1: [200, 87, 11], // "#f0570b" convertito in RGB squareColor2: [202, 98, 11], // "#fc620b" convertito in RGB squareColor3: [205, 119, 30], // "#ff771e" convertito in RGB rectColor1: [205, 112, 25], // "#ff9a3f" convertito in RGB rectColor2: [205, 112, 25], // "#ff9840" convertito in RGB rectColor3: [205, 112, 25], // "#c33a00" convertito in RGB diskColor1: [205, 112, 25], // "#ff7019" convertito in RGB diskColor2: [205, 119, 30], // "#ff771e" convertito in RGB diskColor3: [202, 98, 11], // "#fc620b" convertito in RGB screenBackground: [33, 50, 42], // "#21322a" convertito in RGB screenText: [255, 112, 25], // "#ff7019" convertito in RGB smallRectColor1: [255, 154, 63], // "#ff771e" convertito in RGB smallRectColor2: [205, 112, 25], // "#fc620b" convertito in RGB smallRectColor3: [195, 119, 42], // "#c33a00" convertito in RGB corniceIntColor1: [33, 50, 42], // "#ff9a3f" convertito in RGB corniceIntColor2: [22, 40, 32], // "#ff7019" convertito in RGB corniceIntColor3: [33, 52, 42], // "#ff771e" convertito in RGB lightColor1: [240, 87, 11], // "#f0570b" convertito in RGB lightColor2: [252, 98, 11], // "#fc620b" convertito in RGB lightColor3: [255, 119, 30], // "#ff771e" convertito in RGB gradientStart: [180, 87, 11], // "#f0570b" convertito in RGB gradientEnd: [205, 112, 25], // "#ff7019" convertito in RGB textColor: [205, 112, 25], // "#ff7019" convertito in RGB virus1: [200, 200, 200], virus2: [210, 210, 210], virus3: [180, 180, 2180], strokeVirus: [235, 0, 0], additionalCPU1: [120, 100, 100], additionalCPU2: [100, 150, 80], additionalCPU3: [150, 120, 60], strokeaddCPU: [30, 130, 40], strokeAdditionalCPU: [10, 150, 40], probability: 0.18 }, { name: 'allBlack', // Nome del profilo colore tutto nero background1: [10, 10, 10], // "#21322a" convertito in RGB background2: [10, 10, 10], // "#21322a" convertito in RGB background3: [10, 10, 10], // "#21322a" convertito in RGB squareColor1: [0, 0, 0], // "#f0570b" convertito in RGB squareColor2: [0, 0, 0], // "#fc620b" convertito in RGB squareColor3: [0, 0, 0], // "#ff771e" convertito in RGB rectColor1: [0, 0, 0], // "#ff9a3f" convertito in RGB rectColor2: [0, 0, 0], // "#ff9840" convertito in RGB rectColor3: [0, 0, 0], // "#c33a00" convertito in RGB diskColor1: [0, 0, 0], // "#ff7019" convertito in RGB diskColor2: [0, 0, 0], // "#ff771e" convertito in RGB diskColor3: [0, 0, 0], // "#fc620b" convertito in RGB screenBackground: [0, 0, 0], // "#21322a" convertito in RGB screenText: [0, 0, 0], // "#ff7019" convertito in RGB smallRectColor1: [0, 0, 0], // "#ff771e" convertito in RGB smallRectColor2: [0, 0, 0], // "#fc620b" convertito in RGB smallRectColor3: [0, 0, 0], // "#c33a00" convertito in RGB corniceIntColor1: [0, 0, 0], // "#ff9a3f" convertito in RGB corniceIntColor2: [0, 0, 0], // "#ff7019" convertito in RGB corniceIntColor3: [0, 0, 0], // "#ff771e" convertito in RGB lightColor1: [0, 0, 0], // "#f0570b" convertito in RGB lightColor2: [0, 0, 0], // "#fc620b" convertito in RGB lightColor3: [0, 0, 0], // "#ff771e" convertito in RGB gradientStart: [0, 0, 0], // "#f0570b" convertito in RGB gradientEnd: [0, 0, 0], // "#ff7019" convertito in RGB textColor: [0, 0, 0], // "#ff7019" convertito in RGB virus1: [0, 0, 0], virus2: [0, 0, 0], virus3: [0, 0, 0], strokeVirus: [235, 0, 0], additionalCPU1: [0, 0, 0], additionalCPU2: [0, 0, 0], additionalCPU3: [0, 0, 0], strokeaddCPU: [0, 0, 0], strokeAdditionalCPU: [10, 150, 40], probability: 0.01 // Regola la probabilità in base alle tue esigenze }, { //arctic background1: [69, 83,110], // #e6eff7 background2: [36, 64, 84], // #ecf7fb background3: [69, 83, 109], // #ecf7fb squareColor1: [188, 205, 211], // #bccdd3 squareColor2: [193, 207, 220], // #c1cfde squareColor3: [166, 184, 194], // #a6b8c2 rectColor1: [147, 167, 186], // #93a7ba rectColor2: [102, 124, 153], // #7a90ad rectColor3: [117, 139, 168], // #758ba8 diskColor1: [102, 126, 153], // #667e99 diskColor2: [125, 142, 168], // #4b6680 diskColor3: [117, 139, 168], // #2f477f screenBackground: [69, 83, 109], // #ecf7fb screenText: [206, 212, 224], // #244054 smallRectColor1: [193, 207, 220], // #c1cfde smallRectColor2: [166, 184, 194], // #a6b8c2 smallRectColor3: [147, 167, 186], // #93a7ba corniceIntColor1: [122, 144, 173], // #7a90ad corniceIntColor2: [117, 139, 168], // #758ba8 corniceIntColor3: [102, 126, 153], // #667e99 lightColor1: [188, 205, 211], // #bccdd3 lightColor2: [166, 184, 194], // #a6b8c2 lightColor3: [147, 167, 186], // #93a7ba gradientStart: [236, 247, 251], // #ecf7fb gradientEnd: [255, 255, 255], // #244054 textColor: [36, 64, 84], // #244054 virus1: [250, 160, 160], // #c1cfde virus2: [250, 170, 170], // #a6b8c2 virus3: [250, 180, 180], // #93a7ba strokeVirus: [255, 120, 140], // #4b6680 additionalCPU1: [160, 230, 160], // #bccdd3 additionalCPU2: [180, 123084, 180], // #a6b8c2 additionalCPU3: [200, 230, 200], // #93a7ba strokeAdditionalCPU: [140, 230, 140], // #2f477f probability: 0.09 } ]; let lightProfiles = [ { width: 50, height: 60, animationSpeed: 10, rows: 2, cols: 3, horizontalSpacing: 170, // Spaziatura orizzontale verticalSpacing: 40, // Spaziatura verticale density: 4, // Densità probability: 0.99, }, { width: 26, height: 15, animationSpeed: 10, rows: 4, cols: 6, horizontalSpacing: 100, // Spaziatura orizzontale verticalSpacing: 15, // Spaziatura verticale density: 4, // Densità probability: 0.25, }, { width: 20, height: 15, animationSpeed: 10, rows: 5, cols: 7, horizontalSpacing:70, // Spaziatura orizzontale verticalSpacing: 10, // Spaziatura verticale density: 4, // Densità probability: 0.25, }, { width: 50, height: 25, animationSpeed: 10, rows: 3, cols: 4, horizontalSpacing: 150, // Spaziatura orizzontale verticalSpacing: 20, // Spaziatura verticale density: 4, // Densità probability: 0.25, }, { width: 50, height: 40, animationSpeed: 10, rows: 3, cols: 4, horizontalSpacing: 150, // Spaziatura orizzontale verticalSpacing: 20, // Spaziatura verticale density: 4, // Densità probability: 0.25, } ]; let rectProfiles = [ { count: 2, probability: 0.65 }, // 2 rectangles ]; let ssdProfiles = [ { count: 9, width: 20, height: 30, lineSpacing: 10, rectAngle: 0, ssdRotation: 0, animationSpeed: 0.1, rows: 3, // Numero di righe columns: 3, // Numero di colonne spacing: 120, // Spaziatura tra SSD ordered: true, // Disposizione ordinata probability: 0.1 }, { count: 2, width: 90, height: 80, lineSpacing: 10, rectAngle: 0, ssdRotation: 90, animationSpeed: 0.1, rows: 1, // Numero di righe columns: 1, // Numero di colonne spacing: 50, // Spaziatura tra SSD ordered: true, // Disposizione ordinata probability: 0.1 }, { count: 2, width: 90, height: 80, lineSpacing: 10, rectAngle: 0, ssdRotation: 0, animationSpeed: 0.1, rows: 1, // Numero di righe columns: 2, // Numero di colonne spacing: 50, // Spaziatura tra SSD ordered: true, // Disposizione ordinata probability: 0.1 }, { count: 6, width: 40, height: 60, lineSpacing: 10, rectAngle: 0, ssdRotation: 0, animationSpeed: 0.1, rows: 3, // Numero di righe columns: 2, // Numero di colonne spacing: 50, // Spaziatura tra SSD ordered: true, // Disposizione ordinata probability: 0.12 }, { count: 6, width: 60, height: 60, lineSpacing: 10, rectAngle: 0, ssdRotation: 0, animationSpeed: 0.1, rows: 2, // Numero di righe columns: 3, // Numero di colonne spacing: 50, // Spaziatura tra SSD ordered: true, // Disposizione ordinata probability: 0.12 }, { count: 6, width: 45, height: 60, lineSpacing: 10, rectAngle: 0, ssdRotation: 90, animationSpeed: 0.1, rows: 3, // Numero di righe columns: 2, // Numero di colonne spacing: 50, // Spaziatura tra SSD ordered: true, // Disposizione ordinata probability: 0.12 }, { count: 3, width: 50, height: 40, lineSpacing: 10, rectAngle: 0, ssdRotation: 0, animationSpeed: 0.1, rows: 2, // Numero di righe columns: 3, // Numero di colonne spacing: 100, // Spaziatura tra SSD ordered: true, // Disposizione ordinata probability: 0.12 }, { count: 3, width: 50, height: 40, lineSpacing: 10, rectAngle: 0, ssdRotation: 90, animationSpeed: 0.1, rows: 2, // Numero di righe columns: 3, // Numero di colonne spacing: 80, // Spaziatura tra SSD ordered: true, // Disposizione ordinata probability: 0.12 } ]; let rectAltProfiles = [ { count: 4, width: 220, height: 45, spacing: 30, animationSpeed: 0.03, rotation: 0, // Nuovo parametro di rotazione probability: 0.1 }, { count: 6, width: 250, height: 35, spacing: 20, animationSpeed: 0.03, rotation: 0, // Nuovo parametro di rotazione probability: 0.1 }, { count: 3, width: 300, height: 20, spacing: 40, animationSpeed: 0.01, rotation: 0, // Nuovo parametro di rotazione probability: 0.1 }, { count: 5, width: 220, height: 25, spacing: 35, animationSpeed: 0.04, rotation: 0, // Nuovo parametro di rotazione probability: 0.15 }, { count: 4, width: 220, height: 45, spacing: 30, animationSpeed: 0.03, rotation: 270, // Nuovo parametro di rotazione probability: 0.1 }, { count: 6, width: 250, height: 35, spacing: 20, animationSpeed: 0.03, rotation: 270, // Nuovo parametro di rotazione probability: 0.1 }, { count: 3, width: 300, height: 20, spacing: 40, animationSpeed: 0.01, rotation: 270, // Nuovo parametro di rotazione probability: 0.1 }, { count: 5, width: 220, height: 25, spacing: 35, animationSpeed: 0.04, rotation: 270, // Nuovo parametro di rotazione probability: 0.15 }, { count: 10, width: 160, height: 20, spacing: 20, animationSpeed: 0.03, rotation: 0, // Nuovo parametro di rotazione probability: 0.05 }, { count: 10, width: 160, height: 20, spacing: 20, animationSpeed: 0.03, rotation: 270, // Nuovo parametro di rotazione probability: 0.05 } ]; let textProfiles = [ { type: 'binary', characters: '01', probability: 0.4 }, { type: 'zeros', characters: '0', probability: 0.2 }, { type: 'ascii', characters: '!@#$%^&*()_+[]{}|;:,.<>?/~', probability: 0.2 }, { type: 'alphanumeric', characters: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', probability: 0.2 } ]; let corniceProfiles = [ { type: 'fourSquares', probability: 0.15 }, { type: 'default', probability: 0.7 }, { type: 'diagonalStrip', probability: 0.15 } ]; let screenProfiles = [ { width: 350, height: 200, textSize: 10, probability: 0.99 }, { width: 220, height: 140, textSize: 14, probability: 0.00993 }, { width: 300, height: 150, textSize: 24, probability: 0.0099 } ]; function hashToSeed(txnhash) { let seed = 0; for (let i = 0; i < txnhash.length; i++) { let charCode = txnhash.charCodeAt(i); seed = (seed * 16 + charCode) % 2147483647; } return seed; } let selectedScreenProfile; let selectedCorniceProfile; let selectedRectProfile; let smallRects = []; let lights = []; let hdssd; let smallRectProfiles = [ { type: 'ordered', count: 6, // Numero totale di small rects width: 100, height: 35, rows: 3, cols: 2, horizontalSpacing: 55, verticalSpacing: 40, probability: 0.15 }, { type: 'ordered', count: 2, // Numero totale di small rects width: 190, height: 60, rows: 2, cols: 1, horizontalSpacing: 55, verticalSpacing: 40, probability: 0.15 }, { type: 'ordered', count: 2, // Numero totale di small rects width: 190, height: 60, rows: 2, cols: 1, horizontalSpacing: 55, verticalSpacing: 40, probability: 0.1 }, { type: 'ordered', count: 8, // Numero totale di small rects width: 130, height: 40, rows: 4, cols: 2, horizontalSpacing: 55, verticalSpacing: 40, probability: 0.15 }, { type: 'ordered', count: 8, // Numero totale di small rects width: 60, height: 20, rows: 4, cols: 2, horizontalSpacing: 35, verticalSpacing: 30, probability: 0.15 }, { type: 'ordered', count: 4, // Numero totale di small rects width: 80, height: 30, rows: 2, cols: 2, horizontalSpacing: 55, verticalSpacing: 20, probability: 0.15 }, { type: 'ordered', count: 6, // Numero totale di small rects width: 40, height: 20, rows: 2, cols: 3, horizontalSpacing: 45, verticalSpacing: 10, probability: 0.15 }, ]; function setup() { createCanvas(canvasSize, canvasSize); frameRate(30); let currentSeed = hashToSeed(txnhash); randomSeed(currentSeed); speedFactor = random(1, 10); baseSpeed = random(1, 10); selectedProfile = selectProfile(); selectedAnimationSize = selectAnimationSize(); selectedBackgroundProfile = selectBackgroundProfile(); selectedColorProfile = selectColorProfile(); selectedCorniceProfile = selectCorniceProfile(); selectedRectAltProfile = selectRectAltProfile(); selectedTextProfile = selectTextProfile(); selectedScreenProfile = selectScreenProfile(); selectedQuanticProfile = selectQuanticProfile(); selectedDisquanticProfile = selectDisquanticProfile(); selectedPowerupProfile = selectPowerupProfile(); selectedCapacitorProfile = selectCapacitorProfile(); selectedRectType = selectRectOrSmallRect(); selectedDiskType = selectDiskOrSSD(); useQuantic = random() < 0.5; offsetX = random(0.1 * canvasSize, canvasSize - selectedAnimationSize - 0.1 * canvasSize); offsetY = random(0.1 * canvasSize, canvasSize - selectedAnimationSize - 0.1 * canvasSize); if (selectedProfile.type !== 'none') { selectedProfile.squareSize = selectedAnimationSize / selectedProfile.cols; } if (selectedProfile.type === 'none') { let margin = 0.3 * canvasSize; // Definisce il margine per escludere le zone esterne quanticCenterX = random(0.35 * canvasSize, 0.65 * canvasSize); quanticCenterY = random(0.35 * canvasSize, 0.65 * canvasSize); for (let i = 0; i < 10; i++) { quanticRects.push({ width: random(50, 150), height: random(50, 150), angle: random(0, TWO_PI) }); } } let maxRectWidth = rectMaxSize * 2; let maxRectHeight = (rectMaxSize / 4) * 3; do { rectX = random(0, canvasSize - maxRectWidth); rectY = random(0, canvasSize - maxRectHeight); } while (isInsideSquareArea(rectX, rectY, maxRectWidth, maxRectHeight)); generateScreenPosition(); generateDiskPosition(); generateSmallRects(); generateLights(); generateHdssd(); generateCapacitors(); selectedDiskProfile = selectDiskProfile(); diskRadius = selectedDiskProfile.radius; diskRotationSpeed = selectedDiskProfile.rotationSpeed; diskAngle = selectedDiskProfile.angle; diskCircles = selectedDiskProfile.circles || 0; generateRectAltPosition(); selectedDataTextProfile = selectDataTextProfile(); showDataText = random() < selectedDataTextProfile.probability; powerupX1 = random(0.1 * canvasSize, canvasSize - 0.1 * canvasSize); powerupY1 = random(0.1 * canvasSize, canvasSize - 0.1 * canvasSize); powerupX2 = random(0.1 * canvasSize, canvasSize - 0.1 * canvasSize); powerupY2 = random(0.1 * canvasSize, canvasSize - 0.1 * canvasSize); nextDataTextToggleTime = millis() + random(1000, 3000); } function draw() { if (selectedBackgroundProfile.type === 'dynamic') { let currentBackgroundColor = updateDynamicBackgroundColors(); background(currentBackgroundColor); } else if (selectedBackgroundProfile.type === 'gradient') { let background1 = selectedColorProfile.background1; let background2 = selectedColorProfile.background2; setGradient(0, 0, width, height, background1, background2); } else if (selectedBackgroundProfile.type === 'diagonal') { drawDiagonalBackground(selectedColorProfile); } drawCorniceInt(); drawCapacitors(); if (dataTextVisible) { drawDataText(); } drawHdssd(); rectAlt(); drawLights(); if (selectedProfile && selectedProfile.type !== 'none') { let gridSpacingX = selectedProfile.squareSize + 5; let gridSpacingY = selectedProfile.squareSize + 5; let cols = selectedProfile.cols; let rows = selectedProfile.rows; for (let col = 0; col < cols; col++) { for (let row = 0; row < rows; row++) { let x = offsetX + col * gridSpacingX + random(-1, 1); let y = offsetY + row * gridSpacingY + random(-1, 1); drawGroup(x, y, selectedProfile.squareSize); } } } else if (selectedProfile && selectedProfile.type === 'none') { if (useQuantic) { drawQuantic(); } else { drawDisquantic(); } } // Selezione tra rect e small rect if (selectedRectType === 'rect') { drawAnimatedRectangle(); } else if (selectedRectType === 'smallRect') { drawSmallRects(); } // Selezione tra disk e SSD if (selectedDiskType === 'disk') { drawDisk(); } else if (selectedDiskType === 'SSD') { drawHdssd(); } drawScreen(); if (millis() > nextDataTextToggleTime) { toggleDataTextVisibility(); nextDataTextToggleTime = millis() + random(1000, 3000); } if (powerup) { drawPowerup(); } if (powerup && selectedPowerupProfile.type === 'overclock') { for (let i = 0; i < 3; i++) { // Disegna 3 quadrati let offsetX = random(-selectedPowerupProfile.maxOffset, selectedPowerupProfile.maxOffset); let offsetY = random(-selectedPowerupProfile.maxOffset, selectedPowerupProfile.maxOffset); let colorR = 255 let colorG = 0 let colorB = 0 let dynamicAlpha = 5 + (i * 10); // Aumenta l'alpha di 10 per ogni quadrato blendMode(OVERLAY); fill(colorR, colorG, colorB, dynamicAlpha); // Usa l'alpha dinamico noStroke(); rect(offsetX, offsetY, width * 1.2, height * 1.2); blendMode(BLEND); } } } function selectRectOrSmallRect() { let r = random(1); return r < rectPercentage ? 'rect' : 'smallRect'; } function selectDiskOrSSD() { let r = random(1); return r < diskPercentage ? 'disk' : 'SSD'; } function selectProfile() { let profiles = [ { rows: 2, cols: 2, probability: 0.2 }, // 4 squares, 2x2 { rows: 3, cols: 3, probability: 0.2 }, // 9 squares, 3x3 { rows: 4, cols: 4, probability: 0.2 }, // 16 squares, 4x4 { rows: 8, cols: 8, probability: 0.2 }, // 64 squares, 8x8 { rows: 10, cols: 10, probability: 0.2 } // 100 squares, 10x10 ]; let r = random(1); let sumProbability = 0; for (let profile of profiles) { sumProbability += profile.probability; if (r < sumProbability) { return profile; } } return profiles[0]; } function selectScreenProfile() { let r = random(1); let sumProbability = 0; for (let profile of screenProfiles) { sumProbability += profile.probability; if (r < sumProbability) { return profile; } } return screenProfiles[0]; } function selectCorniceProfile() { let r = random(1); let sumProbability = 0; for (let profile of corniceProfiles) { sumProbability += profile.probability; if (r < sumProbability) { return profile; } } return corniceProfiles[0]; } function selectDisquanticProfile() { let r = random(1); let sumProbability = 0; for (let profile of disquanticProfiles) { sumProbability += profile.probability; if (r < sumProbability) { return profile; } } return disquanticProfiles[0]; } function selectDiskProfile() { let r = random(1); let sumProbability = 0; for (let profile of diskProfiles) { sumProbability += profile.probability; if (r < sumProbability) { return profile; } } return diskProfiles[0]; } function selectSsdProfile() { let r = random(1); let sumProbability = 0; for (let profile of ssdProfiles) { sumProbability += profile.probability; if (r < sumProbability) { return profile; } } return ssdProfiles[0]; } function selectTextProfile() { let r = random(1); let sumProbability = 0; for (let profile of textProfiles) { sumProbability += profile.probability; if (r < sumProbability) { return profile; } } return textProfiles[0]; } function selectQuanticProfile() { let r = random(1); let sumProbability = 0; for (let profile of quanticProfiles) { sumProbability += profile.probability; if (r < sumProbability) { return profile; } } return quanticProfiles[0]; } function selectLightProfile() { let r = random(1); let sumProbability = 0; for (let profile of lightProfiles) { sumProbability += profile.probability; if (r < sumProbability) { return profile; } } return lightProfiles[0]; } function selectRectAltProfile() { let r = random(1); let sumProbability = 0; for (let profile of rectAltProfiles) { sumProbability += profile.probability; if (r < sumProbability) { return profile; } } return rectAltProfiles[0]; } function drawDiagonalBackground(selectedColorProfile) { background(0); let diagonalColor = selectedColorProfile.background3; stroke(diagonalColor); strokeWeight(1); for (let x = 0; x < width; x += 10) { for (let y = 0; y < height; y += 10) { line(x, y, x + 10, y + 10); } } } function drawGroup(x, y, size) { let squareColors = [ selectedColorProfile.squareColor1, selectedColorProfile.squareColor2, selectedColorProfile.squareColor3 ]; drawParallelLines(x, y, size, squareColors); push(); let alpha1 = random(-5, 5); let alpha2 = random(-7, 7); translate(alpha1, alpha1); drawVerticalLines(x, y, size, squareColors); pop(); push(); translate(alpha2, alpha2); drawHorizontalLines(x, y, size, squareColors); pop(); } function drawParallelLines(x, y, size, colors) { let heatColor = getHeatColor(dynamo); let offset = map(dynamo, 1, 10, 0, 8); let outerStrokeWidth = map(dynamo, 1, 10, 1, 4); // Modifica lo spessore delle linee // Linee ombra ai contorni con spessore modificato stroke(heatColor.levels[0], heatColor.levels[1], heatColor.levels[2], alphaValue / 2); strokeWeight(outerStrokeWidth); line(x - offset, y - offset, x + size + offset, y - offset); // Sopra line(x - offset, y + size + offset, x + size + offset, y + size + offset); // Sotto line(x - offset, y - offset, x - offset, y + size + offset); // Sinistra line(x + size + offset, y - offset, x + size + offset, y + size + offset); // Destra // Linee originali strokeWeight(1); // Manteniamo lo spessore fisso per le linee originali for (let i = 0; i < size; i += 2) { stroke(colors[1][0], colors[1][1], colors[1][2], alphaValue); line(x, y + i, x + size, y + i); } } function drawVerticalLines(x, y, size, colors) { let heatColor = getHeatColor(dynamo); let offset = map(dynamo, 1, 10, 0, 10); // Linee ombra ai contorni stroke(heatColor.levels[0], heatColor.levels[1], heatColor.levels[2], alphaValue / 2); strokeWeight(1); line(x - offset, y - offset, x - offset, y + size + offset); // Sinistra line(x + size + offset, y - offset, x + size + offset, y + size + offset); // Destra // Linee originali for (let i = 0; i < size; i += 2) { stroke(colors[2][0], colors[2][1], colors[2][2], alphaValue); line(x + i, y, x + i, y + size); } } function drawHorizontalLines(x, y, size, colors) { let heatColor = getHeatColor(dynamo); let offset = map(dynamo, 1, 10, 0, 10); // Linee ombra ai contorni stroke(heatColor.levels[0], heatColor.levels[1], heatColor.levels[2], alphaValue / 2); strokeWeight(1); line(x - offset, y - offset, x + size + offset, y - offset); // Sopra line(x - offset, y + size + offset, x + size + offset, y + size + offset); // Sotto // Linee originali for (let j = 0; j < size; j += 2) { stroke(colors[0][0], colors[0][1], colors[0][2], alphaValue); line(x, y + j, x + size, y + j); } } function setGradient(x, y, w, h, c1, c2) { noFill(); for (let i = y; i <= y + h; i++) { let inter = map(i, y, y + h, 0, 1); let c = lerpColor(color(c1), color(c2), inter); stroke(c); line(x, i, x + w, i); } } function drawAnimatedRectangle() { selectedRectProfile = selectRectangleProfile(); let rectCount = selectedRectProfile.count; let scaleFactor = sin(frameCount * 0.1) * 0.5 + 0.5; let animatedRectWidth = rectSize + (scaleFactor * (rectMaxSize - rectSize)); let animatedRectHeight = rectSize / 4; let dynamicSpeed = spRam * (1 + dynamo * 0.05); // Incrementa leggermente la velocità in base a dynamo let offsetX = sin(frameCount * dynamicSpeed) * 100; for (let i = 0; i < rectCount; i++) { let x = rectX + offsetX; let y = rectY + (i * (animatedRectHeight + 20)); drawRectGroup(x, y, animatedRectWidth * 2, animatedRectHeight * 3); } } function isInsideSquareArea(x, y, width, height) { let gridSpacingX = selectedProfile.squareSize + 5; let gridSpacingY = selectedProfile.squareSize + 5; let gridWidth = (selectedProfile.cols * gridSpacingX); let gridHeight = (selectedProfile.rows * gridSpacingY); return (x < offsetX + gridWidth && x + width > offsetX) && (y < offsetY + gridHeight && y + height > offsetY); } function isInsideRectArea(x, y, width, height) { let maxRectWidth = rectMaxSize * 2; let maxRectHeight = (rectMaxSize / 4) * 3; return (x < rectX + maxRectWidth && x + width > rectX) && (y < rectY + maxRectHeight && y + height > rectY); } function drawRectGroup(x, y, width, height) { let rectColors = [ selectedColorProfile.rectColor1, selectedColorProfile.rectColor2, selectedColorProfile.rectColor3 ]; drawRectParallelLines(x, y, width, height, rectColors); push(); let alpha1 = random(-5, 5); let alpha2 = random(-7, 7); translate(alpha1, alpha1); drawRectVerticalLines(x, y, width, height, rectColors); pop(); push(); translate(alpha2, alpha2); drawRectHorizontalLines(x, y, width, height, rectColors); pop(); } function drawRectParallelLines(x, y, width, height, colors) { let heatColor = getHeatColor(dynamo); let offset = map(dynamo, 1, 10, 0, 10); let strokeWidth = map(dynamo, 1, 10, 1, 3); // Linee ombra ai contorni stroke(heatColor.levels[0], heatColor.levels[1], heatColor.levels[2], alphaValue / 2); strokeWeight(strokeWidth); line(x - offset, y - offset, x + width + offset, y - offset); // Sopra line(x - offset, y + height + offset, x + width + offset, y + height + offset); // Sotto line(x - offset, y - offset, x - offset, y + height + offset); // Sinistra line(x + width + offset, y - offset, x + width + offset, y + height + offset); // Destra // Linee originali for (let i = 0; i < height; i += 2) { stroke(colors[1][0], colors[1][1], colors[1][2], alphaValue); line(x, y + i, x + width, y + i); } for (let i = 0; i < width; i += 2) { stroke(colors[2][0], colors[2][1], colors[2][2], alphaValue); line(x + i, y, x + i, y + height); } } function drawRectVerticalLines(x, y, width, height, colors) { let heatColor = getHeatColor(dynamo); let offset = map(dynamo, 1, 10, 0, 10); let strokeWidth = map(dynamo, 1, 10, 1, 3); // Linee ombra ai contorni stroke(heatColor.levels[0], heatColor.levels[1], heatColor.levels[2], alphaValue / 2); strokeWeight(strokeWidth); line(x - offset, y - offset, x - offset, y + height + offset); // Sinistra line(x + width + offset, y - offset, x + width + offset, y + height + offset); // Destra // Linee originali for (let i = 0; i < width; i += 2) { stroke(colors[2][0], colors[2][1], colors[2][2], alphaValue); line(x + i, y, x + i, y + height); } } function drawRectHorizontalLines(x, y, width, height, colors) { let heatColor = getHeatColor(dynamo); let offset = map(dynamo, 1, 10, 0, 10); let strokeWidth = map(dynamo, 1, 10, 1, 3); // Linee ombra ai contorni stroke(heatColor.levels[0], heatColor.levels[1], heatColor.levels[2], alphaValue / 2); strokeWeight(strokeWidth); line(x - offset, y - offset, x + width + offset, y - offset); // Sopra line(x - offset, y + height + offset, x + width + offset, y + height + offset); // Sotto // Linee originali for (let j = 0; j < height; j += 2) { stroke(colors[0][0], colors[0][1], colors[0][2], alphaValue); line(x, y + j, x + width, y + j); } } function generateScreenPosition() { let innerMargin = 0.3 * canvasSize; // Definisce il margine interno let outerMargin = 0.1 * canvasSize; // Definisce il margine esterno do { screenX = random(outerMargin, canvasSize - innerMargin - selectedScreenProfile.width); screenY = random(outerMargin, canvasSize - innerMargin - selectedScreenProfile.height); } while (isInsideSquareArea(screenX, screenY, selectedScreenProfile.width, selectedScreenProfile.height) || isInsideRectArea(screenX, screenY, selectedScreenProfile.width, selectedScreenProfile.height)); } function generateIncomprehensibleText(screenWidth, screenHeight, textSizeValue) { let characters = selectedTextProfile.characters; let minLength = 10; let maxLength = 30; let lineLength = floor(map(dynamo, 1, 10, minLength, maxLength)); let numberOfLines = floor(map(dynamo, 1, 10, 1, 5)); let result = ''; for (let j = 0; j < numberOfLines; j++) { let line = ''; for (let i = 0; i < lineLength; i++) { if (random() > 0.3) { line += characters.charAt(floor(random(characters.length))); } else { line += ' '; } } result += line + '\n'; } return result; } function drawScreen() { let screenBackground = selectedColorProfile.screenBackground; let screenText = selectedColorProfile.screenText; drawRectParallelLines(screenX, screenY, selectedScreenProfile.width, selectedScreenProfile.height, [screenBackground, screenBackground, screenBackground]); push(); let alpha1 = random(-5, 5); let alpha2 = random(-7, 7); translate(alpha1, alpha1); drawRectVerticalLines(screenX, screenY, selectedScreenProfile.width, selectedScreenProfile.height, [screenBackground, screenBackground, screenBackground]); pop(); push(); translate(alpha2, alpha2); drawRectHorizontalLines(screenX, screenY, selectedScreenProfile.width, selectedScreenProfile.height, [screenBackground, screenBackground, screenBackground]); pop(); // Calcolare la dimensione del testo in base alla dimensione dello schermo let textSizeValue = min(selectedScreenProfile.width, selectedScreenProfile.height) * 0.1; // 10% della dimensione minima dello schermo let ledText = generateIncomprehensibleText(selectedScreenProfile.width, selectedScreenProfile.height, textSizeValue); fill(screenText[0], screenText[1], screenText[2], alphaValue); textFont('Courier New'); textSize(textSizeValue); textAlign(CENTER, CENTER); text(ledText, screenX + selectedScreenProfile.width / 2, screenY + selectedScreenProfile.height / 2); } function generateDiskPosition() { do { diskX = random(diskRadius, canvasSize - diskRadius); diskY = random(diskRadius, canvasSize - diskRadius); } while (isInsideSquareArea(diskX - diskRadius, diskY - diskRadius, diskRadius * 2, diskRadius * 2) || isInsideRectArea(diskX - diskRadius, diskY - diskRadius, diskRadius * 2, diskRadius * 2)); } function drawDisk() { if (selectedDiskProfile.type === 'original') { drawOriginalDisk(); } else if (selectedDiskProfile.type === 'new') { drawNewDisk(); } } function drawOriginalDisk() { let diskColors = [ selectedColorProfile.diskColor1, selectedColorProfile.diskColor2, selectedColorProfile.diskColor3 ]; push(); translate(diskX, diskY); drawDiskLayer(diskRadius, diskColors[0], diskAngle, PI / 4, 1, diskCircles); drawDiskLayer(diskRadius * 0.8, diskColors[1], diskAngle * 1.2, -PI / 4, 1 + speedFactor * dynamo, diskCircles); drawDiskLayer(diskRadius * 0.6, diskColors[2], diskAngle * 1.5, PI / 4, 1 + 2 * speedFactor * dynamo, diskCircles); pop(); diskAngle += baseSpeed * 0.01 * dynamo; } function drawNewDisk() { let numCircles = selectedDiskProfile.numCircles || floor(random(2, 4)); let diskColors = [ selectedColorProfile.diskColor1, selectedColorProfile.diskColor2, selectedColorProfile.diskColor3 ]; let circleRotationSpeed = selectedDiskProfile.circleRotationSpeed || 0.01; let circleThickness = selectedDiskProfile.circleThickness || 5; let circleSpacing = selectedDiskProfile.circleSpacing || 10; let circleRadiusIncrement = circleThickness + circleSpacing; // Ensure correct spacing push(); translate(diskX, diskY); // Draw concentric circle slices for (let i = 0; i < numCircles; i++) { let radius = circleRadiusIncrement * (i + 1); let angleOffset = diskAngle * (i + 1) * (circleRotationSpeed * sqrt(dynamo)); // Use sqrt for gradual increment drawIncompleteCircle(radius, circleThickness, diskColors[i % diskColors.length], angleOffset); } // Draw partial circumference segments for (let i = 0; i < numCircles; i++) { let radius = circleRadiusIncrement * (i + 1) * 0.7; let angleOffset = diskAngle * (i + 1) * (circleRotationSpeed * sqrt(dynamo) * 2); // Use sqrt for gradual increment drawPartialCircle(radius, circleThickness, diskColors[i % diskColors.length], angleOffset); } pop(); diskAngle += baseSpeed * 0.01 * sqrt(dynamo); // Use sqrt for gradual increment } function drawIncompleteCircle(radius, thickness, color, angleOffset) { stroke(color[0], color[1], color[2], alphaValue); noFill(); strokeWeight(thickness); let startAngle = angleOffset; let endAngle = startAngle + PI / 3; // 60 degrees for (let i = 0; i < 5; i++) { // Draw 5 slices arc(0, 0, radius * 2, radius * 2, startAngle + i * PI / 2, endAngle + i * PI / 2); } } function drawMovingCircles(radius, color, angleOffset, coverage) { stroke(color[0], color[1], color[2], alphaValue); noFill(); strokeWeight(2); let startAngle = angleOffset; let endAngle = startAngle + TWO_PI * coverage; arc(0, 0, radius * 2, radius * 2, startAngle, endAngle); } function drawPartialCircle(radius, thickness, color, angleOffset) { let heatColor = getHeatColor(dynamo); let shadowOffset = map(dynamo, 1, 10, 10, 20); // Offset radiale per le ombre let outerStrokeWidth = map(dynamo, 1, 10, 0.5, 15); // Map the outer stroke width based on dynamo let startAngle = angleOffset; let endAngle = startAngle + PI * 0.8; // 80% of the circumference // Shadow lines stroke(heatColor.levels[0], heatColor.levels[1], heatColor.levels[2], alphaValue / 2); strokeWeight(outerStrokeWidth); arc(0, 0, radius * 3 + shadowOffset, radius * 3 + shadowOffset, startAngle, endAngle); // Solo aumento del raggio // Original lines stroke(color[0], color[1], color[2], alphaValue); strokeWeight(thickness); arc(0, 0, radius * 2, radius * 2, startAngle, endAngle); } function drawDiskLayer(radius, color, angle, rectAngle, speedMultiplier, numElements) { push(); rotate(angle); fill(color[0], color[1], color[2], alphaValue); // Usa il colore passato let angleStep = TWO_PI / numElements; for (let i = 0; i < numElements; i++) { let x = cos(i * angleStep) * (radius); let y = sin(i * angleStep) * (radius); drawRotatedRect(x, y, radius * 0.1, radius * 0.05, rectAngle, color); // Passa il colore } // Aggiungiamo più elementi verso il centro for (let r = radius * 0.45; r < radius; r += radius * 0.1) { for (let i = 0; i < numElements; i++) { let x = cos(i * angleStep) * (r); let y = sin(i * angleStep) * (r); drawRotatedRect(x, y, r * 0.1, r * 0.05, rectAngle, color); // Passa il colore } } pop(); } function drawRotatedRect(x, y, width, height, angle, color) { let heatColor = getHeatColor(dynamo); let offset = map(dynamo, 1, 10, 0, 10); let strokeWidth = map(dynamo, 1, 10, 1, 3); push(); translate(x, y); rotate(angle); rectMode(CENTER); // Linee ombra ai contorni stroke(heatColor.levels[0], heatColor.levels[1], heatColor.levels[2], alphaValue / 2); strokeWeight(strokeWidth); noFill(); rect(-offset, -offset, width + offset * 2, height + offset * 2); // Rettangolo originale noStroke(); fill(color[0], color[1], color[2], alphaValue); // Usa il colore passato rect(0, 0, width, height / 2); pop(); } function selectProfile() { let r = random(1); let sumProbability = 0; for (let profile of profiles) { sumProbability += profile.probability; if (r < sumProbability) { return profile; } } return profiles[0]; } function selectAnimationSize() { let r = random(1); let sumProbability = 0; for (let size of animationSizes) { sumProbability += size.probability; if (r < sumProbability) { return size.size; } } return animationSizes[0].size; } function selectBackgroundProfile() { let r = random(1); let sumProbability = 0; for (let profile of backgroundProfiles) { sumProbability += profile.probability; if (r < sumProbability) { return profile; } } return backgroundProfiles[0]; } function selectRectangleProfile() { let r = random(1); let sumProbability = 0; for (let profile of rectProfiles) { sumProbability += profile.probability; if (r < sumProbability) { return profile; } } return rectProfiles[0]; } function selectColorProfile() { let r = random(1); let sumProbability = 0; for (let profile of colorProfiles) { sumProbability += profile.probability; if (r < sumProbability) { return profile; } } return colorProfiles[0]; } function selectSmallRectProfile() { let r = random(1); let sumProbability = 0; for (let profile of smallRectProfiles) { sumProbability += profile.probability; if (r < sumProbability) { return profile; } } return smallRectProfiles[0]; } // Modifica la generazione dei piccoli rettangoli per includere la dipendenza da dynamo function generateSmallRects() { smallRects = []; let selectedSmallRectProfile = selectSmallRectProfile(); let baseWidth = selectedSmallRectProfile.width; let baseHeight = selectedSmallRectProfile.height; let widthMultiplier = map(dynamo, 1, 10, 1, 2); // Modula la larghezza in base a dynamo let heightMultiplier = map(dynamo, 1, 10, 1, 2); // Modula l'altezza in base a dynamo let width = baseWidth * widthMultiplier; let height = baseHeight * heightMultiplier; if (selectedSmallRectProfile.type === 'ordered') { let startX, startY; let gridWidth = selectedSmallRectProfile.cols * (width + selectedSmallRectProfile.horizontalSpacing) - selectedSmallRectProfile.horizontalSpacing; let gridHeight = selectedSmallRectProfile.rows * (height + selectedSmallRectProfile.verticalSpacing) - selectedSmallRectProfile.verticalSpacing; do { startX = random(0, canvasSize - gridWidth); startY = random(0, canvasSize - gridHeight); } while (isInsideSquareArea(startX, startY, gridWidth, gridHeight) || isInsideRectArea(startX, startY, gridWidth, gridHeight)); for (let row = 0; row < selectedSmallRectProfile.rows; row++) { for (let col = 0; col < selectedSmallRectProfile.cols; col++) { let index = row * selectedSmallRectProfile.cols + col; if (index >= selectedSmallRectProfile.count) break; let x = startX + col * (width + selectedSmallRectProfile.horizontalSpacing); let y = startY + row * (height + selectedSmallRectProfile.verticalSpacing); smallRects.push({ x: x, y: y, initialX: x, width: width, height: height, colors: [ selectedColorProfile.smallRectColor1, selectedColorProfile.smallRectColor2, selectedColorProfile.smallRectColor3 ] }); } } } else if (selectedSmallRectProfile.type === 'disordered') { for (let i = 0; i < selectedSmallRectProfile.count; i++) { let x, y; do { x = random(0, canvasSize - width); y = random(0, canvasSize - height); } while (isInsideSquareArea(x, y, width, height) || isInsideRectArea(x, y, width, height)); smallRects.push({ x: x, y: y, initialX: x, width: width, height: height, colors: [ selectedColorProfile.smallRectColor1, selectedColorProfile.smallRectColor2, selectedColorProfile.smallRectColor3 ] }); } } } // Modifica la velocità di animazione, le dimensioni e l'offset durante il disegno dei piccoli rettangoli function drawSmallRects() { for (let rect of smallRects) { let { x, y, width, height, initialX, colors } = rect; let speedFactor = map(dynamo, 1, 10, 0.1, 0.35); // Modula la velocità in base a dynamo let offsetFactor = map(dynamo, 1, 10, 10, 50); // Modula l'offset in base a dynamo let offsetX1 = sin(frameCount * speedFactor) * offsetFactor; let offsetX2 = sin(frameCount * speedFactor + PI / 4) * offsetFactor; let offsetX3 = sin(frameCount * speedFactor + PI / 2) * offsetFactor; drawSmallRectParallelLines(x + offsetX1, y, width, height, colors[0]); drawSmallRectParallelLines(x + offsetX2, y, width, height, colors[1]); drawSmallRectParallelLines(x + offsetX3, y, width, height, colors[2]); } } function drawSmallRectParallelLines(x, y, width, height, color) { let heatColor = getHeatColor(dynamo); let offset = map(dynamo, 1, 10, 0, 10); let outerStrokeWidth = map(dynamo, 1, 10, 1, 2.5); // Mappa lo spessore esterno in base a dynamo // Linee ombra ai contorni con spessore variabile stroke(heatColor.levels[0], heatColor.levels[1], heatColor.levels[2], alphaValue / 2); strokeWeight(outerStrokeWidth); line(x - offset, y - offset, x + width + offset, y - offset); // Sopra line(x - offset, y + height + offset, x + width + offset, y + height + offset); // Sotto line(x - offset, y - offset, x - offset, y + height + offset); // Sinistra line(x + width + offset, y - offset, x + width + offset, y + height + offset); // Destra // Linee originali strokeWeight(1); // Linee originali con spessore fisso for (let i = 0; i < height; i += 2) { stroke(color[0], color[1], color[2], alphaValue); line(x, y + i, x + width, y + i); } } function generateLights() { lights = []; selectedLightProfile = selectLightProfile(); let { rows, cols, width, height, horizontalSpacing, verticalSpacing, animationSpeed } = selectedLightProfile; let numLights = rows * cols; let startX, startY; let centralMargin = 0.3 * canvasSize; // Definisce la fascia centrale da evitare do { startX = random(0, canvasSize - (cols * (width + horizontalSpacing))); if (random(1) < 0.5) { // Genera nella parte superiore startY = random(0, (canvasSize - centralMargin) / 2 - (rows * (height + verticalSpacing))); } else { // Genera nella parte inferiore startY = random((canvasSize + centralMargin) / 2, canvasSize - (rows * (height + verticalSpacing))); } } while (isInsideSquareArea(startX, startY, cols * (width + horizontalSpacing), rows * (height + verticalSpacing)) || isInsideRectArea(startX, startY, cols * (width + horizontalSpacing), rows * (height + verticalSpacing))); for (let row = 0; row < rows; row++) { for (let col = 0; col < cols; col++) { let x = startX + col * (width + horizontalSpacing); let y = startY + row * (height + verticalSpacing); lights.push({ x: x, y: y, initialX: x, colors: [ selectedColorProfile.lightColor1, selectedColorProfile.lightColor2, selectedColorProfile.lightColor3 ], lastSwitchTime: millis(), width: width, height: height, density: selectedLightProfile.density, // Usa la densità dal profilo animationSpeed: animationSpeed }); } } } let lastSwitchTimeGlobal = 0; // Riferimento temporale globale function drawLights() { let elapsedTime = millis(); // Usa il tempo trascorso per tutte le luci if (elapsedTime - lastSwitchTimeGlobal > 100 / dynamo) { for (let light of lights) { light.colors.push(light.colors.shift()); } lastSwitchTimeGlobal = elapsedTime; } for (let light of lights) { let { x, y, colors, width, height, density, animationSpeed } = light; let dynamicSpeed = animationSpeed * dynamo; let scaleFactor = map(dynamo, 1, 10, 1, 1.3); let dynamicWidth = width * scaleFactor; let dynamicHeight = height * scaleFactor; drawLightShadows(x, y, dynamicWidth, dynamicHeight, elapsedTime, dynamicSpeed); let offsetX = 0; for (let color of colors) { drawLightParallelLines(x + offsetX, y, dynamicWidth, dynamicHeight, color, density); offsetX += dynamicWidth; } } } function drawLightShadows(x, y, width, height, elapsedTime, dynamicSpeed) { let heatColor = getHeatColor(dynamo); let offset = map(dynamo, 1, 10, 0, 10); let outerStrokeWidth = map(dynamo, 1, 10, 1, 3); // Mappa lo spessore fino a 3 quando dynamo è a 10 // Calcola il movimento delle ombre in sincronia con le luci, da destra verso sinistra let totalCycleTime = 10000 / dynamicSpeed; let cycleProgress = (elapsedTime % totalCycleTime) / totalCycleTime; let xPos = x + width * 2.2 * (1 - cycleProgress); // Sposta leggermente più a sinistra // Linee ombra sopra e sotto con spessore variabile stroke(heatColor.levels[0], heatColor.levels[1], heatColor.levels[2], alphaValue / 2); strokeWeight(outerStrokeWidth); let lineLength = width; // Lunghezza uguale alla larghezza // Assicuriamoci che le linee siano disegnate nelle coordinate corrette line(xPos, y - offset - 3, xPos + lineLength, y - offset - 3); // Sopra line(xPos, y + height + offset + 1, xPos + lineLength, y + height + offset + 1); // Sotto } function drawLightParallelLines(x, y, width, height, color, density) { fill(color[0], color[1], color[2], alphaValue); noStroke(); for (let i = 0; i < height; i += density) { stroke(color[0], color[1], color[2], alphaValue); line(x, y + i, x + width, y + i); } } function drawCorniceInt() { let corniceColors = [ selectedColorProfile.corniceIntColor1, selectedColorProfile.corniceIntColor2, selectedColorProfile.corniceIntColor3 ]; if (selectedCorniceProfile.type === 'fourSquares') { drawFourSquaresCornice(corniceColors); } else if (selectedCorniceProfile.type === 'diagonalStrip') { drawDiagonalStripCornice(corniceColors); } else { let corniceWidth = canvasSize * 0.9; let corniceHeight = canvasSize * 0.9; let corniceX = (canvasSize - corniceWidth) / 2; let corniceY = (canvasSize - corniceHeight) / 2; drawCorniceParallelLines(corniceX, corniceY, corniceWidth, corniceHeight, corniceColors); push(); translate(random(-5, 5), random(-5, 5)); drawCorniceVerticalLines(corniceX, corniceY, corniceWidth, corniceHeight, corniceColors); pop(); push(); translate(random(-5, 5), random(-5, 5)); drawCorniceHorizontalLines(corniceX, corniceY, corniceWidth, corniceHeight, corniceColors); pop(); } } function drawDiagonalStripCornice(colors) { let squareSize = canvasSize * 0.3; let spacing = 20; let cols = floor(canvasSize / (squareSize + spacing)) + 1; let rows = floor(canvasSize / (squareSize + spacing)) + 1; let offsetX, offsetY; let parallelColors = [colors[1][0], colors[1][1], colors[1][2], 150]; let verticalColors = [colors[2][0], colors[2][1], colors[2][2], 150]; let horizontalColors = [colors[0][0], colors[0][1], colors[0][2], 150]; let initialOffsetX = random(-5, 5); // Offset iniziale casuale per x let initialOffsetY = random(-5, 5); // Offset iniziale casuale per y for (let col = 0; col < cols; col++) { for (let row = 0; row < rows; row++) { let x = col * (squareSize + spacing) + initialOffsetX; let y = row * (squareSize + spacing) + initialOffsetY; offsetX = random(-5, 5); offsetY = random(-5, 5); // Disegnare le linee parallele drawParallelLinesOptimized(x, y, squareSize, parallelColors); push(); translate(offsetX, offsetY); drawVerticalLinesOptimized(x, y, squareSize, verticalColors); drawHorizontalLinesOptimized(x, y, squareSize, horizontalColors); pop(); } } } function drawParallelLinesOptimized(x, y, size, color) { stroke(color[0], color[1], color[2], color[3]); for (let i = 0; i < size; i += 4) { // Aumenta il passo per ridurre il numero di linee line(x, y + i, x + size, y + i); } } function drawVerticalLinesOptimized(x, y, size, color) { stroke(color[0], color[1], color[2], color[3]); for (let i = 0; i < size; i += 4) { // Aumenta il passo per ridurre il numero di linee line(x + i, y, x + i, y + size); } } function drawHorizontalLinesOptimized(x, y, size, color) { stroke(color[0], color[1], color[2], color[3]); for (let j = 0; j < size; j += 4) { // Aumenta il passo per ridurre il numero di linee line(x, y + j, x + size, y + j); } } function drawFourSquaresCornice(colors) { let squareSize = canvasSize * 0.45; let positions = [ { x: 0, y: 0 }, { x: canvasSize - squareSize, y: 0 }, { x: 0, y: canvasSize - squareSize }, { x: canvasSize - squareSize, y: canvasSize - squareSize } ]; for (let pos of positions) { drawCorniceParallelLines(pos.x, pos.y, squareSize, squareSize, colors); push(); translate(random(-5, 5), random(-5, 5)); drawCorniceVerticalLines(pos.x, pos.y, squareSize, squareSize, colors); pop(); push(); translate(random(-5, 5), random(-5, 5)); drawCorniceHorizontalLines(pos.x, pos.y, squareSize, squareSize, colors); pop(); } } function drawCorniceParallelLines(x, y, width, height, colors) { for (let i = 0; i < height; i += 2) { stroke(colors[1][0], colors[1][1], colors[1][2], 150); line(x, y + i, x + width, y + i); } for (let i = 0; i < width; i += 2) { stroke(colors[2][0], colors[2][1], colors[2][2], 150); line(x + i, y, x + i, y + height); } } function drawCorniceVerticalLines(x, y, width, height, colors) { for (let i = 0; i < width; i += 2) { stroke(colors[2][0], colors[2][1], colors[2][2], 150); line(x + i, y, x + i, y + height); } } function drawCorniceHorizontalLines(x, y, width, height, colors) { for (let j = 0; j < height; j += 2) { stroke(colors[0][0], colors[0][1], colors[0][2], 150); line(x, y + j, x + width, y + j); } } function generateHdssd() { let selectedSsdProfile = selectSsdProfile(); hdssd = []; let columns = selectedSsdProfile.columns; let rows = selectedSsdProfile.rows; let spacing = selectedSsdProfile.spacing; let ssdWidth = selectedSsdProfile.width; let ssdHeight = selectedSsdProfile.height; let centralMargin = 0.3 * canvasSize; // Definisce la fascia centrale preferita if (selectedSsdProfile.ordered) { // Calcola una posizione di partenza casuale per la griglia let startX = random(0, canvasSize - (columns * (ssdWidth + spacing) - spacing)); let startY = random((canvasSize - centralMargin) / 2, (canvasSize + centralMargin) / 2 - (rows * (ssdHeight + spacing) - spacing)); for (let i = 0; i < selectedSsdProfile.count; i++) { let col = i % columns; let row = floor(i / columns); let hdssdX = startX + col * (ssdWidth + spacing); let hdssdY = startY + row * (ssdHeight + spacing); if (!isOverlapping(hdssdX, hdssdY, ssdWidth, ssdHeight)) { hdssd.push({ x: hdssdX, y: hdssdY, width: ssdWidth, height: ssdHeight, lineSpacing: selectedSsdProfile.lineSpacing, rectAngle: selectedSsdProfile.rectAngle, ssdRotation: selectedSsdProfile.ssdRotation, animationSpeed: selectedSsdProfile.animationSpeed, colors: [ selectedColorProfile.rectColor1, selectedColorProfile.rectColor2, selectedColorProfile.rectColor3 ] }); } } } else { for (let i = 0; i < selectedSsdProfile.count; i++) { let hdssdX, hdssdY; do { hdssdX = random(0, canvasSize - ssdWidth); hdssdY = random((canvasSize - centralMargin) / 2, (canvasSize + centralMargin) / 2 - ssdHeight); } while (isOverlapping(hdssdX, hdssdY, ssdWidth, ssdHeight)); hdssd.push({ x: hdssdX, y: hdssdY, width: ssdWidth, height: ssdHeight, lineSpacing: selectedSsdProfile.lineSpacing, rectAngle: selectedSsdProfile.rectAngle, ssdRotation: selectedSsdProfile.ssdRotation, animationSpeed: selectedSsdProfile.animationSpeed, colors: [ selectedColorProfile.rectColor1, selectedColorProfile.rectColor2, selectedColorProfile.rectColor3 ] }); } } } function isOverlapping(x, y, width, height) { // Controlla sovrapposizione con l'area quadrata if (isInsideSquareArea(x, y, width, height) || isInsideRectArea(x, y, width, height)) { return true; } // Controlla sovrapposizione con altri elementi disegnati for (let ssd of hdssd) { if ( x < ssd.x + ssd.width && x + width > ssd.x && y < ssd.y + ssd.height && y + height > ssd.y ) { return true; } } // Puoi aggiungere altri controlli di sovrapposizione con altri tipi di elementi qui... return false; } function drawHdssd() { if (!hdssd) return; let elapsedTime = millis(); // Usa il tempo trascorso per le animazioni for (let ssd of hdssd) { let { x, y, width, height, colors, rectAngle, ssdRotation, animationSpeed } = ssd; // Aumentiamo il fattore di velocità di animazione per dynamo e la velocità di base let speedMultiplier = 20 * dynamo; // Moltiplicatore dinamico molto più alto let baseSpeed = 0.001; // Velocità base molto più alta let offset1 = sin(elapsedTime * baseSpeed * animationSpeed + speedMultiplier) * width / 2; let offset2 = sin(elapsedTime * baseSpeed * animationSpeed + speedMultiplier + PI / 4) * width / 2; let offset3 = sin(elapsedTime * baseSpeed * animationSpeed + speedMultiplier + PI / 2) * width / 2; let moveOffset1 = sin(elapsedTime * baseSpeed + offset1) * 40; // Movimento sincronizzato con maggiore ampiezza let moveOffset2 = sin(elapsedTime * baseSpeed + offset2) * 40; // Movimento sincronizzato con maggiore ampiezza let moveOffset3 = sin(elapsedTime * baseSpeed + offset3) * 40; // Movimento sincronizzato con maggiore ampiezza // Draw SSDs and their shadows push(); translate(x + width / 2, y + height / 2); rotate(radians(ssdRotation)); drawHdssdLayer(-width / 2 + moveOffset1, -height / 2, width, height, colors[0], offset1, rectAngle, -6); drawHdssdLayer(-width / 2 + moveOffset2, -height / 2, width, height, colors[1], offset2, rectAngle, 3); drawHdssdLayer(-width / 2 + moveOffset3, -height / 2, width, height, colors[2], offset3, rectAngle, -5); pop(); } } function drawHdssdLayer(x, y, width, height, color, offset, rectAngle, xOffset) { let heatColor = getHeatColor(dynamo); let shadowOffset = map(dynamo, 1, 10, 3, 13); let shadowStrokeWidth = map(dynamo, 1, 10, 1, 5); let rectWidth = map(dynamo, 1, 10, 1, 3); // Mappa la larghezza del rettangolo da 1 a 3 let moveAmplitude = map(dynamo, 1, 10, 10, 40); // Mappa l'ampiezza del movimento da 10 a 40 let elapsedTime = millis(); // Usa il tempo trascorso per le animazioni for (let i = -width; i < width; i += 5) { let x1 = x + i + offset + xOffset; let y1 = y; let moveOffset = sin(frameCount * 0.1 + i) * moveAmplitude; // Aggiungi movimento e aumenta l'influenza di dynamo // Disegna le ombre stroke(heatColor.levels[0], heatColor.levels[1], heatColor.levels[2], alphaValue / 2); strokeWeight(shadowStrokeWidth); noFill(); line(x1 - shadowOffset + moveOffset, y1 - shadowOffset, x1 + rectWidth + shadowOffset + moveOffset, y1 - shadowOffset); // Sopra line(x1 - shadowOffset + moveOffset, y1 + height + shadowOffset, x1 + rectWidth + shadowOffset + moveOffset, y1 + height + shadowOffset); // Sotto // Disegna gli SSD fill(color[0], color[1], color[2], alphaValue); noStroke(); push(); translate(x1 + moveOffset, y1); rotate(radians(rectAngle)); rect(0, 0, rectWidth, height); pop(); } } function rectAlt() { let profile = selectedRectAltProfile; push(); translate(rectAltX + profile.width / 2, rectAltY + profile.count * (profile.height + profile.spacing) / 2); rotate(radians(profile.rotation)); translate(-(rectAltX + profile.width / 2), -(rectAltY + profile.count * (profile.height + profile.spacing) / 2)); for (let i = 0; i < profile.count; i++) { let y = rectAltY + i * (profile.height + profile.spacing); drawRamRect(rectAltX, y, profile.width, profile.height, profile.animationSpeed, i); } pop(); } function drawRamRect(x, y, width, height, speed, index) { let colors = [ selectedColorProfile.rectColor1, selectedColorProfile.rectColor2, selectedColorProfile.rectColor3 ]; let scaleFactor = sin(frameCount * 0.1) * 0.5 + 0.5; // Scala per l'animazione let animatedWidth = width * (1 + scaleFactor * 0.1); // Aumenta la larghezza in base alla scala let animatedHeight = height * (1 + scaleFactor * 0.1); // Aumenta l'altezza in base alla scala drawRectShadow(x, y, animatedWidth, animatedHeight); // Disegna l'ombra for (let j = 0; j < 3; j++) { let fillPercentage = (sin(frameCount * speed * dynamo * (j + 1) + index * PI / 2) + 1) / 2; // Calcola la percentuale di riempimento let fillWidth = animatedWidth * fillPercentage; // Calcola la larghezza del riempimento fill(colors[j][0], colors[j][1], colors[j][2], alphaValue / 4); // Imposta il colore del riempimento noStroke(); rect(x, y, fillWidth, animatedHeight); // Disegna il rettangolo di riempimento } } function drawRectShadow(x, y, width, height) { let heatColor = getHeatColor(dynamo); let offset = map(dynamo, 1, 10, 0, 4); // Mappa lo spostamento in base a dynamo let strokeWidth = map(dynamo, 1, 10, 1, 3); // Mappa lo spessore della linea in base a dynamo // Disegna l'ombra ai contorni del rettangolo stroke(heatColor.levels[0], heatColor.levels[1], heatColor.levels[2], alphaValue / 2); strokeWeight(strokeWidth); noFill(); rect(x - offset, y - offset, width + 2 * offset, height + 2 * offset); } function isInsideCornice(x, y, width, height, count, spacing) { let cornicePadding = canvasSize * 0.1; return ( x >= cornicePadding && y >= cornicePadding && x + width <= canvasSize - cornicePadding && y + count * (height + spacing) <= canvasSize - cornicePadding ); } function generateRectAltPosition() { let profile = selectedRectAltProfile; let outerMargin = 0.1 * canvasSize; // Definisce il margine esterno per escludere la zona troppo vicina ai bordi // Genera un valore per rectAltX vicino ai bordi sinistro o destro, ma non troppo if (random(0, 1) < 0.5) { rectAltX = random(outerMargin, 0.35 * canvasSize - profile.width); // Vicino al bordo sinistro ma non troppo } else { rectAltX = random(0.65 * canvasSize, canvasSize - outerMargin - profile.width); // Vicino al bordo destro ma non troppo } // Genera un valore per rectAltY vicino ai bordi superiore o inferiore, ma non troppo if (random(0, 1) < 0.5) { rectAltY = random(outerMargin, 0.35 * canvasSize - (profile.count * profile.height + (profile.count - 1) * profile.spacing)); // Vicino al bordo superiore ma non troppo } else { rectAltY = random(0.65 * canvasSize - (profile.count * profile.height + (profile.count - 1) * profile.spacing), canvasSize - outerMargin - (profile.count * profile.height + (profile.count - 1) * profile.spacing)); // Vicino al bordo inferiore ma non troppo } } function getHeatColor(dynamo) { // Verifica se il profilo colore selezionato è tutto nero if (selectedColorProfile.name === 'allBlack') { // Restituisce un colore casuale return color(random(255), random(255), random(255)); } // Calcolare il colore del gradiente in base agli estremi definiti nel profilo colore selezionato let t = map(dynamo, 1, 10, 0, 1); let r = lerp(selectedColorProfile.gradientStart[0], selectedColorProfile.gradientEnd[0], t); let g = lerp(selectedColorProfile.gradientStart[1], selectedColorProfile.gradientEnd[1], t); let b = lerp(selectedColorProfile.gradientStart[2], selectedColorProfile.gradientEnd[2], t); return color(r, g, b); } function drawQuantic() { let baseSpeed = selectedQuanticProfile.baseSpeed; let dynamoFactor = dynamo * 0.01; let maxDimension = selectedQuanticProfile.maxDimension; for (let i = 0; i < 5; i++) { let rect = quanticRects[i]; let phaseOffset = i * TWO_PI / 7; rect.width = map(sin(frameCount * (baseSpeed + dynamoFactor) + phaseOffset), -1, 1, (maxDimension/3), maxDimension); rect.height = map(cos(frameCount * (baseSpeed + dynamoFactor) + phaseOffset), -1, 1, (maxDimension/3), maxDimension); let colors = [ selectedColorProfile.squareColor1, selectedColorProfile.squareColor2, selectedColorProfile.squareColor3 ]; drawQuanticRectangle(quanticCenterX, quanticCenterY, rect.width, rect.height, colors); } } function drawQuanticRectangle(x, y, width, height, colors) { push(); translate(x, y); let heatColor = getHeatColor(dynamo); let offset = map(dynamo, 1, 10, 0, 10); let outerStrokeWidth = map(dynamo, 1, 10, 1, 5); // Linee ombra ai contorni con spessore modificato stroke(heatColor.levels[0], heatColor.levels[1], heatColor.levels[2], alphaValue / 2); strokeWeight(outerStrokeWidth); line(-width / 2 - offset, -height / 2 - offset, width / 2 + offset, -height / 2 - offset); // Sopra line(-width / 2 - offset, height / 2 + offset, width / 2 + offset, height / 2 + offset); // Sotto line(-width / 2 - offset, -height / 2 - offset, -width / 2 - offset, height / 2 + offset); // Sinistra line(width / 2 + offset, -height / 2 - offset, width / 2 + offset, height / 2 + offset); // Destra // Linee originali strokeWeight(0.5); // Manteniamo lo spessore fisso per le linee originali for (let i = -height / 2; i < height / 2; i += 2) { stroke(colors[0][0], colors[0][1], colors[0][2], alphaValue); line(-width / 2, i, width / 2, i); } for (let i = -width / 2; i < width / 2; i += 2) { stroke(colors[1][0], colors[1][1], colors[1][2], alphaValue); line(i, -height / 2, i, height / 2); } for (let i = -height / 2; i < height / 2; i += 4) { stroke(colors[2][0], colors[2][1], colors[2][2], alphaValue); line(-width / 2, i, width / 2, i); } pop(); } function drawDisquantic() { let baseSpeed = selectedDisquanticProfile.baseSpeed * 0.5; let dynamoFactor = dynamo * 0.04; let maxRectSize = selectedDisquanticProfile.maxDimension; for (let i = 0; i < 3; i++) { let rect = quanticRects[i]; let phaseOffset = i * PI / 2; rect.width = map(sin(frameCount * (baseSpeed + dynamoFactor) + phaseOffset), -1, 1, maxRectSize / 3, maxRectSize); rect.height = map(cos(frameCount * (baseSpeed + dynamoFactor) + phaseOffset), -1, 1, maxRectSize / 3, maxRectSize); let moveX = sin(frameCount * (baseSpeed + dynamoFactor) + phaseOffset) * 20 + cos(frameCount * 0.01 + phaseOffset) * 50; let moveY = cos(frameCount * (baseSpeed + dynamoFactor) + phaseOffset) * 20 + sin(frameCount * 0.01 + phaseOffset) * 50; let colors = [ selectedColorProfile.squareColor1, selectedColorProfile.squareColor2, selectedColorProfile.squareColor3 ]; drawDisquanticRectangle(quanticCenterX + moveX, quanticCenterY + moveY, rect.width, rect.height, colors); } } function drawDisquanticRectangle(x, y, width, height, colors) { push(); translate(x, y); let heatColor = getHeatColor(dynamo); let offsetX = map(dynamo, 1, 10, 0, 20); let offsetY = map(dynamo, 1, 10, 0, 20); let outerStrokeWidth = map(dynamo, 1, 10, 0, 3); // Linee ombra ai contorni con spessore modificato stroke(heatColor.levels[0], heatColor.levels[1], heatColor.levels[2], alphaValue); strokeWeight(outerStrokeWidth); line(-width / 2 - offsetX, -height / 2 - offsetY, width / 2 + offsetX, -height / 2 - offsetY); // Sopra line(-width / 2 - offsetX, height / 2 + offsetY, width / 2 + offsetX, height / 2 + offsetY); // Sotto line(-width / 2 - offsetX, -height / 2 - offsetY, -width / 2 - offsetX, height / 2 + offsetY); // Sinistra line(width / 2 + offsetX, -height / 2 - offsetY, width / 2 + offsetX, height / 2 + offsetY); // Destra // Linee originali strokeWeight(0.7); // Manteniamo lo spessore fisso per le linee originali for (let i = -height / 2; i < height / 2; i += 2) { stroke(colors[0][0], colors[0][1], colors[0][2], alphaValue); line(-width / 2, i, width / 2, i); } for (let i = -width / 2; i < width / 2; i += 2) { stroke(colors[1][0], colors[1][1], colors[1][2], alphaValue); line(i, -height / 2, i, height / 2); } for (let i = -height / 2; i < height / 2; i += 4) { stroke(colors[2][0], colors[2][1], colors[2][2], alphaValue); line(-width / 2, i, width / 2, i); } pop(); } function selectDataTextProfile() { let r = random(1); let sumProbability = 0; for (let profile of dataTextProfiles) { sumProbability += profile.probability; if (r < sumProbability) { return profile; } } return dataTextProfiles[0]; } function toggleDataTextVisibility() { dataTextVisible = !dataTextVisible; } function getDataTextPosition() { let x = 60; let y = 60; if (selectedCorniceProfile.type === 'fourSquares') { x = 20; y = 20; } else if (selectedCorniceProfile.type === 'diagonalStrip') { x = - 20; y = - 70; } return { x, y }; } function drawDataText() { if (millis() - lastDataTextUpdateTime > dataTextUpdateInterval) { updateDataTextValues(); lastDataTextUpdateTime = millis(); } let { x, y } = getDataTextPosition(); let textColor = selectedColorProfile.textColor; fill(textColor[0], textColor[1], textColor[2], alphaValue/3); noStroke(); textSize(12); textAlign(LEFT, TOP); textFont('Courier New'); let dataText = generateDataText(); let lines = dataText.split('\n'); for (let i = 0; i < lines.length; i++) { let jitterX = random(-1, 1); let jitterY = random(-1, 1); text(lines[i], x + jitterX, y + jitterY + i * 12); } } function generateDataText() { let dataText = ''; for (let key in dataTextValues) { dataText += `${key}: ${dataTextValues[key]}\n`; } return dataText; } function updateDataTextValues() { dataTextValues["average_fee"] = floor(random(0, 200)); dataTextValues["average_fee_rate"] = floor(random(0, 100)); dataTextValues["bits"] = floor(random(400000000, 500000000)); dataTextValues["chainwork"] = generateRandomHexString(12); dataTextValues["confirmations"] = floor(random(0, 1000)); dataTextValues["difficulty"] = random(0, 100); dataTextValues["hash"] = generateRandomHexString(32); dataTextValues["feerate_percentiles"] = [floor(random(0, 100)), floor(random(0, 100)), floor(random(0, 100)), floor(random(0, 100)), floor(random(0, 100))]; dataTextValues["height"] = floor(random(0, 100000)); dataTextValues["max_fee"] = floor(random(0, 1000)); dataTextValues["max_fee_rate"] = floor(random(0, 1000)); dataTextValues["max_tx_size"] = floor(random(0, 1000)); dataTextValues["median_fee"] = floor(random(0, 1000)); dataTextValues["median_time"] = floor(random(1200000000, 1300000000)); dataTextValues["merkle_root"] = generateRandomHexString(32); dataTextValues["min_fee"] = floor(random(0, 100)); dataTextValues["min_fee_rate"] = floor(random(0, 100)); dataTextValues["nonce"] = floor(random(0, 1000000)); dataTextValues["subsidy"] = floor(random(4000000000, 6000000000)); dataTextValues["target"] = generateRandomHexString(24); dataTextValues["timestamp"] = floor(random(1200000000, 1300000000)); dataTextValues["total_fee"] = floor(random(0, 1000)); dataTextValues["total_size"] = floor(random(0, 1000000)); dataTextValues["total_weight"] = floor(random(0, 1000000)); dataTextValues["transaction_count"] = floor(random(0, 1000000)); dataTextValues["version"] = floor(random(0, 10)); } function generateRandomHexString(length) { let result = ''; let characters = '0123456789abcdef'; let charactersLength = characters.length; for (let i = 0; i < length; i++) { result += characters.charAt(floor(random(charactersLength))); } return result; } function drawPowerup() { if (selectedPowerupProfile.type === 'virus') { drawVirusPowerup(); } else if (selectedPowerupProfile.type === 'additionalCPU') { drawAdditionalCPUPowerup(); } } function drawVirusPowerup() { let baseSize = selectedPowerupProfile.baseSize; let maxOffset = selectedPowerupProfile.maxOffset; let colors = [ selectedColorProfile.virus1, selectedColorProfile.virus2, selectedColorProfile.virus3 ]; for (let i = 0; i < 3; i++) { let size = baseSize + sin(frameCount * 0.5 + i * PI / 4) * 10; let offsetX = cos(frameCount * 0.2 + i * PI / 6) * map(dynamo, 1, 10, maxOffset * 0.7, maxOffset); let offsetY = sin(frameCount * 0.1 + i * PI / 5) * map(dynamo, 1, 10, maxOffset * 0.7, maxOffset); drawPowerupLayer(powerupX1 + offsetX, powerupY1 + offsetY, size * map(dynamo, 1, 10, 1, 1.5), colors[i]); } } function drawAdditionalCPUPowerup() { let baseSize = selectedPowerupProfile.baseSize; let maxOffset = selectedPowerupProfile.maxOffset; let colors = [ selectedColorProfile.additionalCPU1, selectedColorProfile.additionalCPU2, selectedColorProfile.additionalCPU3 ]; let animationSpeeds = [0.5, 0.3, 0.7]; // Differenti velocità di animazione per i 3 layers for (let i = 0; i < 3; i++) { let size = baseSize + sin(frameCount * animationSpeeds[i] + i * PI / 4) * 10; let offsetX = 0; // Non si sposta orizzontalmente let offsetY = 0; // Non si sposta verticalmente let x = powerupX2 + offsetX; let y = powerupY2 + offsetY; let width = size * map(dynamo, 1, 10, 1, 1.5); let height = size * map(dynamo, 1, 10, 1, 1.5); // Drawing the additional CPU powerup directly here, behaving like quantic rectangles push(); translate(x, y); let heatColor = getHeatColor(dynamo); let offset = map(dynamo, 1, 10, 0, 10); let outerStrokeWidth = map(dynamo, 1, 10, 1, 5); let strokeColor = selectedColorProfile.strokeAdditionalCPU; // Linee ombra ai contorni con spessore modificato stroke(strokeColor[0], strokeColor[1], strokeColor[2], alphaValue / 3); strokeWeight(outerStrokeWidth); line(-width / 2 - offset, -height / 2 - offset, width / 2 + offset, -height / 2 - offset); // Sopra line(-width / 2 - offset, height / 2 + offset, width / 2 + offset, height / 2 + offset); // Sotto line(-width / 2 - offset, -height / 2 - offset, -width / 2 - offset, height / 2 + offset); // Sinistra line(width / 2 + offset, -height / 2 - offset, width / 2 + offset, height / 2 + offset); // Destra // Linee originali strokeWeight(1); // Manteniamo lo spessore fisso per le linee originali for (let j = -height / 2; j < height / 2; j += 2) { stroke(colors[0][0], colors[0][1], colors[0][2], alphaValue/3); line(-width / 2, j, width / 2, j); } for (let j = -width / 2; j < width / 2; j += 2) { stroke(colors[1][0], colors[1][1], colors[1][2], alphaValue/3); line(j, -height / 2, j, height / 2); } for (let j = -height / 2; j < height / 2; j += 4) { stroke(colors[2][0], colors[2][1], colors[2][2], alphaValue/3); line(-width / 2, j, width / 2, j); } pop(); } } function drawPowerupLayer(x, y, size, color) { let heatColor = getHeatColor(dynamo); let offset = map(dynamo, 1, 10, 0, 10); let outerStrokeWidth = map(dynamo, 1, 10, 1, 6); if (selectedPowerupProfile.type === 'virus') { let strokeVirus = selectedColorProfile.strokeVirus; // Linee ombra ai contorni con spessore modificato stroke(strokeVirus[0], strokeVirus[1], strokeVirus[2], alphaValue / 3); strokeWeight(outerStrokeWidth); line(x - size / 2 - offset, y - size / 2 - offset, x + size / 2 + offset, y - size / 2 - offset); // Sopra line(x - size / 2 - offset, y + size / 2 + offset, x + size / 2 + offset, y + size / 2 + offset); // Sotto line(x - size / 2 - offset, y - size / 2 - offset, x - size / 2 - offset, y + size / 2 + offset); // Sinistra line(x + size / 2 + offset, y - size / 2 - offset, x + size / 2 + offset, y + size / 2 + offset); // Destra // Linee originali stroke(color[0], color[1], color[2], alphaValue); // Usa il colore passato strokeWeight(1); for (let i = -size / 2; i < size / 2; i += 2) { line(x - size / 2, y + i, x + size / 2, y + i); } } else if (selectedPowerupProfile.type === 'additionalCPU') { let strokeAdditionalCPU = selectedColorProfile.strokeAdditionalCPU; // Linee ombra ai contorni con spessore modificato stroke(strokeAdditionalCPU[0], strokeAdditionalCPU[1], strokeAdditionalCPU[2], alphaValue / 4); strokeWeight(outerStrokeWidth); line(x - size / 2 - offset, y - size / 2 - offset, x + size / 2 + offset, y - size / 2 - offset); // Sopra line(x - size / 2 - offset, y + size / 2 + offset, x + size / 2 + offset, y + size / 2 + offset); // Sotto line(x - size / 2 - offset, y - size / 2 - offset, x - size / 2 - offset, y + size / 2 + offset); // Sinistra line(x + size / 2 + offset, y - size / 2 - offset, x + size / 2 + offset, y + size / 2 + offset); // Destra // Linee originali stroke(color[0], color[1], color[2], alphaValue); // Usa il colore passato strokeWeight(1); for (let i = -size / 2; i < size / 2; i += 2) { line(x - size / 2, y + i, x + size / 2, y + i); } } } function selectPowerupProfile() { let r = random(1); let sumProbability = 0; for (let profile of powerupProfiles) { sumProbability += profile.probability; if (r < sumProbability) { return profile; } } return powerupProfiles[0]; } function selectCapacitorProfile() { let r = random(0, 1); // Genera un numero casuale tra 0 e 1 let cumulativeProbability = 0; for (let profile of capacitorProfiles) { cumulativeProbability += profile.probability; if (r < cumulativeProbability) { return profile; } } } function generateCapacitors() { let selectedCapacitorProfile = selectCapacitorProfile(); capacitors = []; // Inizializza l'array capacitors let rows = selectedCapacitorProfile.rows; // Usa il numero di righe dal profilo let cols = selectedCapacitorProfile.cols; // Usa il numero di colonne dal profilo let gridWidth = cols * (selectedCapacitorProfile.radius + selectedCapacitorProfile.horizontalSpacing) - selectedCapacitorProfile.horizontalSpacing; let gridHeight = rows * (selectedCapacitorProfile.radius + selectedCapacitorProfile.verticalSpacing) - selectedCapacitorProfile.verticalSpacing; let margin = 0.35 * canvasSize; // Definisce il margine interno per escludere la zona centrale let startX, startY; // Genera un valore per startX vicino ai margini sinistro o destro if (random(0, 1) < 0.5) { startX = random(0, margin - gridWidth); // Vicino al bordo sinistro } else { startX = random(canvasSize - margin, canvasSize - gridWidth); // Vicino al bordo destro } // Genera un valore per startY senza particolari restrizioni startY = random(0, canvasSize - gridHeight); for (let i = 0; i < rows; i++) { for (let j = 0; j < cols; j++) { let index = i * cols + j; if (index >= selectedCapacitorProfile.count) break; let capacitorX = startX + j * (selectedCapacitorProfile.radius + selectedCapacitorProfile.horizontalSpacing); let capacitorY = startY + i * (selectedCapacitorProfile.radius + selectedCapacitorProfile.verticalSpacing); capacitors.push({ x: capacitorX, y: capacitorY, radius: selectedCapacitorProfile.radius, numCircles: selectedCapacitorProfile.numCircles, animationSpeed: selectedCapacitorProfile.animationSpeed, colors: [ selectedColorProfile.rectColor1, selectedColorProfile.rectColor2, selectedColorProfile.rectColor3 ] }); } } } function randomWeightedEdge(min, max) { let edgePreference = 0.97; // Preferenza per i bordi (più alto è il numero, maggiore è la preferenza per i bordi) let center = (min + max) / 2; let distanceFromCenter = random() < edgePreference ? random() * (center - min) : random() * (max - center); return random() < 0.5 ? center - distanceFromCenter : center + distanceFromCenter; } function drawCapacitors() { for (let capacitor of capacitors) { drawCapacitor(capacitor.x, capacitor.y, capacitor.radius, capacitor.numCircles, capacitor.colors, capacitor.animationSpeed); } } function drawCapacitor(x, y, baseRadius, numCircles, colors, baseAnimationSpeed) { push(); translate(x, y); let elapsedTime = millis(); let cycleTime = 1000; // Durata del ciclo in millisecondi let cycleProgress = (elapsedTime % cycleTime) / cycleTime; // Modula la velocità di rotazione e il diametro in base a dynamo let rotationSpeed = baseAnimationSpeed * dynamo; let radiusMultiplier = map(dynamo, 1, 10, 1, 2); // Aumenta il diametro fino a 2 volte for (let i = 0; i < numCircles; i++) { let angleOffset = map(cycleProgress, 0, 1, 0, TWO_PI) * ((i % 2 === 0) ? 1 : -1); // Alterna il senso di rotazione let currentRadius = baseRadius * (i + 1) / numCircles * radiusMultiplier; let startAngle = angleOffset; let endAngle = startAngle + map(sin(frameCount * rotationSpeed + i * PI / 4), -1, 1, PI/2, PI); stroke(colors[i % colors.length][0], colors[i % colors.length][1], colors[i % colors.length][2], alphaValue/1.5); noFill(); strokeWeight(2); arc(0, 0, currentRadius * 0.5, currentRadius * 0.5, startAngle, endAngle); } pop(); } function updateDynamicBackgroundColors() { let elapsedTime = millis() - lastBackgroundUpdateTime; let transitionDuration = map(dynamo, 1, 10, 2000, 500); // Durata della transizione in millisecondi modulata da dynamo let t = (elapsedTime % transitionDuration) / transitionDuration; let c1, c2; if (t < 0.5) { t = map(t, 0, 0.5, 0, 1); c1 = selectedColorProfile.background1; c2 = selectedColorProfile.background2; } else { t = map(t, 0.5, 1, 0, 1); c1 = selectedColorProfile.background2; c2 = selectedColorProfile.background1; } return lerpColor(color(c1[0], c1[1], c1[2]), color(c2[0], c2[1], c2[2]), t); }