How yacspin works: Core Concepts
masterUnlike many other spinner libraries, yacspin decouples the animation rendering from the message updates. This provides several key benefits:
- Live Updates: You can update the spinner's
Message()immediately without waiting for the next animation frame. This allows for high-frequency data updates (like progress percentages or filenames) while maintaining a slow, aesthetically pleasing animation speed. - Dynamic Width: The library calculates the maximum width of the animation frames and adds padding. This prevents the text following the spinner from jumping left and right as the animation frames change width.
- Concurrency Safety: The spinner is safe for concurrent use. You can call methods to update settings (like
Message()) while the spinner is actively animating. - Task Representation: The spinner is designed to represent tasks. You can use
Stop()to indicate a successful task completion orStopFail()to indicate a failure, with customizable characters and colors for both states.