-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
527 lines (481 loc) · 16.9 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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
<!doctype html>
<html>
<head>
<title>3 billion years</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<script src="https://code.jquery.com/jquery.min.js"></script>
<script src="libraries/three.js/Three.js"></script>
<script src="libraries/three.js/Detector.js"></script>
<script src="libraries/three.js/OrbitControls.js"></script>
<script src="libraries/threex/THREEx.screenshot.js"></script>
<script src="libraries/threex/THREEx.WindowResize.js"></script>
<script src="libraries/threex.dragpancontrols.js"></script>
<script src="libraries/threex/THREEx.Debug.js"></script>
<link href="styles/main.css" rel="stylesheet"/>
</head>
<body>
<div class="top left header">
<h1><a href="https://davidson16807.github.io/3billionyears/">3 billion years</a></h1>
<div class="navigation">
<a href="#" id="about">ABOUT</a>
<a href="#" id="credits">CREDITS</a>
<a href="https://github.com/davidson16807/3billionyears">CODE</a>
</div>
</div>
<!-- three.js container -->
<div id="container"></div>
<!-- info on screen display -->
<div id="about-section" class="hidden details">
<p>This is the globe as it would appear in the distant past.</p>
<p>
It is a best guess. Scientists reconstruct maps like this from a number of methods.
The <a href="https://en.wikipedia.org/wiki/Magnetostratigraphy">most common method</a> relies on the way rocks record the past direction of Earth's magnetic field.
This method can be used to determine the orientation and latitude with which a rock formed.
With <a href="https://en.wikipedia.org/wiki/Radiometric_dating">radiochronology</a>, scientists can also determine the time at which a rock formed.
With a large enough dataset, scientists can reconstruct the entire Earth.
</p>
</p>Times prior to 1 billion years have a large uncertainty.</p>
<p>Landmass is color coded by modern day location:</p>
<ul>
<li style="color:IndianRed">Africa</li>
<li style="color:Azure">Antarctica</li>
<li style="color:SlateBlue">Oceania</li>
<li style="color:DarkSlateBlue">Eurasia</li>
<li style="color:OliveDrab">North America</li>
<li style="color:Khaki">South America</li>
</ul>
<p>White landmass has no modern counterpart</p>
</div>
<div id="credits-section" class="hidden details">
<h2>Credits</h2>
<dl style="padding-left:1em">
<dt>Textures</dt>
<dd>revrunnertech2772 (<a href="https://www.youtube.com/channel/UCRr8E9l1JA-RUhTc9NIm8Iw">Algol</a>)</dd>
<dt>Programming</dt>
<dd>Carl Davidson (<a href="https://github.com/davidson16807/">16807</a>)</dd>
<dt>Reconstructions</dt>
<dd>Bruce Eglington</dd>
<dd>Christopher Scotese, <a href="http://www.scotese.com/">PALEOMAP Project</a></dd>
<dd>David Evans</dd>
<dd>Sally Pehrsson</dd>
</dl>
<h2>Citations</h2>
<div style="padding-left:1em">
<p>Scotese, C.R., 2014. <a href="https://youtu.be/tObhGzHH2aw">Animation: Paleogeography (750Ma - Present day)</a>, PALEOMAP Project, Evanston IL.</p>
<p>Eglington, B., Evans, D., Pehrsson, S., 2012. <a href="https://youtu.be/2o9EhDwEzUQ">Animation: Palaeoproterozoic development of the Nuna supercontinent.</a></p>
</div>
<h2>Links</h2>
<dl style="padding-left:1em">
<dt><a href="https://www.youtube.com/watch?v=UwWWuttntio/">Continental Drift: 3.3 Billion Years</a></dt>
<dt><a href="https://www.scotese.com/">PALEOMAP Project</a></dt>
</dl>
<h2>Resources Used</h2>
<div style="padding-left:1em">
GIMP 2·Magic Morph·Camtasia Studio·ConverterLite·ImageMagick·Three.js
</div>
</div>
</div>
<div class="bigbutton">
<img id="loading" src="icons/loading-spin.svg" width="64px" class="hcenter"/>
<img id="play" src="icons/play-circled-512px.svg" width="64px" class="hcenter"/>
<img id="pause" src="icons/pause-circled-512px.svg" width="64px" class="hcenter"/>
</div>
<div class="bottom info" >
<input id="userImage" type="file" class="left"/>
<div class="right">
<span id="time-label">Loading images...</span>
</div>
<input id="time" type="range" min="-3300", max="300" step="10" value="0" style="width:100%;"/>
</div>
<script type="x-shader/x-vertex" id="vertexShader">
varying vec2 vUv;
varying vec4 vPosition;
void main() {
vUv = uv;
vPosition = modelMatrix * vec4( position, 1.0 );
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}
</script>
<script type="x-shader/x-fragment" id="fragmentShader">
const float PI = 3.1415926;
varying vec2 vUv;
varying vec4 vPosition;
uniform sampler2D texture1;
float mollweide_x(float theta, float lon){
return 2.*sqrt(2.)/PI * lon * cos(theta);
}
float mollweide_y(float theta){
return sqrt(2.) * sin(theta);
}
float mollweide_theta(float theta, float lat){
return theta - (2.*theta + sin(2.*theta) - PI*sin(lat)) /
(2. + 2.*cos(2.*theta));
}
void main() {
float lat = asin(vPosition.y);
float lon = atan(vPosition.x, vPosition.z);
float theta = lat;
if(abs(lat) != PI/2.){
theta = mollweide_theta(theta, lat);
theta = mollweide_theta(theta, lat);
theta = mollweide_theta(theta, lat);
theta = mollweide_theta(theta, lat);
theta = mollweide_theta(theta, lat);
}
float y = mollweide_y(theta);
float x = mollweide_x(theta, lon);
vec2 uv = (vec2(x,y) / (vec2(2,1) * sqrt(2.)) + 1.) / 2.;
gl_FragColor = texture2D(texture1, uv); //vec4(lon, lat, 0,1);// //vec4(uv,0,1); //
}
</script>
<script type="text/javascript">
var textures = {
"-3300": { url: "117.9.-3300m.png" },
"-3000": { url: "118.9.-3000m.png" },
"-2750": { url: "119.9.-2750m.png" },
"-2500": { url: "120.9.-2500m.png" },
"-2250": { url: "121.9.-2250m.png" },
"-2200": { url: "122.9.-2200m.png" },
"-2160": { url: "123.9.-2160m.png" },
"-2130": { url: "124.9.-2130m.png" },
"-2100": { url: "125.9.-2100m.png" },
"-2080": { url: "126.9.-2080m.png" },
"-2060": { url: "127.9.-2060m.png" },
"-2040": { url: "128.9.-2040m.png" },
"-2020": { url: "129.9.-2020m.png" },
"-2000": { url: "130.9.-2000m.png" },
"-1980": { url: "131.9.-1980m.png" },
"-1960": { url: "132.9.-1960m.png" },
"-1940": { url: "133.9.-1940m.png" },
"-1920": { url: "134.9.-1920m.png" },
"-1900": { url: "135.9.-1900m.png" },
"-1880": { url: "136.9.-1880m.png" },
"-1860": { url: "137.9.-1860m.png" },
"-1840": { url: "138.9.-1840m.png" },
"-1830": { url: "139.8.-1830m.png" },
"-1820": { url: "139.9.-1820m.png" },
"-1800": { url: "140.9.-1800m.png" },
"-1780": { url: "141.9.-1780m.png" },
"-1760": { url: "142.9.-1760m.png" },
"-1740": { url: "143.9.-1740m.png" },
"-1720": { url: "144.9.-1720m.png" },
"-1700": { url: "145.9.-1700m.png" },
"-1680": { url: "146.9.-1680m.png" },
"-1660": { url: "147.9.-1660m.png" },
"-1640": { url: "148.9.-1640m.png" },
"-1620": { url: "149.9.-1620m.png" },
"-1600": { url: "150.9.-1600m.png" },
"-1580": { url: "151.9.-1580m.png" },
"-1560": { url: "152.9.-1560m.png" },
"-1540": { url: "153.9.-1540m.png" },
"-1520": { url: "154.9.-1520m.png" },
"-1500": { url: "155.9.-1500m.png" },
"-1480": { url: "156.9.-1480m.png" },
"-1460": { url: "157.9.-1460m.png" },
"-1440": { url: "158.9.-1440m.png" },
"-1420": { url: "159.9.-1420m.png" },
"-1400": { url: "160.9.-1400m.png" },
"-1380": { url: "161.9.-1380m.png" },
"-1350": { url: "162.9.-1350m.png" },
"-1300": { url: "163.9.-1300m.png" },
"-1250": { url: "164.9.-1250m.png" },
"-1200": { url: "165.9.-1200m.png" },
"-1150": { url: "166.9.-1150m.png" },
"-1120": { url: "167.7.-1120m.png" },
"-1100": { url: "167.9.-1100m.png" },
"-1050": { url: "168.9.-1050m.png" },
"-1000": { url: "169.9.-1000m.png" },
"-950": { url: "170.9.-950m.png" },
"-900": { url: "171.9.-900m.png" },
"-850": { url: "172.9.-850m.png" },
"-800": { url: "173.9.-800m.png" },
"-750": { url: "174.-750m.png" },
"-740": { url: "175.-740m.png" },
"-730": { url: "176.-730m.png" },
"-720": { url: "177.-720m.png" },
"-710": { url: "178.-710m.png" },
"-700": { url: "179.-700m.png" },
"-690": { url: "180.-690m.png" },
"-680": { url: "181.-680m.png" },
"-670": { url: "182.-670m.png" },
"-660": { url: "183.-660m.png" },
"-650": { url: "184.-650m.png" },
"-640": { url: "185.-640m.png" },
"-630": { url: "186.-630m.png" },
"-620": { url: "187.-620m.png" },
"-610": { url: "188.-610m.png" },
"-600": { url: "189.-600m.png" },
"-590": { url: "190.-590m.png" },
"-580": { url: "191.-580m.png" },
"-570": { url: "192.-570m.png" },
"-560": { url: "193.-560m.png" },
"-550": { url: "194.-550m.png" },
"-540": { url: "195.-540m.png" },
"-530": { url: "196.-530m.png" },
"-520": { url: "197.-520m.png" },
"-510": { url: "198.-510m.png" },
"-500": { url: "199.-500m.png" },
"-490": { url: "200.-490m.png" },
"-480": { url: "201.-480m.png" },
"-470": { url: "202.-470m.png" },
"-460": { url: "203.-460m.png" },
"-450": { url: "204.-450m.png" },
"-440": { url: "205.-440m.png" },
"-430": { url: "206.-430m.png" },
"-420": { url: "207.-420m.png" },
"-410": { url: "208.-410m.png" },
"-400": { url: "209.-400m.png" },
"-390": { url: "210.-390m.png" },
"-380": { url: "211.-380m.png" },
"-370": { url: "212.-370m.png" },
"-360": { url: "213.-360m.png" },
"-350": { url: "214.-350m.png" },
"-340": { url: "215.-340m.png" },
"-330": { url: "216.-330m.png" },
"-320": { url: "217.-320m.png" },
"-310": { url: "218.-310m.png" },
"-300": { url: "219.-300m.png" },
"-290": { url: "220.-290m.png" },
"-280": { url: "221.-280m.png" },
"-270": { url: "222.-270m.png" },
"-260": { url: "223.-260m.png" },
"-250": { url: "224.-250m.png" },
"-240": { url: "225.-240m.png" },
"-230": { url: "226.-230m.png" },
"-220": { url: "227.-220m.png" },
"-210": { url: "228.-210m.png" },
"-200": { url: "229.-200m.png" },
"-190": { url: "230.-190m.png" },
"-180": { url: "231.-180m.png" },
"-170": { url: "232.-170m.png" },
"-160": { url: "233.-160m.png" },
"-150": { url: "234.-150m.png" },
"-140": { url: "235.-140m.png" },
"-130": { url: "236.-130m.png" },
"-120": { url: "237.-120m.png" },
"-110": { url: "238.-110m.png" },
"-100": { url: "239.-100m.png" },
"-90": { url: "240.-90m.png" },
"-80": { url: "241.-80m.png" },
"-70": { url: "242.-70m.png" },
"-60": { url: "243.-60m.png" },
"-50": { url: "244.-50m.png" },
"-40": { url: "245.-40m.png" },
"-30": { url: "246.-30m.png" },
"-20": { url: "247.-20m.png" },
"-10": { url: "248.-10m.png" },
"0": { url: "249.0m.png" },
"+12.5": { url: "251.+12.5m.png" },
"+25": { url: "252.+25m.png" },
"+37.5": { url: "253.+37.5m.png" },
"+50": { url: "254.+50m.png" },
"+62.5": { url: "255.+62.5m.png" },
"+75": { url: "256.+75m.png" },
"+87.5": { url: "257.+87.5m.png" },
"+100": { url: "258.+100m.png" },
"+112.5": { url: "259.+112.5m.png" },
"+125": { url: "260.+125m.png" },
"+137.5": { url: "261.+137.5m.png" },
"+150": { url: "262.+150m.png" },
"+162.5": { url: "263.+162.5m.png" },
"+175": { url: "264.+175m.png" },
"+187.5": { url: "265.+187.5m.png" },
"+200": { url: "266.+200m.png" },
"+212.5": { url: "267.+212.5m.png" },
"+225": { url: "268.+225m.png" },
"+237.5": { url: "269.+237.5m.png" },
"+250": { url: "270.+250m.png" },
"+275": { url: "270.+275m.png" },
"+300": { url: "270.+300m.png" },
}
// textures = {
// "-410": { url: "old/410ma.PNG" },
// "-390": { url: "old/390ma.PNG" },
// "-370": { url: "old/370ma.PNG" },
// "-350": { url: "old/350ma.PNG" },
// "-330": { url: "old/330ma.PNG" },
// "-310": { url: "old/310ma.PNG" },
// "-290": { url: "old/290ma.PNG" },
// "-270": { url: "old/270ma.PNG" },
// "-250": { url: "old/250ma.PNG" },
// }
var scene, renderer, composer, clock;
var camera, cameraControl;
var image = document.createElement( 'img' );
var shader = new THREE.ShaderMaterial({
vertexShader: document.getElementById('vertexShader').textContent,
fragmentShader: document.getElementById('fragmentShader').textContent,
uniforms: {
texture1: {
type: "t",
value: new THREE.Texture( image )
}
}
});
var geometry = new THREE.IcosahedronGeometry(1, 5);
var mesh = new THREE.Mesh( geometry, shader );
var MegaYearsPerSecond = 20;
var Paused = true;
var Time = 0;
if( !init() ){
animate();
}
// init the scene
function init(){
clock = new THREE.Clock();
if( Detector.webgl ){
renderer = new THREE.WebGLRenderer({
antialias : true, // to get smoother output
preserveDrawingBuffer : true // to allow screenshot
});
renderer.setClearColor( 0x000000 );
}else{
Detector.addGetWebGLMessage();
return true;
}
renderer.setSize( window.innerWidth, window.innerHeight );
document.getElementById('container').appendChild(renderer.domElement);
// create a scene
scene = new THREE.Scene();
// put a camera in the scene
camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 1, 10000 );
camera.position.set(0, 0, 5);
scene.add(camera);
// create a camera contol
cameraControls = new THREE.OrbitControls( camera, $("#container").get(0) );
// transparently support window resize
THREEx.WindowResize.bind(renderer, camera);
// allow 'p' to make screenshot
THREEx.Screenshot.bindKey(renderer);
// here you add your objects
// - you will most likely replace this part by your own
var light = new THREE.AmbientLight( 0xffffff );
scene.add( light );
scene.add( mesh );
}
// animation loop
function animate() {
// loop on request animation loop
// - it has to be at the begining of the function
// - see details at http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
requestAnimationFrame( animate );
// variable which is increase by Math.PI every seconds - usefull for animation
var PIseconds = Date.now() * Math.PI;
// update camera controls
cameraControls.update();
// actually render the scene
renderer.render( scene, camera );
if(Paused){
return;
}
var seconds = clock.getDelta();
if (seconds > 1){
seconds = 1;
}
var timestep = seconds * MegaYearsPerSecond;
Time += timestep;
loadTime(Time);
}
function min(list, getKey) {
var value = Infinity;
var result = void 0;
for (var i = 0, li = list.length; i < li; i++) {
var element = list[i];
var key = getKey(element);
if(key < value){
value = key;
result = element;
}
};
return result;
};
function format (time) {
if(time > 0){
return ""+time+" Million years hence"
} else if (time == 0){
return "Present Day";
} else {
return ""+Math.abs(time)+" Million years ago"
}
}
function loadTexture (texture){
shader.uniforms.texture1.value = texture;
shader.uniforms.texture1.needsUpdate = true;
shader.needsUpdate = true;
}
function loadFile (texture_file) {
var reader = new FileReader();
reader.onload = function (e) {
var image = document.createElement( 'img' );
var texture = new THREE.Texture( image );
image.onload = function() {
texture.needsUpdate = true;
};
image.src = e.target.result;
loadTexture(texture);
};
reader.readAsDataURL(texture_file);
}
function loadUrl (texture_url) {
texture = THREE.ImageUtils.loadTexture( texture_url );
loadTexture(texture_url);
}
function loadTime (time) {
var keys = Object.keys(textures);
var key = min(keys, function(key) {
return Math.abs(time - key);
});
var texture = textures[key].texture;
loadTexture(texture);
$('#time-label').text(format(parseInt(key)));
$('#time').val(time);
}
$(function () {
$('#play').hide();
$('#pause').hide();
var keys = Object.keys(textures);
$('#time').attr({
'min': min(keys, function(key) { return Number(key) }),
'max': min(keys, function(key) { return -Number(key) }),
'value': min(keys, function(key) { return Math.abs(key) })
});
for (var i = 0, li = Object.keys(textures).length; i < li; i++) {
var key = keys[i];
textures[key].texture = THREE.ImageUtils.loadTexture( "maps/" + textures[key].url );
};
$('#loading').hide();
$('#play').show();
loadTime(0);
});
$('#time').bind('input', function(event) {
Time = parseInt($('#time').val());
loadTime(Time);
});
$("#userImage").change(function(){
userImage = $("#userImage")[0];
if (userImage.files && userImage.files[0]) {
loadFile(userImage.files[0])
}
});
$('#play').click(function () {
$('#play').toggle();
$('#pause').toggle();
Paused = false;
});
$('#pause').click(function () {
$('#play').toggle();
$('#pause').toggle();
Paused = true;
});
$('#about').click(function(event) {
$('#credits-section').hide();
$('#about-section').toggle();
});
$('#credits').click(function(event) {
$('#about-section').hide();
$('#credits-section').toggle();
});
</script>
</body>
</html>