-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathindex.html
180 lines (124 loc) · 5.42 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<html>
<head>
<title>Gorillaz - Andromeda in WebGL</title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
<link rel="stylesheet" href="reset.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<script src="js/threejs/three.min.js"></script>
<script src="js/threejs/EffectComposer.js"></script>
<script src="js/threejs/RenderPass.js"></script>
<script src="js/threejs/HueSaturationShader.js"></script>
<script src="js/threejs/ShaderPass.js"></script>
<script src="js/threejs/CopyShader.js"></script>
<script src="js/tweenjs/tween.js"></script>
<script src="js/gui/dat.gui.min.js"></script>
<script src="js/gui/stats.min.js"></script>
<script src="js/objects/PlaneGlow.js"></script>
<script src="js/objects/Planet.js"></script>
<script src="js/objects/SingleMeteor.js"></script>
<script src="js/objects/BackMeteorField.js"></script>
<script src="js/objects/MovingMeteor.js"></script>
<script src="js/objects/MeteorField.js"></script>
<script src="js/objects/Background.js"></script>
<script src="js/objects/Vignette.js"></script>
<script src="js/scenes/BackgroundScene.js"></script>
<script src="js/scenes/BackMeteorsScene.js"></script>
<script src="js/scenes/FrontMeteorsScene.js"></script>
<script src="js/scenes/PlanetScene.js"></script>
<script src="js/scenes/VignetteScene.js"></script>
<script src="js/controllers/PlayerController.js"></script>
<script src="js/controllers/UIController.js"></script>
<script src="js/controllers/AnimationController.js"></script>
<script src="js/Andromeda.js"></script>
<script src="js/app.js"></script>
<script id="vertexShader" type="x-shader/x-vertex">
varying vec2 vUv;
varying vec2 vN;
void main()
{
vUv = uv;
vec4 p = vec4( position, 1. );
vec3 e = normalize( vec3( modelViewMatrix * p ) );
vec3 n = normalize( normalMatrix * normal );
vec3 r = reflect( e, n );
float m = 2. * sqrt(
pow( r.x, 2. ) +
pow( r.y, 2. ) +
pow( r.z + 1., 2. )
);
vN = r.xy / m + .5;
gl_Position = projectionMatrix *
modelViewMatrix *
vec4(position,1.0);
}
</script>
<script id="fragmentShader" type="x-shader/x-fragment">
varying vec2 vUv;
varying vec2 vN;
uniform sampler2D planetTexture;
uniform sampler2D innerGlowTexture;
uniform float innerGlowAlpha;
uniform sampler2D meteorGlowTexture;
uniform float meteorGlowAlpha;
uniform sampler2D shadowTexture;
uniform float shadowAlpha;
uniform float explosionGlowAlpha;
uniform float time;
uniform float flowWaveRadius;
uniform float flowIndex;
void main()
{
float pi = 3.1415926535897932384626433832795;
float easeBase = ( 1.0 - vUv.y * 0.4);
float ease = pow( easeBase , 6.0 );
float offsetY = ( ease + (sin( (vUv.x + flowIndex) * pi * 4.0 ) * vUv.x * vUv.y + 1.0 ) * flowWaveRadius - time * 0.1);
float vUvY = mod( offsetY * 1000.0,1000.0) / 1000.0;
vec2 offsetUv = vec2(vUv.x, vUvY);
vec4 textureColor = texture2D(planetTexture, offsetUv);
vec4 innerGlowTextureColor = texture2D(innerGlowTexture, vN);
vec4 meteorGlowTextureColor = texture2D(meteorGlowTexture, vN);
vec4 shadowTextureColor = texture2D(shadowTexture, vN);
gl_FragColor = vec4(0, 0, 0, 1.0);
gl_FragColor = gl_FragColor + textureColor;
gl_FragColor = gl_FragColor * (shadowAlpha) + gl_FragColor * (shadowTextureColor * (1.0 - shadowAlpha));
gl_FragColor = gl_FragColor + innerGlowTextureColor * innerGlowAlpha;
gl_FragColor = gl_FragColor + meteorGlowTextureColor * meteorGlowAlpha;
gl_FragColor = gl_FragColor + vec4(explosionGlowAlpha, explosionGlowAlpha, explosionGlowAlpha, explosionGlowAlpha);
}
</script>
<div id="container">
<div id="canvascontainer"></div>
<div id="player"></div>
<canvas id='planetCanvas'></canvas>
<div id="overlay">
<div id="info">
<h1 id="title" >Gorillaz - Andromeda<br>in WebGL</h1>
<h2 id="description" >This is a WebGL recreation of the popular music video <a target="_blank" href="https://www.youtube.com/watch?v=9W44NWYwa1g">Gorillaz Andromeda</a>
<br>Check out the <a target="_blank" href="https://medium.com/@yagizgurgul/how-i-recreated-the-music-video-gorillaz-andromeda-with-webgl-f9b0fe55fb17">story</a> behind this.</h2>
<h2 id="preloader" >Loading %0</h2>
<a id="startButton" href="javascript:void(0);">Gorillaz Andromeda</a>
<br />
</div>
<div id="control">
<ul>
<li><a id="fullscreenButton" href="javascript:void(0);">Toggle Fullscreen</a></li>
<li><a target="_blank" href="https://medium.com/@yagizgurgul/how-i-recreated-the-music-video-gorillaz-andromeda-with-webgl-f9b0fe55fb17">Story</a></li>
<li><a target="_blank" href="https://github.com/yagiz/andromeda">Source</a></li>
<li><a target="_blank" href="http://yagiz.me">Blog</a></li>
<li><h3 id="warning">Warning</h3></li>
</ul>
</div>
</div>
</div>
</body>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-18094316-2', 'auto');
ga('send', 'pageview');
</script>
</html>