File size: 1,525 Bytes
6386b0d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// PiForge Ethical Dual-Forge V1.2 Integration JS

class PiForgeEngine {
    constructor() {
        this.resonance = 0;
        this.canvas = document.getElementById('onion-pi-canvas');
        this.ctx = this.canvas.getContext('2d');
    }

    generateFractal() {
        const ctx = this.ctx;
        ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
        for (let i = 0; i < 1000; i++) {
            const x = Math.random() * this.canvas.width;
            const y = Math.random() * this.canvas.height;
            const size = Math.random() * 5 + 1;
            ctx.fillStyle = `rgba(${Math.random()*255}, ${Math.random()*255}, 0, 0.7)`;
            ctx.beginPath();
            ctx.arc(x, y, size, 0, 2*Math.PI);
            ctx.fill();
        }
    }

    increaseResonance(value) {
        this.resonance += value;
        console.log(`Resonance: ${this.resonance}`);
    }
}

class OnionPiViz {
    constructor(engine) {
        this.engine = engine;
        this.animate();
    }

    animate() {
        this.engine.generateFractal();
        requestAnimationFrame(() => this.animate());
    }
}

const forgeEngine = new PiForgeEngine();
const viz = new OnionPiViz(forgeEngine);

// Button actions
document.getElementById('start-audit').addEventListener('click', () => {
    forgeEngine.increaseResonance(100);
    alert('Ethical audit complete! Resonance increased.');
});

document.getElementById('activate-boost').addEventListener('click', () => {
    alert('Mining boost activated! ⛏️');
});