煙火爆炸範圍很好,但可以在目前現有範圍作為最小值,與在擴大一些之間的範圍做隨機 - Initial Deployment
Browse files- README.md +7 -5
- index.html +262 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: firework
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: red
|
| 5 |
+
colorTo: yellow
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,262 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="zh-TW">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>全螢幕煙火按鈕</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<style>
|
| 9 |
+
/* 煙火粒子樣式 */
|
| 10 |
+
.firework-particle {
|
| 11 |
+
position: absolute;
|
| 12 |
+
width: 6px;
|
| 13 |
+
height: 6px;
|
| 14 |
+
border-radius: 50%;
|
| 15 |
+
pointer-events: none;
|
| 16 |
+
animation: fadeOut 1s forwards;
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
/* 煙火爆炸動畫 */
|
| 20 |
+
@keyframes fadeOut {
|
| 21 |
+
0% {
|
| 22 |
+
opacity: 1;
|
| 23 |
+
transform: scale(1);
|
| 24 |
+
}
|
| 25 |
+
100% {
|
| 26 |
+
opacity: 0;
|
| 27 |
+
transform: scale(0.5);
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
/* 按鈕懸浮效果 */
|
| 32 |
+
.magic-button:hover {
|
| 33 |
+
transform: translateY(-3px);
|
| 34 |
+
box-shadow: 0 10px 20px rgba(255, 215, 0, 0.3);
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
.magic-button:active {
|
| 38 |
+
transform: translateY(1px);
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
/* 按鈕閃爍效果 */
|
| 42 |
+
@keyframes pulse {
|
| 43 |
+
0% {
|
| 44 |
+
box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7);
|
| 45 |
+
}
|
| 46 |
+
70% {
|
| 47 |
+
box-shadow: 0 0 0 10px rgba(255, 215, 0, 0);
|
| 48 |
+
}
|
| 49 |
+
100% {
|
| 50 |
+
box-shadow: 0 0 0 0 rgba(255, 215, 0, 0);
|
| 51 |
+
}
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
.pulse {
|
| 55 |
+
animation: pulse 2s infinite;
|
| 56 |
+
}
|
| 57 |
+
</style>
|
| 58 |
+
</head>
|
| 59 |
+
<body class="bg-gray-900 min-h-screen flex items-center justify-center p-4">
|
| 60 |
+
<div class="text-center">
|
| 61 |
+
<h1 class="text-4xl font-bold text-yellow-400 mb-8">煙火慶典</h1>
|
| 62 |
+
<p class="text-gray-300 mb-12 max-w-md mx-auto">按下下方按鈕,觸發全螢幕煙火秀!</p>
|
| 63 |
+
|
| 64 |
+
<button id="fireworkButton" class="magic-button pulse relative overflow-hidden bg-gradient-to-r from-yellow-500 to-orange-500 text-white font-bold py-4 px-8 rounded-full text-lg shadow-lg transition-all duration-300 transform hover:scale-105">
|
| 65 |
+
<span class="relative z-10">點燃煙火 🎆</span>
|
| 66 |
+
<span class="absolute inset-0 bg-white opacity-0 group-hover:opacity-10 transition-opacity duration-300"></span>
|
| 67 |
+
</button>
|
| 68 |
+
|
| 69 |
+
<div class="mt-8 text-gray-400 text-sm">
|
| 70 |
+
<p>可以多次點擊按鈕創造更多煙火效果</p>
|
| 71 |
+
</div>
|
| 72 |
+
</div>
|
| 73 |
+
|
| 74 |
+
<script>
|
| 75 |
+
document.getElementById('fireworkButton').addEventListener('click', function(e) {
|
| 76 |
+
// 按鈕點擊效果
|
| 77 |
+
this.classList.add('animate-ping');
|
| 78 |
+
setTimeout(() => {
|
| 79 |
+
this.classList.remove('animate-ping');
|
| 80 |
+
}, 300);
|
| 81 |
+
|
| 82 |
+
// 從按鈕位置發射煙火到隨機高處位置
|
| 83 |
+
const startX = window.innerWidth / 2;
|
| 84 |
+
const startY = window.innerHeight;
|
| 85 |
+
const endX = startX + (Math.random() * 400 - 200);
|
| 86 |
+
const endY = Math.random() * window.innerHeight * 0.3;
|
| 87 |
+
|
| 88 |
+
createLaunchTrail(startX, startY, endX, endY);
|
| 89 |
+
|
| 90 |
+
// 隨機發射更多煙火
|
| 91 |
+
for(let i = 0; i < 2; i++) {
|
| 92 |
+
setTimeout(() => {
|
| 93 |
+
const startX = window.innerWidth / 2 + (Math.random() * 100 - 50);
|
| 94 |
+
const startY = window.innerHeight;
|
| 95 |
+
const endX = startX + (Math.random() * 400 - 200);
|
| 96 |
+
const endY = Math.random() * window.innerHeight * 0.3;
|
| 97 |
+
createLaunchTrail(startX, startY, endX, endY);
|
| 98 |
+
}, Math.random() * 500);
|
| 99 |
+
}
|
| 100 |
+
});
|
| 101 |
+
|
| 102 |
+
function createFirework(x, y) {
|
| 103 |
+
// 創建爆炸中心
|
| 104 |
+
const explosion = document.createElement('div');
|
| 105 |
+
explosion.style.left = x + 'px';
|
| 106 |
+
explosion.style.top = y + 'px';
|
| 107 |
+
explosion.style.position = 'fixed';
|
| 108 |
+
explosion.style.width = '10px';
|
| 109 |
+
explosion.style.height = '10px';
|
| 110 |
+
explosion.style.borderRadius = '50%';
|
| 111 |
+
explosion.style.backgroundColor = getRandomColor();
|
| 112 |
+
explosion.style.transform = 'scale(0)';
|
| 113 |
+
explosion.style.transition = 'transform 0.5s ease-out';
|
| 114 |
+
document.body.appendChild(explosion);
|
| 115 |
+
|
| 116 |
+
// 觸發爆炸動畫
|
| 117 |
+
setTimeout(() => {
|
| 118 |
+
explosion.style.transform = 'scale(1)';
|
| 119 |
+
explosion.style.opacity = '0';
|
| 120 |
+
|
| 121 |
+
// 創建粒子
|
| 122 |
+
createParticles(x, y);
|
| 123 |
+
|
| 124 |
+
// 移除爆炸中心
|
| 125 |
+
setTimeout(() => {
|
| 126 |
+
explosion.remove();
|
| 127 |
+
}, 500);
|
| 128 |
+
}, 10);
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
function createLaunchTrail(startX, startY, endX, endY) {
|
| 132 |
+
const trail = document.createElement('div');
|
| 133 |
+
trail.style.position = 'fixed';
|
| 134 |
+
trail.style.left = startX + 'px';
|
| 135 |
+
trail.style.top = startY + 'px';
|
| 136 |
+
trail.style.width = '4px';
|
| 137 |
+
trail.style.height = '4px';
|
| 138 |
+
trail.style.borderRadius = '50%';
|
| 139 |
+
trail.style.backgroundColor = '#FFD700';
|
| 140 |
+
trail.style.boxShadow = '0 0 6px 2px rgba(255, 215, 0, 0.7)';
|
| 141 |
+
document.body.appendChild(trail);
|
| 142 |
+
|
| 143 |
+
const duration = 1500;
|
| 144 |
+
const startTime = Date.now();
|
| 145 |
+
|
| 146 |
+
const animateTrail = () => {
|
| 147 |
+
const elapsed = Date.now() - startTime;
|
| 148 |
+
const progress = Math.min(elapsed / duration, 1);
|
| 149 |
+
|
| 150 |
+
const currentX = startX + (endX - startX) * progress;
|
| 151 |
+
const currentY = startY + (endY - startY) * progress;
|
| 152 |
+
|
| 153 |
+
trail.style.left = currentX + 'px';
|
| 154 |
+
trail.style.top = currentY + 'px';
|
| 155 |
+
|
| 156 |
+
if (progress < 1) {
|
| 157 |
+
requestAnimationFrame(animateTrail);
|
| 158 |
+
} else {
|
| 159 |
+
trail.remove();
|
| 160 |
+
createParticles(endX, endY);
|
| 161 |
+
}
|
| 162 |
+
};
|
| 163 |
+
|
| 164 |
+
requestAnimationFrame(animateTrail);
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
function createParticles(x, y) {
|
| 168 |
+
const particleCount = 100; // 增加粒子數量讓爆炸更密集
|
| 169 |
+
|
| 170 |
+
for(let i = 0; i < particleCount; i++) {
|
| 171 |
+
const particle = document.createElement('div');
|
| 172 |
+
particle.className = 'firework-particle';
|
| 173 |
+
particle.style.backgroundColor = getRandomColor();
|
| 174 |
+
|
| 175 |
+
// 設置初始位置
|
| 176 |
+
particle.style.left = x + 'px';
|
| 177 |
+
particle.style.top = y + 'px';
|
| 178 |
+
|
| 179 |
+
// 真正的球形爆炸效果
|
| 180 |
+
const angle = Math.random() * Math.PI * 2;
|
| 181 |
+
// 使用平方根讓粒子分布更均勻
|
| 182 |
+
const radius = Math.sqrt(Math.random()) * (100 + Math.random() * 200); // Random radius between 100-300
|
| 183 |
+
const speed = 0.5 + Math.random() * 2;
|
| 184 |
+
|
| 185 |
+
// 初始位置在圓周上
|
| 186 |
+
const initialX = Math.cos(angle) * radius;
|
| 187 |
+
const initialY = Math.sin(angle) * radius;
|
| 188 |
+
|
| 189 |
+
const velocity = {
|
| 190 |
+
x: Math.cos(angle) * speed,
|
| 191 |
+
y: Math.sin(angle) * speed
|
| 192 |
+
};
|
| 193 |
+
|
| 194 |
+
// 設置初始位置在圓周上
|
| 195 |
+
// Start particles small and grow them
|
| 196 |
+
const size = 2 + Math.random() * 10; // Slightly larger random particle size
|
| 197 |
+
particle.style.width = '0px';
|
| 198 |
+
particle.style.height = '0px';
|
| 199 |
+
particle.style.left = x + 'px';
|
| 200 |
+
particle.style.top = y + 'px';
|
| 201 |
+
particle.style.opacity = '0';
|
| 202 |
+
particle.style.transition = 'all 0.3s ease-out';
|
| 203 |
+
|
| 204 |
+
// Stagger the appearance of particles
|
| 205 |
+
setTimeout(() => {
|
| 206 |
+
particle.style.left = (x + initialX) + 'px';
|
| 207 |
+
particle.style.top = (y + initialY) + 'px';
|
| 208 |
+
particle.style.width = size + 'px';
|
| 209 |
+
particle.style.height = size + 'px';
|
| 210 |
+
particle.style.opacity = '1';
|
| 211 |
+
}, Math.random() * 300);
|
| 212 |
+
|
| 213 |
+
// Random animation duration
|
| 214 |
+
const duration = 1.5 + Math.random() * 1.5;
|
| 215 |
+
particle.style.animationDuration = duration + 's';
|
| 216 |
+
|
| 217 |
+
document.body.appendChild(particle);
|
| 218 |
+
|
| 219 |
+
// 粒子移動動畫
|
| 220 |
+
let posX = x + initialX;
|
| 221 |
+
let posY = y + initialY;
|
| 222 |
+
let opacity = 1;
|
| 223 |
+
let scale = 1;
|
| 224 |
+
|
| 225 |
+
const animateParticle = () => {
|
| 226 |
+
posX += velocity.x;
|
| 227 |
+
// 增加空氣阻力和重力效果
|
| 228 |
+
// 更自然的阻力效果
|
| 229 |
+
velocity.x *= 0.95;
|
| 230 |
+
velocity.y *= 0.95;
|
| 231 |
+
velocity.y += 0.05; // 較小的重力
|
| 232 |
+
opacity -= 0.015;
|
| 233 |
+
scale -= 0.005;
|
| 234 |
+
|
| 235 |
+
particle.style.left = posX + 'px';
|
| 236 |
+
particle.style.top = posY + 'px';
|
| 237 |
+
particle.style.opacity = opacity;
|
| 238 |
+
particle.style.transform = `scale(${scale})`;
|
| 239 |
+
|
| 240 |
+
if(opacity > 0) {
|
| 241 |
+
requestAnimationFrame(animateParticle);
|
| 242 |
+
} else {
|
| 243 |
+
particle.remove();
|
| 244 |
+
}
|
| 245 |
+
};
|
| 246 |
+
|
| 247 |
+
requestAnimationFrame(animateParticle);
|
| 248 |
+
}
|
| 249 |
+
}
|
| 250 |
+
|
| 251 |
+
function getRandomColor() {
|
| 252 |
+
const colors = [
|
| 253 |
+
'#FF5252', '#FF4081', '#E040FB', '#7C4DFF',
|
| 254 |
+
'#536DFE', '#448AFF', '#40C4FF', '#18FFFF',
|
| 255 |
+
'#64FFDA', '#69F0AE', '#B2FF59', '#EEFF41',
|
| 256 |
+
'#FFFF00', '#FFD740', '#FFAB40', '#FF6E40'
|
| 257 |
+
];
|
| 258 |
+
return colors[Math.floor(Math.random() * colors.length)];
|
| 259 |
+
}
|
| 260 |
+
</script>
|
| 261 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=BHW/firework" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 262 |
+
</html>
|