Update app.py
Browse files
app.py
CHANGED
@@ -1,29 +1,27 @@
|
|
1 |
-
import streamlit as st
|
2 |
import streamlit.components.v1 as components
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/confetti.browser.min.js"></script>
|
7 |
-
<
|
8 |
-
function triggerConfetti() {
|
9 |
-
confetti({
|
10 |
-
angle: randomInRange(55, 125),
|
11 |
-
particleCount: randomInRange(50, 100),
|
12 |
-
origin: { y: 0.6 },
|
13 |
-
spread: randomInRange(50, 70),
|
14 |
-
});
|
15 |
-
}
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
1 |
+
import streamlit as st
|
2 |
import streamlit.components.v1 as components
|
3 |
|
4 |
+
components.html(
|
5 |
+
"""
|
6 |
+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/confetti.browser.min.js"></script>
|
7 |
+
<button onclick="triggerConfetti()">Click for Confetti</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
+
<script>
|
10 |
+
// Function to trigger the confetti effect with random directions
|
11 |
+
function triggerConfetti() {
|
12 |
+
confetti({
|
13 |
+
angle: randomInRange(55, 125),
|
14 |
+
particleCount: randomInRange(50, 100),
|
15 |
+
origin: { y: 0.6 },
|
16 |
+
spread: randomInRange(50, 70),
|
17 |
+
});
|
18 |
+
}
|
19 |
|
20 |
+
function randomInRange(min, max) {
|
21 |
+
return Math.random() * (max - min) + min;
|
22 |
+
}
|
23 |
+
</script>
|
24 |
+
"""
|
25 |
+
)
|
26 |
+
|
27 |
+
|