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