File size: 794 Bytes
7fbaf23
c503554
7fbaf23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0438968
7fbaf23
0438968
 
 
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
import streamlit as st
import streamlit.components.v1 as components

# JavaScript code for confetti animation
confetti_animation_script = """
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/confetti.browser.min.js"></script>
<script>
    function triggerConfetti() {
        confetti({
            angle: randomInRange(55, 125),
            particleCount: randomInRange(50, 100),
            origin: { y: 0.6 },
            spread: randomInRange(50, 70),
        });
    }

    function randomInRange(min, max) {
        return Math.random() * (max - min) + min;
    }
</script>
"""

components.html(confetti_animation_script, height=600)

if st.button("Click for Confetti"):
    st.write("Confetti time!")
    st.write("You can customize this behavior further as needed.")