forked from Rakesh9100/Beautiify
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Slavi
committed
Oct 12, 2024
1 parent
56ef9a3
commit 23c3a29
Showing
2 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Extra Fizzy Button</title> | ||
<style> | ||
body { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; | ||
background-color: #2b2d42; | ||
margin: 0; | ||
overflow: hidden; | ||
} | ||
|
||
.fizzy-button { | ||
font-size: 20px; | ||
color: #fff; | ||
background-color: #f72585; | ||
border: none; | ||
padding: 15px 30px; | ||
border-radius: 50px; | ||
cursor: pointer; | ||
position: relative; | ||
z-index: 2; | ||
box-shadow: 0 8px 25px rgba(247, 37, 133, 0.5); | ||
transition: background-color 0.3s ease; | ||
} | ||
|
||
.fizzy-button:hover { | ||
background-color: #ff4d6d; | ||
} | ||
|
||
.fizzy-button:active { | ||
background-color: #b5179e; | ||
} | ||
|
||
.particle { | ||
position: absolute; | ||
background-color: #ff5722; | ||
border-radius: 50%; | ||
pointer-events: none; | ||
animation: fizz 2s ease-out forwards; | ||
z-index: 1; | ||
} | ||
|
||
@keyframes fizz { | ||
from { | ||
transform: scale(0); | ||
opacity: 1; | ||
} | ||
to { | ||
transform: scale(3); | ||
opacity: 0; | ||
} | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<button class="fizzy-button">Click Me!</button> | ||
|
||
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.11.5/gsap.min.js"></script> | ||
<script> | ||
const button = document.querySelector('.fizzy-button'); | ||
|
||
button.addEventListener('click', () => { | ||
const particleCount = 100; // Large number of particles for extra fizz | ||
const bodyRect = document.body.getBoundingClientRect(); | ||
|
||
for (let i = 0; i < particleCount; i++) { | ||
const particle = document.createElement('div'); | ||
particle.classList.add('particle'); | ||
particle.style.width = particle.style.height = `${Math.random() * 15 + 5}px`; | ||
particle.style.backgroundColor = `hsl(${Math.random() * 360}, 100%, 50%)`; | ||
|
||
// Particles can appear anywhere on the screen | ||
particle.style.left = `${Math.random() * window.innerWidth}px`; | ||
particle.style.top = `${Math.random() * window.innerHeight}px`; | ||
|
||
document.body.appendChild(particle); | ||
|
||
gsap.to(particle, { | ||
x: (Math.random() - 0.5) * 1000, // Bigger spread for a wider fizz effect | ||
y: (Math.random() - 0.5) * 1000, | ||
duration: 2, | ||
opacity: 0, | ||
scale: Math.random() * 2.5 + 1, | ||
onComplete: () => particle.remove(), | ||
}); | ||
} | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters