Update app.py
Browse files
app.py
CHANGED
|
@@ -46,7 +46,7 @@ def create_brain_animation_app():
|
|
| 46 |
for (let y = 99; y < svg.clientHeight - 99; y += 4) {
|
| 47 |
for (let x = 99; x < svg.clientWidth - 99; x += 2) {
|
| 48 |
const[px, py] = brainShape(x, y);
|
| 49 |
-
if (Math.sqrt(px*px + py*py) > svg.clientWidth * 0.3 && Math.sqrt(px*px + py*py) < svg.clientWidth * 0.6) {
|
| 50 |
const circle = document.createElementNS(ns, 'circle');
|
| 51 |
circle.setAttribute('cx', px);
|
| 52 |
circle.setAttribute('cy', py);
|
|
@@ -57,11 +57,10 @@ def create_brain_animation_app():
|
|
| 57 |
}
|
| 58 |
}
|
| 59 |
|
| 60 |
-
t += Math.PI / 180;
|
| 61 |
requestAnimationFrame(drawBrain);
|
| 62 |
}
|
| 63 |
|
| 64 |
-
// SVG Text for scrolling
|
| 65 |
function addScrollingText(text) {
|
| 66 |
const textElement = document.createElementNS(ns, 'text');
|
| 67 |
textElement.setAttribute('x', '50%');
|
|
@@ -76,7 +75,7 @@ def create_brain_animation_app():
|
|
| 76 |
|
| 77 |
let startX = 0;
|
| 78 |
function animateText() {
|
| 79 |
-
startX = (startX - 1) % (svg.clientWidth + 200);
|
| 80 |
textElement.setAttribute('transform', `translate(${startX}, 0)`);
|
| 81 |
requestAnimationFrame(animateText);
|
| 82 |
}
|
|
@@ -88,8 +87,26 @@ def create_brain_animation_app():
|
|
| 88 |
</script>
|
| 89 |
"""
|
| 90 |
|
| 91 |
-
|
| 92 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
|
| 94 |
if __name__ == "__main__":
|
| 95 |
create_brain_animation_app()
|
|
|
|
| 46 |
for (let y = 99; y < svg.clientHeight - 99; y += 4) {
|
| 47 |
for (let x = 99; x < svg.clientWidth - 99; x += 2) {
|
| 48 |
const[px, py] = brainShape(x, y);
|
| 49 |
+
if (Math.sqrt(px*px + py*py) > svg.clientWidth * 0.3 && Math.sqrt(px*px + py*py) < svg.clientWidth * 0.6) {
|
| 50 |
const circle = document.createElementNS(ns, 'circle');
|
| 51 |
circle.setAttribute('cx', px);
|
| 52 |
circle.setAttribute('cy', py);
|
|
|
|
| 57 |
}
|
| 58 |
}
|
| 59 |
|
| 60 |
+
t += Math.PI / 180;
|
| 61 |
requestAnimationFrame(drawBrain);
|
| 62 |
}
|
| 63 |
|
|
|
|
| 64 |
function addScrollingText(text) {
|
| 65 |
const textElement = document.createElementNS(ns, 'text');
|
| 66 |
textElement.setAttribute('x', '50%');
|
|
|
|
| 75 |
|
| 76 |
let startX = 0;
|
| 77 |
function animateText() {
|
| 78 |
+
startX = (startX - 1) % (svg.clientWidth + 200);
|
| 79 |
textElement.setAttribute('transform', `translate(${startX}, 0)`);
|
| 80 |
requestAnimationFrame(animateText);
|
| 81 |
}
|
|
|
|
| 87 |
</script>
|
| 88 |
"""
|
| 89 |
|
| 90 |
+
# Using a different approach for fullscreen element
|
| 91 |
+
st.markdown(
|
| 92 |
+
f"""
|
| 93 |
+
<style>
|
| 94 |
+
.full-screen-container {{
|
| 95 |
+
position: fixed;
|
| 96 |
+
top: 0;
|
| 97 |
+
left: 0;
|
| 98 |
+
width: 100vw;
|
| 99 |
+
height: 100vh;
|
| 100 |
+
margin: 0;
|
| 101 |
+
padding: 0;
|
| 102 |
+
overflow: hidden;
|
| 103 |
+
z-index: -1;
|
| 104 |
+
}}
|
| 105 |
+
</style>
|
| 106 |
+
<div class="full-screen-container">
|
| 107 |
+
{js_code}
|
| 108 |
+
</div>
|
| 109 |
+
""", unsafe_allow_html=True)
|
| 110 |
|
| 111 |
if __name__ == "__main__":
|
| 112 |
create_brain_animation_app()
|