animaty is a library for animating ascii art in python.
Project description
animaty
Description
animaty is a library for animating ASCII art inside the console. It is made for both Windows and Linux.
Installation
To install animaty just run the following command:
pip install animaty
After that, you can import animaty with
from animaty import *
Documentation
animaty.helpers
getFramesFromFile(file) -> Frame
getFramesFromFile lets you extract frames from a file (The frames in the file must be seperated by a double-newline)
animaty.animate.Frame
The Frame class is used to represent each frame in an animation. It implements getters and setters, I think those need no further explanation.
Frame(content, time=1)
The content variable describes what the Frame displays, while the time variable sets how long the frame has to be displayed (in seconds).
animaty.animate.Animator
The Animator class is responsible for animating the previously created frames
Animator(frames, fps=None)
The frames variable is an array of Frame() instances which will be displayed. The fps variable represents the frames per seconds. If set, the Animator() instance will ignore any time set inside of the given Frame() instances.
animate() -> None
animate starts an animation based on previously entered frames
animationLoop() -> None
animationLoop starts an infinite animation based on previously entered frames
Examples
from animaty import *
frames = getFramesFromFile("test.txt")
animator = Animator(frames)
animator.animate()
First the animaty module gets imported. After that,a frames array is created the getFramesFromFile method, which is then passed into an Animator instance. Finally, the animate method is called, which starts an animation.
from animaty import *
frames = [Frame("just", 0.2), Frame("some", 0.3), Frame("text", 0.4)]
animator = Animator(frames)
animator.animate()
This example is really similair to the previous one, the only difference is that we create a Frame array manually, which gives us some more control over the time the frames are displayed.
To achieve a similair amount of control in example one as in example two, you can use a syntax like this:
frames[0].setFrametime(0.2)
How to contribute
If you want to contribute to this Project, just request an issue on my Github.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file animaty-0.1.tar.gz
.
File metadata
- Download URL: animaty-0.1.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4bd9f7790f4955b44db1ff88811353084d793017a5645d107c53b0a7adfd4ce |
|
MD5 | 64dad6ec3fe1635b28bf145ee8a7944d |
|
BLAKE2b-256 | 43bbb3527467a374971a52e5e16760c99bfa521ebb284b597bc511c24ce094f5 |