burme-coder-max / examples /demo_animation.py
amkyawdev's picture
Upload folder using huggingface_hub
a7d7463 verified
Raw
History Blame Contribute Delete
2.47 kB
"""Demo: Animation Gallery
This script demonstrates all available animations in Burme-Coder-Max.
"""
import sys
import time
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent / "src"))
from animations import Spinner, ProgressBar, ParticleBurst, TypingEffect
from animations.particle_effect import SimpleConfetti
def demo_spinner():
"""Demonstrate spinner animation."""
print("\n🔄 Loading Spinner Demo")
print("=" * 40)
print("\nBasic spinner:")
with Spinner("Processing your request"):
for _ in range(20):
time.sleep(0.05)
print("✓ Complete!\n")
def demo_progress():
"""Demonstrate progress bar animation."""
print("\n📊 Progress Bar Demo")
print("=" * 40)
print("\nDefault progress bar:")
for i in ProgressBar(range(50), description="Downloading"):
time.sleep(0.03)
print("✦ Progress bar demo complete!\n")
def demo_particles():
"""Demonstrate particle burst effect."""
print("\n✨ Particle Burst Demo")
print("=" * 40)
print("\n🎉 Celebration effect:")
burst = ParticleBurst(count=40)
burst.center_x = 50
burst.center_y = 12
burst.explode()
print("✦ Particle burst complete!\n")
def demo_typing():
"""Demonstrate typing effect."""
print("\n⌨️ Typing Effect Demo")
print("=" * 40)
effect = TypingEffect("Hello from Burme-Coder-Max! 🧑‍💻", delay=0.06)
effect.animate()
print()
def demo_confetti():
"""Demonstrate confetti effect."""
print("\n🎊 Confetti Demo")
print("=" * 40)
confetti = SimpleConfetti(duration=1.5)
confetti.show()
print()
def main():
"""Run all animation demos."""
print()
print("╔" + "═" * 48 + "╗")
print("║" + " 🎨 ANIMATION GALLERY ".center(48) + "║")
print("╚" + "═" * 48 + "╝")
demos = [
("Spinner", demo_spinner),
("Progress Bar", demo_progress),
("Particle Burst", demo_particles),
("Typing Effect", demo_typing),
("Confetti", demo_confetti),
]
for name, demo_func in demos:
try:
demo_func()
time.sleep(0.3)
except KeyboardInterrupt:
print("\n\nInterrupted by user")
break
print("╔" + "═" * 48 + "╗")
print("║" + " ✨ DEMO COMPLETE ".center(48) + "║")
print("╚" + "═" * 48 + "╝")
if __name__ == "__main__":
main()