ASCII Terminal Animation Package
Project description
bruhanimate
bruhanimate offers a series of files to aid in rendering out animations in the terminal. This is heavily inspisred by the Asciimatics package. While Asciimatics is the end-all be-all for termianl animations, I figured it would be good practice to go ahead and attempt something like this myself.
Installation
From PyPI
pip install --upgrade bruhanimate
From source
git clone https://github.com/FNBBDevs/bruhanimate
cd bruhanimate
python -m pip install .
Quick Start
Use some of the built in demos to see what is possible. There are demos for each effect. Simply import <effect>_demo
from bruhanimate and call the <effect>_demo.run()
to run the demo!
-
static
-
offset
-
noise
-
stars
-
snow
-
rain
-
plasma
-
gol (Conway's Game of Life)
-
matrix
-
twinkle
# Import a demo
from bruhanimate import plasma_demo
# run the demo
plasma_demo.run()
Usage
Here are some examples on how bruhanimate might be used.
"""
Here is a simple program that uses the EffectRenderer to render out one
of the prebuilt effects to the terminal.
"""
from bruhanimate.bruhrenderer import *
from bruhanimate.bruhscreen import Screen
import bruhanimate.images as images
import sys
def demo(screen, img, frames, time, effect_type, background, transparent):
# CREATE THE RENDERER
renderer = CenterRenderer(screen, frames, time, img, effect_type, background, transparent)
# SET EFFECT ATTRIBUTES
renderer.update_smart_transparent(True)
renderer.effect.update_color(True)
renderer.effect.update_intensity(100)
# RUN THE ANIMATION
renderer.run()
# CATCH THE END WITH INPUT() --> for Win-Systems --> Ctl-C for Unix-Systems
input()
def main():
Screen.show(demo, args=(images.get_image("TWOPOINT"), 300, 0, "noise", " ", False))
if __name__ == "__main__":
main()
"""
Here is another example that makes use of line drawing to draw a 3-D triangle
"""
from bruhanimate.bruhrenderer import *
from bruhanimate.bruhscreen import Screen
import bruhanimate.images as images
def demo(screen, img, frames, time, effect, background, transparent):
# CREATE THE RENDERER
renderer = PanRenderer(screen, frames, time, img, effect, background, transparent, loop=True)
# REGISTER THE LINES - LET'S MAKE A DECENT 3D TRIANGLE
renderer.effect.add_line((15, 15), (30, 30))
renderer.effect.add_line((30, 30), (50, 20))
renderer.effect.add_line((50, 20), (15, 15))
renderer.effect.add_line((30,30), (32, 22))
renderer.effect.add_line((32, 22), (15, 15))
renderer.effect.add_line((32, 22), (50, 20))
# RUN THE ANIMATION
renderer.run(end_message=False)
# CATCH THE END WITH INPUT() ON WINDOWS
input()
image = images.text_to_image("HELLO WORLD!", padding_top_bottom=1, padding_left_right=3)
Screen.show(demo, args=(image, 500, 0.05, "drawlines", " ", True))
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.