-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathhelloworld.html
30 lines (26 loc) · 982 Bytes
/
helloworld.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
<body style=background-color:#000;overflow:hidden;margin:0>
<canvas id=a style=display:block;width:100%;height:100%></canvas>
<script id=fragmentShader type=x-shader/x-fragment>
precision mediump float;
uniform float time;
uniform vec2 resolution;
uniform vec2 mouse;
void main() {
vec2 uv = gl_FragCoord.xy / resolution;
float color = 0.0;
// borrowed from mrdoob :)
color += sin( uv.x * cos( time / 3.0 ) * 65.0 ) + cos( uv.y * cos( time / 2.80 ) * 10.0 );
color += sin( uv.y * sin( time / 10.0 ) * 40.0 ) + cos( uv.x * sin( time / 1.70 ) * 40.0 );
color += sin( uv.x * sin( time / 1.0 ) * 10.0 ) + sin( uv.y * sin( time / 3.50 ) * 80.0 );
color *= sin( time / 10.0 ) * 0.5;
gl_FragColor = vec4( vec3( color * 0.7, sin( color + time / 2.5 ) * 0.9, color), 1.0 );
}
</script>
<script id=vertexShader type=x-shader/x-vertex>
attribute vec3 pos;
void main() {
gl_Position=vec4(pos, 1.0);
}
</script>
<script src=minigl.js></script>
<script src=helloworld.js></script>