fantaxy commited on
Commit
fb821ee
1 Parent(s): ac07c45

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +57 -1
app.py CHANGED
@@ -272,6 +272,62 @@ footer {
272
  }
273
  """
274
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
275
  # 갤러리 디렉토리 생성
276
  if not os.path.exists('gallery'):
277
  os.makedirs('gallery')
@@ -280,7 +336,7 @@ if not os.path.exists('gallery'):
280
  init_db()
281
 
282
  with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css) as app:
283
-
284
  selected_index = gr.State(None)
285
 
286
  with gr.Tabs():
 
272
  }
273
  """
274
 
275
+
276
+ def create_snow_effect():
277
+ # CSS 스타일 정의
278
+ snow_css = """
279
+ @keyframes snowfall {
280
+ 0% {
281
+ transform: translateY(-10vh) translateX(0);
282
+ opacity: 1;
283
+ }
284
+ 100% {
285
+ transform: translateY(100vh) translateX(100px);
286
+ opacity: 0.3;
287
+ }
288
+ }
289
+ .snowflake {
290
+ position: fixed;
291
+ color: white;
292
+ font-size: 1.5em;
293
+ user-select: none;
294
+ z-index: 1000;
295
+ pointer-events: none;
296
+ animation: snowfall linear infinite;
297
+ }
298
+ """
299
+
300
+ # JavaScript 코드 정의
301
+ snow_js = """
302
+ function createSnowflake() {
303
+ const snowflake = document.createElement('div');
304
+ snowflake.innerHTML = '❄';
305
+ snowflake.className = 'snowflake';
306
+ snowflake.style.left = Math.random() * 100 + 'vw';
307
+ snowflake.style.animationDuration = Math.random() * 3 + 2 + 's';
308
+ snowflake.style.opacity = Math.random();
309
+ document.body.appendChild(snowflake);
310
+
311
+ setTimeout(() => {
312
+ snowflake.remove();
313
+ }, 5000);
314
+ }
315
+ setInterval(createSnowflake, 200);
316
+ """
317
+
318
+ # CSS와 JavaScript를 결합한 HTML
319
+ snow_html = f"""
320
+ <style>
321
+ {snow_css}
322
+ </style>
323
+ <script>
324
+ {snow_js}
325
+ </script>
326
+ """
327
+
328
+ return gr.HTML(snow_html)
329
+
330
+
331
  # 갤러리 디렉토리 생성
332
  if not os.path.exists('gallery'):
333
  os.makedirs('gallery')
 
336
  init_db()
337
 
338
  with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css) as app:
339
+ create_snow_effect()
340
  selected_index = gr.State(None)
341
 
342
  with gr.Tabs():