Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions file/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,19 @@ a {
font-size: 25px;
font-family: monospace;

}

.falling-heart {
position: fixed;
font-size: 30px;
pointer-events: none;
z-index: 999;
animation: fall linear forwards;
}

@keyframes fall {
to {
transform: translateY(100vh) rotate(360deg);
opacity: 0;
}
}
39 changes: 38 additions & 1 deletion file/function.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,41 @@ function timeElapse(date){
var text = "THE WORLD JUST GOT LUCKIER SINCE ";
$("#message-box").html(text);

}
}

//heart falling animation
function createHeart() {
const heart = document.createElement('div');
heart.classList.add('falling-heart');
heart.innerHTML = '❀️';

// use random colors
const colors = [
'rgba(255, 182, 193, 0.4)',
'rgba(255, 105, 180, 0.4)',
'rgba(255, 20, 147, 0.4)',
'rgba(255, 0, 0, 0.4)',
'rgba(255, 69, 0, 0.4)',
'rgba(255, 192, 203, 0.4)',
'rgba(255, 160, 122, 0.4)'
];

const randomColor = colors[Math.floor(Math.random() * colors.length)];
heart.style.color = randomColor;
heart.style.left = Math.random() * 100 + 'vw';
heart.style.top = '-50px';
heart.style.fontSize = (Math.random() * 20 + 20) + 'px';

const duration = Math.random() * 3 + 3;
heart.style.animationDuration = duration + 's';

document.body.appendChild(heart);

setTimeout(() => {
heart.remove();
}, duration * 1000);
}

function startHeartRain() {
setInterval(createHeart, 200);
}
5 changes: 2 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<script type="text/javascript" src="file/jscex-async-powerpack.min.js"></script>
<script type="text/javascript" src="file/function.js" charset="utf-8"></script>
<script type="text/javascript" src="file/love.js" charset="utf-8"></script>
<script type="text/javascript" src="file/hearts.js" charset="utf-8"></script>
<script>
function playAudio() {
var audio = document.getElementById("myAudio");
Expand Down Expand Up @@ -159,13 +160,11 @@
tree.snapshot("p2", 500, 0, 610, 680);

canvas.parent().css("background", "url(" + tree.toDataURL('image/png') + ")");
canvas.css("background", "#ffe");
$await(Jscex.Async.sleep(300));
canvas.css("background", "none");
}));

var textAnimate = eval(Jscex.compile("async", function () {
$("#code").show().typewriter();
startHeartRain();
}));

var runAsync = eval(Jscex.compile("async", function () {
Expand Down