Animation

abstract class Animation<T>(trailingLinebreak: Boolean = true, val terminal: Terminal)

An Animation renders a widget to the screen each time update is called, clearing the render from the previous call.

If you print anything in between calls to update, the rendered widget will be cleared, before the print, then rendered again below it.

Note that Animation doesn't render the widget automatically: you need to call update yourself when your data changes. If your terminal is not interactive, the animation will not render anything.

You can create instances of Animations with animation, textAnimation, animate a progressBarLayout, or by creating a subclass.

Note that although this class's state is thread safe, calling update concurrently will likely cause garbled output, so usage of this class should be serialized.

Constructors

Link copied to clipboard
constructor(trailingLinebreak: Boolean = true, terminal: Terminal)

Properties

Link copied to clipboard

Functions

Link copied to clipboard
inline fun Animation<Unit>.animateOnThread(fps: Int = 30, crossinline finished: () -> Boolean = { false }): BlockingAnimator

Create an animator that runs this animation synchronously.

Link copied to clipboard
inline fun Animation<Unit>.asRefreshable(fps: Int = 5, crossinline finished: () -> Boolean = { false }): RefreshableAnimation

Convert this Animation to a RefreshableAnimation.

Link copied to clipboard
fun clear()

Stop this animation and remove it from the screen.

Link copied to clipboard
fun stop()

Stop this animation without removing it from the screen.

Link copied to clipboard
fun update(data: T)

Update the data for this animation.