Imported.

This commit is contained in:
flash 2024-06-25 23:36:48 +02:00
commit 2612371b0e
8 changed files with 230 additions and 0 deletions

BIN
8bitoperator-JVE.woff Normal file

Binary file not shown.

BIN
8bitoperator-JVE.woff2 Normal file

Binary file not shown.

BIN
admin.caf Normal file

Binary file not shown.

93
admin.css Normal file
View file

@ -0,0 +1,93 @@
@font-face {
font-family: '8bitoperator JVE';
src: url('8bitoperator-JVE.woff2') format('woff2'),
url('8bitoperator-JVE.woff') format('woff');
font-weight: normal;
font-style: normal;
font-display: swap;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
position: relative;
}
html, body {
width: 100%;
height: 100%;
}
body {
color: #000;
background: #fff;
font-family: '8bitoperator JVE', System;
}
.hidden {
display: none;
visibility: hidden;
}
.play {
position: absolute;
top: 0;
right: 0;
left: 0;
bottom: 0;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
background: #000;
color: #fff;
z-index: 9001;
}
.bars {
position: absolute;
top: 0;
right: 0;
left: 0;
bottom: 0;
width: 100%;
height: 100%;
display: grid;
grid-template-columns: 1fr;
grid-template-rows: repeat(5, 1fr);
}
.bar {
overflow: hidden;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
font-size: 25vh;
font-size: 25dvh;
letter-spacing: 5px;
}
.girl {
position: fixed;
top: 0;
right: 0;
left: 0;
bottom: 0;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.sprite {
flex-shrink: 0;
flex-grow: 0;
width: 100%;
height: 52vh;
height: 52dvh;
image-rendering: crisp-edges;
}

110
admin.js Normal file
View file

@ -0,0 +1,110 @@
(() => {
const updateRate = 1000 / 10;
const sWidth = 224;
const sHeight = 208;
const colours = ['#0f9', '#ff9', '#f09', '#0ff', '#f0f'];
const gfx = document.querySelector('.sprite').getContext('2d');
const play = document.querySelector('.play');
const bars = Array.from(document.querySelectorAll('.bar'));
let audioBuffer;
const knowsWhatAnOpusIs = document.createElement('audio').canPlayType('audio/ogg;codecs=opus') !== '';
const displayPlayButton = () => {
play.onclick = () => { attemptPlay(); };
play.classList.remove('hidden');
};
const startAnimation = () => {
play.classList.add('hidden');
requestAnimationFrame(update);
};
const aud = (() => {
const audObj = window.AudioContext || window.webkitAudioContext;
try {
return new audObj({ latencyHint: 'playback' });
} catch(ex) {
return new audObj;
}
})();
const attemptPlay = () => {
play.onclick = null;
aud.resume().then(() => {
if(aud.state !== 'running') {
displayPlayButton();
return;
}
aud.decodeAudioData(audioBuffer)
.then(buffer => {
const source = aud.createBufferSource();
source.connect(aud.destination);
source.buffer = buffer;
source.loop = true;
source.start();
startAnimation();
})
.catch(ex => {
console.error(ex);
alert('Failed to decode audio, oops!');
startAnimation();
});
});
};
let sFrames;
const sprite = new Image;
sprite.onload = () => {
sFrames = sprite.height / sHeight;
const xhr = new XMLHttpRequest;
xhr.responseType = 'arraybuffer';
xhr.onload = () => {
audioBuffer = xhr.response;
if(aud.state === 'running')
attemptPlay();
else
displayPlayButton();
};
xhr.onerror = ex => {
console.error(ex);
alert('Failed to load audio, oops!');
startAnimation();
};
xhr.open('GET', `admin.${knowsWhatAnOpusIs ? 'opus' : 'caf'}`);
xhr.send();
};
sprite.src = 'lurkmoar.png';
let lastUpdate, updates = 0;
const update = t => {
try {
if(lastUpdate !== undefined && t - updateRate < lastUpdate)
return;
++updates;
lastUpdate = t;
gfx.canvas.width = gfx.canvas.clientWidth;
gfx.clearRect(0, 0, gfx.canvas.width, gfx.canvas.height);
const saWidth = sWidth * (gfx.canvas.clientHeight / sHeight);
gfx.drawImage(
sprite,
0, sHeight * (updates % sFrames),
sWidth, sHeight,
(gfx.canvas.width / 2) - (saWidth / 2), 0,
saWidth, gfx.canvas.height
);
for(let i = 0; i < bars.length; ++i)
bars[i].style.background = colours[(i + updates) % colours.length];
} finally {
requestAnimationFrame(update);
}
};
})();

BIN
admin.opus Normal file

Binary file not shown.

27
index.html Normal file
View file

@ -0,0 +1,27 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, viewport-fit=cover">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<title>Admin</title>
<link href=admin.css rel=stylesheet>
</head>
<body>
<div class="play hidden">
Your browser smells and doesn't allow autoplay.<br>
Click or tap anywhere to start playing.
</div>
<div class=bars>
<div class=bar>LURK</div>
<div class=bar></div>
<div class=bar></div>
<div class=bar></div>
<div class=bar>MORE</div>
</div>
<div class=girl>
<canvas class=sprite width=224 height=208></canvas>
</div>
<script src=admin.js></script>
</body>
</html>

BIN
lurkmoar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 KiB