Skip to content

Instantly share code, notes, and snippets.

@RoootTheFox
Created April 13, 2023 22:33
Show Gist options
  • Save RoootTheFox/f2853a0014956974fe2be94736bd1666 to your computer and use it in GitHub Desktop.
Save RoootTheFox/f2853a0014956974fe2be94736bd1666 to your computer and use it in GitHub Desktop.
yippie!!1 (this is a bday shitpost)
<!DOCTYPE html>
<head>
<title>nya</title>
<script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.6.0/dist/confetti.browser.min.js"></script>
<style>
#time {
margin: 0;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 50px;
font-family: "Torus";
font-weight: 600;
color: #94e2d5;
width: 100vw;
text-align: center;
}
</style>
<script>
function unfuckTime(h) {
if (h < 10) {
return "0" + h;
}
return h;
}
function balls() {
let date = new Date();
let hours = unfuckTime(date.getHours());
let minutes = unfuckTime(date.getMinutes());
let seconds = unfuckTime(date.getSeconds());
let day = date.getDay();
let month = date.getMonth();
let year = date.getFullYear();
const monthNames = ["January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
];
let monthName = monthNames[month];
let txt;
if (hours == "00") {
txt = "14th April 2023";
var myCanvas = document.createElement('canvas');
document.body.appendChild(myCanvas);
var myConfetti = confetti.create(myCanvas, {
resize: true,
useWorker: true
});
myConfetti({
particleCount: 100,
spread: 160
// any other options from the global
// confetti function
});
} else {
txt = "13th April 2023";
}
txt += " " + hours + ":" + minutes + ":" + seconds;
document.getElementById("time").innerHTML = txt;
}
setInterval(balls, 100);
</script>
</head>
<body bgcolor="#1e1e2e">
<p id="time"></p>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment