-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
57 lines (53 loc) · 1.54 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title><hydra-element></title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🍬</text></svg>">
<style>
body {
margin: 0;
font-family: monospace;
background-color: #242427;
}
textarea {
width: 100%;
height: 100%;
z-index: 1;
position: fixed;
color: #d6bb21;
background: transparent;
border: 0;
}
textarea:focus {
outline: none;
}
hydra-element {
width: 100%;
height: 100vh;
display: flex;
}
</style>
<script defer>
const keypressHandler = (event) => {
if (event.key === '\n') {
document.querySelector('hydra-element').code = document.querySelector('textarea').value
}
}
window.onload = () => document.querySelector('hydra-element').transforms = [{
name: 'noixe',
type: 'src',
inputs: [
{ type: 'float', name: 'scale', default: 5 },
{ type: 'float', name: 'offset', default: 0.5 }
],
glsl: `return vec4(vec3(_noise(vec3(_st*scale, offset*time))), 0.5);`
}]
</script>
<script type="module" src="./index.js"></script>
</head>
<body onkeypress="keypressHandler(event)">
<textarea name="editor" spellcheck="false"></textarea>
<hydra-element audio="true"></hydra-element>
</body>
</html>