Skip to content
Closed
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
57 changes: 57 additions & 0 deletions projects/Floating_Hearts_Animation/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

body {
height: 100vh;
background: radial-gradient(circle at top, #ffdde1, #ee9ca7);
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
font-family: 'Poppins', sans-serif;
}

h1 {
position: absolute;
top: 40%;
text-align: center;
font-size: 2.5rem;
color: #fff;
text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
transition: transform 0.3s ease;
}

h1:hover {
transform: scale(1.05);
}

.heart {
position: absolute;
font-size: 24px;
color: #ff3e96;
animation: floatUp 3s ease-out forwards, spin 3s linear infinite;
pointer-events: none;
}

@keyframes floatUp {
0% {
transform: translateY(0) scale(1);
opacity: 1;
}
100% {
transform: translateY(-200px) scale(1.8);
opacity: 0;
}
}

@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
13 changes: 13 additions & 0 deletions projects/Floating_Hearts_Animation/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Floating Hearts Animation</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<h1>Click Anywhere for ❤️ Magic!</h1>
<script src="js/script.js"></script>
</body>
</html>
18 changes: 18 additions & 0 deletions projects/Floating_Hearts_Animation/js/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
document.addEventListener('click', function (e) {
const heart = document.createElement('div');
heart.classList.add('heart');
heart.innerText = '❤️';
document.body.appendChild(heart);

const colors = ['#ff3e96', '#ff5f6d', '#ffb6c1', '#ff69b4', '#ff7eb3'];
heart.style.color = colors[Math.floor(Math.random() * colors.length)];
heart.style.left = e.pageX + 'px';
heart.style.top = e.pageY + 'px';
heart.style.fontSize = Math.random() * 20 + 20 + 'px';

heart.style.transform = `rotate(${Math.random() * 360}deg)`;

setTimeout(() => {
heart.remove();
}, 3000);
});