Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import numpy as np
|
| 3 |
+
import time
|
| 4 |
+
import random
|
| 5 |
+
|
| 6 |
+
# Add the JavaScript and CSS code
|
| 7 |
+
st.set_page_config(layout="wide")
|
| 8 |
+
st.write("""
|
| 9 |
+
<style>
|
| 10 |
+
body {
|
| 11 |
+
background-color: black;
|
| 12 |
+
overflow: hidden;
|
| 13 |
+
margin: 0;
|
| 14 |
+
padding: 0;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
.star {
|
| 18 |
+
position: absolute;
|
| 19 |
+
width: 4px;
|
| 20 |
+
height: 4px;
|
| 21 |
+
background-color: white;
|
| 22 |
+
border-radius: 50%;
|
| 23 |
+
box-shadow: 0 0 10px white;
|
| 24 |
+
animation: twinkle 2s infinite;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
@keyframes twinkle {
|
| 28 |
+
0% {
|
| 29 |
+
opacity: 1;
|
| 30 |
+
}
|
| 31 |
+
50% {
|
| 32 |
+
opacity: 0.5;
|
| 33 |
+
}
|
| 34 |
+
100% {
|
| 35 |
+
opacity: 1;
|
| 36 |
+
}
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
.planet {
|
| 40 |
+
position: absolute;
|
| 41 |
+
width: 50px;
|
| 42 |
+
height: 50px;
|
| 43 |
+
background-color: #ccc;
|
| 44 |
+
border-radius: 50%;
|
| 45 |
+
animation: orbit 10s linear infinite;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
@keyframes orbit {
|
| 49 |
+
0% {
|
| 50 |
+
transform: translate(-50%, -50%) rotate(0deg) translateX(200px) rotate(0deg);
|
| 51 |
+
}
|
| 52 |
+
100% {
|
| 53 |
+
transform: translate(-50%, -50%) rotate(360deg) translateX(200px) rotate(-360deg);
|
| 54 |
+
}
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
.astronaut {
|
| 58 |
+
position: absolute;
|
| 59 |
+
width: 50px;
|
| 60 |
+
height: 50px;
|
| 61 |
+
background-image: url('https://via.placeholder.com/50');
|
| 62 |
+
background-size: contain;
|
| 63 |
+
animation: float 5s infinite ease-in-out;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
@keyframes float {
|
| 67 |
+
0% {
|
| 68 |
+
transform: translateY(0);
|
| 69 |
+
}
|
| 70 |
+
50% {
|
| 71 |
+
transform: translateY(20px);
|
| 72 |
+
}
|
| 73 |
+
100% {
|
| 74 |
+
transform: translateY(0);
|
| 75 |
+
}
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
.flower {
|
| 79 |
+
position: absolute;
|
| 80 |
+
width: 30px;
|
| 81 |
+
height: 30px;
|
| 82 |
+
background-image: url('https://images.app.goo.gl/EJVhnVnoJtDV7iMQA');
|
| 83 |
+
background-size: contain;
|
| 84 |
+
animation: fall 5s linear infinite;
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
@keyframes fall {
|
| 88 |
+
0% {
|
| 89 |
+
transform: translateY(0);
|
| 90 |
+
opacity: 1;
|
| 91 |
+
}
|
| 92 |
+
100% {
|
| 93 |
+
transform: translateY(100vh);
|
| 94 |
+
opacity: 0;
|
| 95 |
+
}
|
| 96 |
+
}
|
| 97 |
+
</style>
|
| 98 |
+
""", unsafe_allow_html=True)
|
| 99 |
+
|
| 100 |
+
# Add the stars
|
| 101 |
+
num_stars = 300
|
| 102 |
+
for _ in range(num_stars):
|
| 103 |
+
x = random.randint(0, st.session_state.get('width', 1920))
|
| 104 |
+
y = random.randint(0, st.session_state.get('height', 1080))
|
| 105 |
+
st.markdown(f'<div class="star" style="left: {x}px; top: {y}px;"></div>', unsafe_allow_html=True)
|
| 106 |
+
|
| 107 |
+
# Add the planets
|
| 108 |
+
num_planets = 5
|
| 109 |
+
for _ in range(num_planets):
|
| 110 |
+
x = random.randint(0, st.session_state.get('width', 1920))
|
| 111 |
+
y = random.randint(0, st.session_state.get('height', 1080))
|
| 112 |
+
st.markdown(f'<div class="planet" style="left: {x}px; top: {y}px;"></div>', unsafe_allow_html=True)
|
| 113 |
+
|
| 114 |
+
# Add the astronaut
|
| 115 |
+
x = random.randint(0, st.session_state.get('width', 1920))
|
| 116 |
+
y = random.randint(0, st.session_state.get('height', 1080))
|
| 117 |
+
st.markdown(f'<div class="astronaut" style="left: {x}px; top: {y}px;"></div>', unsafe_allow_html=True)
|
| 118 |
+
|
| 119 |
+
# Add the flowers
|
| 120 |
+
num_flowers = 50
|
| 121 |
+
for _ in range(num_flowers):
|
| 122 |
+
x = random.randint(0, st.session_state.get('width', 1920))
|
| 123 |
+
y = random.randint(0, 0)
|
| 124 |
+
st.markdown(f'<div class="flower" style="left: {x}px; top: {y}px;"></div>', unsafe_allow_html=True)
|
| 125 |
+
|
| 126 |
+
# Add the YouTube video
|
| 127 |
+
st.markdown(
|
| 128 |
+
"""
|
| 129 |
+
<div style="display: flex; justify-content: center; align-items: center; height: 60vh;">
|
| 130 |
+
<div style="width: 80%;">
|
| 131 |
+
<iframe width="100%" height="515" src="https://www.youtube.com/embed/prmmCg5bKxA?si=ea58nLNlyhcI8BKI" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
| 132 |
+
</div>
|
| 133 |
+
</div>
|
| 134 |
+
""",
|
| 135 |
+
unsafe_allow_html=True
|
| 136 |
+
)
|