Update my_pages/pre_information_loss.py
Browse files
my_pages/pre_information_loss.py
CHANGED
|
@@ -11,6 +11,31 @@ def render():
|
|
| 11 |
"and returning as you wish, or follow the guided tutorial which will go through all pieces in order.", 2)
|
| 12 |
]
|
| 13 |
|
| 14 |
-
add_fadein_text(paragraphs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
add_bottom_navigation("landing", "information_loss")
|
|
|
|
| 11 |
"and returning as you wish, or follow the guided tutorial which will go through all pieces in order.", 2)
|
| 12 |
]
|
| 13 |
|
| 14 |
+
# add_fadein_text(paragraphs)
|
| 15 |
+
# Define CSS fade-in animation
|
| 16 |
+
st.markdown("""
|
| 17 |
+
<style>
|
| 18 |
+
@keyframes fadeIn {
|
| 19 |
+
from {opacity: 0;}
|
| 20 |
+
to {opacity: 1;}
|
| 21 |
+
}
|
| 22 |
+
.fade-in {
|
| 23 |
+
animation: fadeIn 1.5s ease-in forwards;
|
| 24 |
+
opacity: 0;
|
| 25 |
+
margin-bottom: 1em;
|
| 26 |
+
font-size: 24px;
|
| 27 |
+
color: #A6C8FF;
|
| 28 |
+
text-align: left;
|
| 29 |
+
}
|
| 30 |
+
</style>
|
| 31 |
+
""", unsafe_allow_html=True)
|
| 32 |
+
|
| 33 |
+
# Create one placeholder for each paragraph
|
| 34 |
+
placeholders = [st.empty() for _ in paragraphs]
|
| 35 |
+
|
| 36 |
+
# Reveal paragraphs sequentially
|
| 37 |
+
for i, p in enumerate(paragraphs):
|
| 38 |
+
placeholders[i].markdown(f"<div class='fade-in'>{p[0]}</div>", unsafe_allow_html=True)
|
| 39 |
+
time.sleep(p[1]) # delay (seconds) before showing next one
|
| 40 |
|
| 41 |
add_bottom_navigation("landing", "information_loss")
|