File size: 772 Bytes
6ce3856 c503554 7fbaf23 6ce3856 1e3bc1b 7fbaf23 1e3bc1b 7fbaf23 1e3bc1b |
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
components.html(
"""
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/confetti.browser.min.js"></script>
<button onclick="triggerConfetti()">Click for Confetti</button>
<script>
// Function to trigger the confetti effect with random directions
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>
"""
)
|