Birthday confetti
This commit is contained in:
parent
6f4b8f5296
commit
0293db6a8d
|
@ -22,6 +22,15 @@ body {
|
|||
margin: 32px;
|
||||
}
|
||||
|
||||
#ConfettiCanvas {
|
||||
Position: Relative;
|
||||
Top: 0;
|
||||
Left: 0;
|
||||
Width: 100%;
|
||||
Height: 100%;
|
||||
Z-Index: 2;
|
||||
}
|
||||
|
||||
.Content {
|
||||
background-color: rgba(0,0,0, 0.8);
|
||||
width: 100%;
|
||||
|
|
|
@ -1,9 +1,55 @@
|
|||
const CurrentAgeElem = document.getElementById("CurrentAge");
|
||||
const RefreshTime = 50;
|
||||
|
||||
function UpdateHTML() {
|
||||
CurrentAgeElem.innerHTML =
|
||||
"Currently " + UnixToYears() + " years old..";
|
||||
const ConfettiSleep = 600;
|
||||
const ConfettiIter = 32;
|
||||
|
||||
var ConfettiCalled = false;
|
||||
|
||||
var SoundObject = new Audio( // Borrowed music: https://0101.bandcamp.com/track/fireworks
|
||||
"https://matrix-client.matrix.org/_matrix/media/r0/download/matrix.org/bPhubIokhLQpTfMZhNsVucVO");
|
||||
SoundObject.muted = true;
|
||||
|
||||
function Sleep(ms) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
setInterval(UpdateHTML, RefreshTime);
|
||||
async function Confetti() {
|
||||
for (let i = 0; i < ConfettiIter; i++) {
|
||||
const ConfettiCanvas = document.getElementById('ConfettiCanvas');
|
||||
const JsConfetti = new JSConfetti({ConfettiCanvas});
|
||||
JsConfetti.addConfetti({
|
||||
emojis: [
|
||||
'🌈', '⚡️', '💥',
|
||||
'✨', '💫', '🌸',
|
||||
'🏳️⚧️️', '🎉️', '🎊️',
|
||||
'🏳️🌈️', '🎈️', '🎆️',
|
||||
'💘️', '💝️', '💖️',
|
||||
'💗️', '💞️', '❤️',
|
||||
'💛️', '💚️', '💜️',
|
||||
'🤎️', '🖤️', '🤍️',
|
||||
]
|
||||
});
|
||||
JsConfetti.addConfetti();
|
||||
await Sleep(ConfettiSleep);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function UpdateAge() {
|
||||
let Years = UnixToYears();
|
||||
CurrentAgeElem.innerHTML = "Currently " + Years + " years old..";
|
||||
if ((Years % 1 == 0) && (!ConfettiCalled)) {
|
||||
Confetti();
|
||||
ConfettiCalled = true;
|
||||
}
|
||||
// music playing code
|
||||
}
|
||||
|
||||
setInterval(UpdateAge, RefreshTime);
|
||||
|
||||
function ClickBody() {
|
||||
SoundObject.muted = false;
|
||||
}
|
||||
document.body.addEventListener("click", ClickBody);
|
||||
|
||||
|
|
|
@ -11,12 +11,16 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="shortcut icon" href="favicon.png" type="image/x-icon">
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/js-confetti@latest/dist/js-confetti.browser.js"></script>
|
||||
|
||||
<link href="Assets/CSS/Dark.css" rel="stylesheet">
|
||||
<script src="Assets/JS/RandomGIF.js"></script>
|
||||
<script src="Assets/JS/CurrentAge.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="ConfettiCanvas"></div>
|
||||
<div class="Content" style="text-align: center;">
|
||||
<h1>OctoSpacc Place</h1><br><br>
|
||||
<p>
|
||||
|
|
Loading…
Reference in New Issue