Ronaldo1111 commited on
Commit
c399b07
verified
1 Parent(s): e28eb7f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -29
app.py CHANGED
@@ -240,13 +240,17 @@ html_template = '''
240
  }
241
  #gift {
242
  position: fixed;
243
- bottom: 100px;
244
- right: 20px;
245
  width: 60px;
246
  cursor: pointer;
247
  z-index: 9998;
248
- transition: transform 0.5s;
249
- animation: bounce 1.2s infinite;
 
 
 
 
 
 
250
  }
251
  #popup, #popup2 {
252
  display: none;
@@ -283,36 +287,26 @@ html_template = '''
283
  0% { opacity: 1; }
284
  100% { opacity: 0; }
285
  }
286
- #balloon {
287
  position: fixed;
288
- top: 100%;
289
- left: 50%;
290
- width: 50px;
291
  height: 80px;
292
- background: url("https://huggingface.co/spaces/Ronaldo1111/Sophia/resolve/main/balloon.png") no-repeat center;
293
  background-size: contain;
294
- animation: floatBalloon 10s linear infinite;
295
  z-index: 9999;
 
296
  }
297
- @keyframes floatBalloon {
298
- 0% { transform: translate(-50%, 0); }
299
- 100% { transform: translate(-50%, -120vh); }
300
- }
301
- #music-toggle {
302
- position: fixed;
303
- bottom: 20px;
304
- left: 20px;
305
- padding: 8px 12px;
306
- font-size: 14px;
307
- background: rgba(255,255,255,0.7);
308
- border-radius: 8px;
309
- cursor: pointer;
310
- z-index: 10000;
311
  }
312
- #next-track {
313
  position: fixed;
314
- bottom: 60px;
315
- left: 20px;
316
  padding: 8px 12px;
317
  font-size: 14px;
318
  background: rgba(255,255,255,0.7);
@@ -320,6 +314,8 @@ html_template = '''
320
  cursor: pointer;
321
  z-index: 10000;
322
  }
 
 
323
  </style>
324
  <img id="sophia-avatar" src="{avatar_url}" />
325
  <img id="birthday-cake" src="{cake_url}" />
@@ -329,7 +325,11 @@ html_template = '''
329
  <div id="popup-close">脳</div>
330
  <div id="music-toggle">鈴革笍闊充箰</div>
331
  <div id="next-track">馃幍鍒囨瓕</div>
332
- <div id="balloon"></div>
 
 
 
 
333
  <audio id="bg-music" autoplay loop>
334
  <source src="{music1}" type="audio/mpeg" />
335
  </audio>
@@ -345,7 +345,8 @@ html_template = '''
345
  audio.play();
346
  });
347
 
348
- document.getElementById("music-toggle").addEventListener("click", () => {
 
349
  if (audio.paused) {
350
  audio.play();
351
  toggleBtn.textContent = "鈴革笍闊充箰";
 
240
  }
241
  #gift {
242
  position: fixed;
 
 
243
  width: 60px;
244
  cursor: pointer;
245
  z-index: 9998;
246
+ animation: moveAround 10s infinite linear;
247
+ }
248
+ @keyframes moveAround {
249
+ 0% { top: 10%; left: 10%; }
250
+ 25% { top: 20%; left: 80%; }
251
+ 50% { top: 70%; left: 60%; }
252
+ 75% { top: 80%; left: 20%; }
253
+ 100% { top: 10%; left: 10%; }
254
  }
255
  #popup, #popup2 {
256
  display: none;
 
287
  0% { opacity: 1; }
288
  100% { opacity: 0; }
289
  }
290
+ .balloon {
291
  position: fixed;
292
+ width: 60px;
 
 
293
  height: 80px;
 
294
  background-size: contain;
295
+ background-repeat: no-repeat;
296
  z-index: 9999;
297
+ animation: floatUp 12s linear infinite;
298
  }
299
+ #balloon1 { background-image: url("https://huggingface.co/spaces/Ronaldo1111/Sophia/resolve/main/balloon1.png"); left: 10%; animation-delay: 0s; }
300
+ #balloon2 { background-image: url("https://huggingface.co/spaces/Ronaldo1111/Sophia/resolve/main/balloon2.png"); left: 30%; animation-delay: 2s; }
301
+ #balloon3 { background-image: url("https://huggingface.co/spaces/Ronaldo1111/Sophia/resolve/main/balloon3.png"); left: 50%; animation-delay: 4s; }
302
+ #balloon4 { background-image: url("https://huggingface.co/spaces/Ronaldo1111/Sophia/resolve/main/balloon4.png"); left: 70%; animation-delay: 6s; }
303
+ #balloon5 { background-image: url("https://huggingface.co/spaces/Ronaldo1111/Sophia/resolve/main/balloon5.png"); left: 90%; animation-delay: 8s; }
304
+ @keyframes floatUp {
305
+ 0% { top: 100%; }
306
+ 100% { top: -20%; }
 
 
 
 
 
 
307
  }
308
+ #music-toggle, #next-track {
309
  position: fixed;
 
 
310
  padding: 8px 12px;
311
  font-size: 14px;
312
  background: rgba(255,255,255,0.7);
 
314
  cursor: pointer;
315
  z-index: 10000;
316
  }
317
+ #music-toggle { bottom: 20px; left: 20px; }
318
+ #next-track { bottom: 60px; left: 20px; }
319
  </style>
320
  <img id="sophia-avatar" src="{avatar_url}" />
321
  <img id="birthday-cake" src="{cake_url}" />
 
325
  <div id="popup-close">脳</div>
326
  <div id="music-toggle">鈴革笍闊充箰</div>
327
  <div id="next-track">馃幍鍒囨瓕</div>
328
+ <div id="balloon1" class="balloon"></div>
329
+ <div id="balloon2" class="balloon"></div>
330
+ <div id="balloon3" class="balloon"></div>
331
+ <div id="balloon4" class="balloon"></div>
332
+ <div id="balloon5" class="balloon"></div>
333
  <audio id="bg-music" autoplay loop>
334
  <source src="{music1}" type="audio/mpeg" />
335
  </audio>
 
345
  audio.play();
346
  });
347
 
348
+ const toggleBtn = document.getElementById("music-toggle");
349
+ toggleBtn.addEventListener("click", () => {
350
  if (audio.paused) {
351
  audio.play();
352
  toggleBtn.textContent = "鈴革笍闊充箰";