Math.sin.time / index.html
Dmtlant's picture
Update index.html
5315a8d verified
<!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>