Add space.html

This commit is contained in:
MrLetsplay 2025-02-14 15:32:11 +01:00 committed by MrLetsplay
parent 7853b6992b
commit 0a5d2c2696
Signed by: mr
SSH Key Fingerprint: SHA256:92jBH80vpXyaZHjaIl47pjRq+Yt7XGTArqQg1V7hSqg
37 changed files with 154 additions and 0 deletions

BIN
img/amogus/aubanana.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
img/amogus/aubananadead.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
img/amogus/aublack.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
img/amogus/aublackdead.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
img/amogus/aublue.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
img/amogus/aubluedead.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
img/amogus/aubrown.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
img/amogus/aubrowndead.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
img/amogus/aucoral.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
img/amogus/aucoraldead.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
img/amogus/aucyan.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
img/amogus/aucyandead.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
img/amogus/augray.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
img/amogus/augraydead.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
img/amogus/augreen.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
img/amogus/augreendead.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
img/amogus/aulime.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
img/amogus/aulimedead.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
img/amogus/aumaroon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
img/amogus/aumaroondead.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
img/amogus/auorange.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
img/amogus/auorangedead.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
img/amogus/aupink.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
img/amogus/aupinkdead.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
img/amogus/aupurple.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
img/amogus/aupurpledead.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
img/amogus/aured.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
img/amogus/aureddead.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
img/amogus/aurose.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
img/amogus/aurosedead.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
img/amogus/autan.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
img/amogus/autandead.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
img/amogus/auwhite.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
img/amogus/auwhitedead.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
img/amogus/auyellow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
img/amogus/auyellowdead.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

154
space.html Normal file
View File

@ -0,0 +1,154 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<title>Space</title>
<style>
body {
background-color: black;
position: absolute;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
margin: 0;
padding: 0;
overflow: hidden;
}
canvas {
position: absolute;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
}
</style>
</head>
<body>
<canvas id="space"></canvas>
<script>
let images = [
"aubanana.png",
"aublack.png",
"aublue.png",
"aubrown.png",
"aucoral.png",
"aucyan.png",
"augray.png",
"augreen.png",
"aulime.png",
"aumaroon.png",
"auorange.png",
"aupink.png",
"aupurple.png",
"aured.png",
"aurose.png",
"autan.png",
"auwhite.png",
"auyellow.png",
];
let imagesElements = [];
for (let img of images) {
let i = new Image();
i.src = "https://nsfw.cringe-studios.com/amogus/" + img;
imagesElements.push(i);
}
let space = document.getElementById("space");
let ctx = space.getContext("2d");
// Standard Normal variate using Box-Muller transform.
function gaussianRandom(mean = 0, stdev = 1) {
const u = 1 - Math.random(); // Converting [0,1) to (0,1]
const v = Math.random();
const z = Math.sqrt(-2.0 * Math.log(u)) * Math.cos(2.0 * Math.PI * v);
// Transform to the desired mean and standard deviation:
return z * stdev + mean;
}
function multiplier() {
return Math.random() >= 0.5 ? 1 : -1;
}
let crewmates = [];
for (let i = 0; i < images.length; i++) {
let x = Math.random() * space.clientWidth;
let y = Math.random() * space.clientHeight;
let angle = Math.random() * 360;
let xVel = (Math.random() * 2 + 1) * multiplier();
let yVel = (Math.random() * 2 + 1) * multiplier();
let angleVel = (Math.random() * 1 + 0.1) * multiplier();
let img = i % images.length;
let size = Math.abs(gaussianRandom()) * 0.5 + 0.25;
xVel *= size;
yVel *= size;
crewmates.push({ x, y, angle, xVel, yVel, angleVel, img, size });
}
crewmates.sort((a, b) => a.size - b.size);
let stars = [];
for (let i = 0; i < 100; i++) {
let x = Math.random();
let y = Math.random();
let size = Math.random() * 5 + 3;
stars.push({ x, y, size });
}
setInterval(() => {
space.width = space.clientWidth;
space.height = space.clientHeight;
ctx.fillStyle = "white";
for (let star of stars) {
ctx.fillRect(star.x * space.clientWidth - star.size / 2, star.y * space.clientHeight - star.size / 2, star.size, star.size);
}
let targetImageSize = 256;
let actualImageSize = Math.max(imagesElements[0].width, imagesElements[0].height) * Math.sqrt(2);
let imageScale = targetImageSize / actualImageSize;
for (let crewmate of crewmates) {
crewmate.x += crewmate.xVel;
crewmate.y += crewmate.yVel;
crewmate.angle += crewmate.angleVel;
let delta = crewmate.size * targetImageSize;
if (crewmate.x < -delta) {
crewmate.x += space.width + 2 * delta;
}
if (crewmate.y < -delta) {
crewmate.y += space.height + 2 * delta;
}
if (crewmate.x > space.width + delta) {
crewmate.x -= space.width + 2 * delta;
}
if (crewmate.y > space.height + delta) {
crewmate.y -= space.height + 2 * delta;
}
let img = imagesElements[crewmate.img];
ctx.save();
ctx.translate(crewmate.x, crewmate.y);
ctx.scale(imageScale, imageScale);
ctx.scale(crewmate.size, crewmate.size);
ctx.rotate(crewmate.angle / 360 * Math.PI * 2);
ctx.drawImage(img, -img.width / 2, -img.height / 2);
ctx.restore();
}
}, 20);
</script>
</body>
</html>