April fools

This commit is contained in:
MrLetsplay 2024-03-08 19:51:51 +01:00
parent 5a33742e13
commit 9958c6e872
Signed by: mr
SSH Key Fingerprint: SHA256:92jBH80vpXyaZHjaIl47pjRq+Yt7XGTArqQg1V7hSqg
2 changed files with 33 additions and 0 deletions

View File

@ -20,6 +20,7 @@
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js"></script>
<script src="special/new-year.js" defer></script> <script src="special/new-year.js" defer></script>
<script src="special/april-fools.js" defer></script>
<style> <style>

32
special/april-fools.js Normal file
View File

@ -0,0 +1,32 @@
let websiteScale = 1;
let OVERRIDE_APRIL_FOOLS = false;
setInterval(() => {
const theTime = new Date();
if (!OVERRIDE_APRIL_FOOLS && (theTime.getDate() != 1 || theTime.getMonth() != 3)) {
document.body.style.transition = undefined;
document.body.style.transform = undefined;
return;
}
document.body.style.transition = "all linear 0.1s";
document.body.style.transform = "scale(" + websiteScale + ")";
websiteScale *= 0.95;
}, 100);
let oldMouseX, oldMouseY;
let oldMouseTime;
document.addEventListener("mousemove", (ev) => {
let time = new Date().getTime();
if(oldMouseX !== undefined || oldMouseY !== undefined) {
let dist = Math.sqrt(Math.pow(oldMouseX - ev.x, 2) + Math.pow(oldMouseY - ev.y, 2));
let velocity = dist / (time - oldMouseTime);
websiteScale = Math.min(1, websiteScale * 1 + velocity/750);
}
oldMouseX = ev.x;
oldMouseY = ev.y;
oldMouseTime = time;
})