File size: 2,838 Bytes
5315a8d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8bb606b
5315a8d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>NeuroFractal Vision</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <style>
    html, body {
      margin: 0; padding: 0;
      background: black;
      overflow: hidden;
      font-family: monospace;
    }
    #hydra-canvas {
      position: absolute;
      top: 0; left: 0;
      width: 100vw;
      height: 100vh;
      image-rendering: pixelated;
      z-index: 0;
    }
    #terminal {
      position: absolute;
      bottom: 0;
      width: 100%;
      height: 200px;
      background: rgba(0,0,0,0.75);
      color: white;
      border: none;
      padding: 10px;
      resize: none;
      font-size: 14px;
      line-height: 1.4;
      z-index: 2;
    }
    #btns {
      position: absolute;
      top: 10px;
      left: 10px;
      z-index: 3;
    }
    button {
      background: #222;
      color: white;
      border: 1px solid #555;
      padding: 6px 10px;
      margin-right: 5px;
      font-size: 12px;
      cursor: pointer;
    }
  </style>
</head>
<body>
  <canvas id="hydra-canvas"></canvas>

  <div id="btns">
    <button onclick="terminal.style.display = terminal.style.display === 'none' ? 'block' : 'none'">🧠 Открыть терминал</button>
    <button onclick="eval(terminal.value)">▶️ Запуск кода</button>
    <button onclick="insertDream()">💤 Нейросон</button>
  </div>

  <textarea id="terminal" spellcheck="false" style="display:none"></textarea>

  <script src="https://unpkg.com/hydra-synth"></script>
  <script>
    const canvas = document.getElementById("hydra-canvas");
    canvas.width = window.innerWidth * window.devicePixelRatio;
    canvas.height = window.innerHeight * window.devicePixelRatio;

    const hydra = new Hydra({
      detectAudio: false,
      canvas: canvas,
      width: canvas.width,
      height: canvas.height,
      pixelRatio: window.devicePixelRatio
    });

    // Запрашиваем видео и аудио
    navigator.mediaDevices.getUserMedia({ video: true, audio: true })
      .then(stream => {
        const video = document.createElement("video");
        video.srcObject = stream;
        video.autoplay = true;
        video.muted = true;
        video.onloadedmetadata = () => {
          s0.init({ src: video });
        };
      });

    // Основной нейро-фрактальный сон
    function insertDream() {
      terminal.value = `src(s0)
  .modulate(voronoi(9, 0.2, 0.8).scale(1.4), 0.1)
  .add(
    osc(4, 0.1, 0.3)
      .color(0.2, 0.7, 1)
      .modulate(noise(3), 0.05)
      .scale(() => 0.9 + 0.1 * Math.sin(time * 0.5))
  )
  .blend(src(o0), 0.5)
  .out()`;
      eval(terminal.value);
      terminal.style.display = 'block';
    }

    insertDream();
  </script>
</body>
</html>