Skip to content

soda480/text-animator

Repository files navigation

complexity vulnerabilities PyPI version python

text-animator

A simple text animator.

Ths is a subclass of the Animation abstract class and uses the Animator class to display the animated text to the terminal; both classes are defined in the ascii-animator package.

Installation

pip install text_animator

Usage

Animate some text and display characters from left to right (default).

Code
from text_animator import TextAnimation
text = """This is the text
    that we want to animate
    let's see how well
    this works ..."""
TextAnimation(text)()

example1

Animate some text and display characters from right to left.

Code
from text_animator import TextAnimation, Effect
text = """This is the text
    that we want to animate
    let's see how well
    this works ..."""
TextAnimation(text, effect=Effect.RIGHT_TO_LEFT)()

example2

Animate some text and display characters at random.

Code
from text_animator import TextAnimation, Effect
text = """This is the text
    that we want to animate
    let's see how well
    this works ..."""
TextAnimation(text, effect=Effect.RANDOM)()

example3

Animate some text and display characters from left to right then surround text with a border. A border can be customized with top|bottom|left|right margins as well as top|bottom|left|right padding, default for all margins and padding is 1. Margins define the space outside the border, and padding define the space between the border and text.

Code
from text_animator import TextAnimation, Effect, Border
text = """This is the text
    that we want to animate
    let's see how well
    this works ..."""
TextAnimation(text, border=Border(lm=0, tm=0, bm=0, tp=0, bp=0))()

example4

Development

Clone the repository and ensure the latest version of Docker is installed on your development server.

Build the Docker image:

docker image build \
-t \
text-animator:latest .

Run the Docker container:

docker container run \
--rm \
-it \
-v $PWD:/code \
text-animator:latest \
bash

Execute the build:

pyb -X