April fools
This commit is contained in:
parent
5a33742e13
commit
9958c6e872
@ -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
32
special/april-fools.js
Normal 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;
|
||||||
|
})
|
Loading…
Reference in New Issue
Block a user