-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
101 lines (79 loc) · 2.28 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Zen Islands</title>
<link rel="icon" type="image/x-icon" href="/img/favicon.ico">
<style>
body {
margin: 0;
font-family:Arial, Helvetica, sans-serif;
background-color: #1b1b1b;
}
#info {
position: absolute;
top: 10px;
width: 100%;
text-align: center;
z-index: 100;
display:block;
color: white;
font-style:italic;
opacity: 0.7;
}
#info a {
color: #b52426;
text-decoration: none;
}
#info a:hover {
text-decoration: underline;
}
#loadingDiv {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
/* background-color: rgba(255, 255, 255, 0.8); */
color: #ccc;
padding: 10px;
/* border-radius: 5px; */
font-size: 2em;
}
</style>
<script async src="https://unpkg.com/[email protected]/dist/es-module-shims.js"></script>
<!-- <script src="https://raw.githubusercontent.com/adambom/parallel.js/master/lib/parallel.js"></script> -->
<script src='https://unpkg.com/[email protected]/lib/parallel.js'></script>
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/[email protected]/build/three.module.js",
"three/addons/": "https://unpkg.com/[email protected]/examples/jsm/"
}
}
</script>
</head>
<body>
<div id="info">Drag to rotate. Pinch/scroll to zoom. Refresh page to regenerate. <a href="https://github.com/bsecker/zen-islands">Github</a></div>
<script type="x-shader/x-vertex" id="vertexShader">
varying vec3 vWorldPosition;
void main() {
vec4 worldPosition = modelMatrix * vec4( position, 1.0 );
vWorldPosition = worldPosition.xyz;
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}
</script>
<script type="x-shader/x-fragment" id="fragmentShader">
uniform vec3 topColor;
uniform vec3 bottomColor;
uniform float offset;
uniform float exponent;
varying vec3 vWorldPosition;
void main() {
float h = normalize( vWorldPosition + offset ).y;
gl_FragColor = vec4( mix( bottomColor, topColor, max( pow( max( h , 0.0), exponent ), 0.0 ) ), 1.0 );
}
</script>
<div id="loadingDiv">Loading...</div>
<script type="module" src="/main.ts"></script>
</body>
</html>