binbin/templates/404.html

126 lines
2.8 KiB
HTML

<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title>BinBin</title>
<link rel="icon" href="./assets/favicon.ico?v=2">
<link href="https://fonts.googleapis.com/css?family=Roboto+Slab:700" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
</head>
<style>
html, body {
min-height: 100%;
height: 100%;
margin: 0;
font-family: 'Roboto Slab', sans-serif;
-webkit-tap-highlight-color: rgba(0,0,0,0);
-webkit-tap-highlight-color: transparent;
overflow: hidden;
}
body {
display: grid;
background-color: #0e0e0e;
}
h1 {
margin: auto;
font-family: 'Roboto Slab', sans-serif;
font-size: 50vh;
}
#front {
margin: 0;
width: 100%;
height: 100%;
top: 0;
left: 0;
position: absolute;
background: rgba(0,0,0,0.85);
line-height: 100vh;
text-align: center;
z-index: 5;
color: #fff;
mix-blend-mode: overlay;
}
#canvas {
top: 0;
left: 0;
position: absolute;
mix-blend-mode: screen;
}
</style>
<body>
<canvas id="canvas" width=window.innerHeight></canvas>
<h1 id='front'>404</h1>
</body>
<script src="./js/tools.js"></script>
<script>
var t = 0;
function drawCanvas() {
var el = get("canvas")
var c = el.getContext("2d")
var block = 10, space = 2, size = block+space;
var period = 100, freq = 2*Math.PI/period, step = 1.4, base = 0.05;
var col = randColor();
var dir = randDir();
function animCanvas(t, col) {
// To update when window changes.
var w = window.innerWidth, h = window.innerHeight;
var x = w/size, y = h/size;
var offX = -(w-Math.floor(x)*size)/2, offY = -(h-Math.floor(y)*size)/2;
el.width = w, el.height = h;
c.fillStyle = "#0e0e0e";
c.fillRect(0, 0, w, h);
for(var i = 0; i < x+1; i++) {
for(var j = 0; j < y+1; j++) {
var intes = Math.round(step*Math.cos((i+j*dir[0]+t*dir[1])*freq)+step)*0.2/step+base
c.fillStyle = `rgba(${col[0]},${col[1]},${col[2]},${intes})`;
c.fillRect(i*size+offX, j*size+offY, block, block);
}
}
return 1;
}
function randColor() {
var arr = [
128*Math.round(2*Math.random())-1,
128*Math.round(2*Math.random())-1,
128*Math.round(2*Math.random())-1
];
while(arr[0]+arr[1]+arr[2] < 382) arr = randColor();
return arr;
}
function randDir() {
return [
(Math.round(Math.random())) ? -1 : 1,
(Math.round(Math.random())) ? -1 : 1
];
}
setInterval(function() {
t += animCanvas(t, col);
if(t == period) {
t = 0;
newCol = randColor();
while(newCol === col) newCol == randColor();
col = newCol;
}
}, 80);
}
drawCanvas();
</script>
</html>