-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
37 lines (32 loc) · 828 Bytes
/
index.js
File metadata and controls
37 lines (32 loc) · 828 Bytes
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
//
// "Prelude"
//
var fitter = document.querySelector('[data-fit]')
require("scrollbar-width") // this asshole makes window.SCROLLBAR_WIDTH
refit()
window.addEventListener('resize', refit, false)
function refit() {
if (!fitter) return
fitter.style.width = (window.innerWidth - window.SCROLLBAR_WIDTH) + 'px'
fitter.style.height = window.innerHeight + 'px'
}
var preloader = document.getElementById('preloader')
setTimeout(function() {
preloader.style.opacity = 0
setTimeout(function() {
preloader.style.display = 'none'
}, 600)
}, 500)
if (isGood()) {
// only load 3Dness if good
require('./scene')
}
function isGood() {
try {
if (!window.WebGLRenderingContext) return false
return (!!document.createElement('canvas').getContext("webgl"))
} catch(e) {
return false
}
return true
}