β¨ Animation
The animation module provides a waiting animation service for the Telegram UI in the codex-bot framework.
π§ The Why
User Experience (UX)
In a bot, some actions (e.g., searching, scanning, moving) can take several seconds to complete. Without feedback, users might think the bot is broken. UIAnimationService provides visual feedback (Progress Bars, Infinite Indicators) to keep the user engaged during long-running operations.
Dynamic Injection
The animation service is designed to be non-intrusive. It can inject an animation string into an existing UnifiedViewDTO using a placeholder ({ANIMATION}). This allows you to add animations to any feature without modifying its core rendering logic.
π The Flow
- Scenario Selection: The developer chooses an animation scenario:
run_delayed_fetch,run_polling_loop, orrun_timed_polling. - Polling: The service calls a
PollerFuncto check the current status of the background operation. - Generation: An ASCII animation frame (e.g.,
[β β β‘β‘β‘] 40%) is generated based on the current progress. - Injection: The animation string is injected into the
UnifiedViewDTO's text. - Update: The
ViewSenderedits the persistent UI message with the new frame. - Completion: Once the operation is finished, the final result is displayed, and the animation stops.
πΊοΈ Module Map
| Component | Description |
|---|---|
| π API Reference | Technical details for UIAnimationService. |
| π Animation Type | PROGRESS_BAR, INFINITE, and NONE. |
Last Updated: 2025-02-07