Skip to main content

A simple terminal animation library

Project description

Animpy 🎬

PyPI - Version Downloads GitHub License

Make cool terminal animations without the pain. Move text around, use RGB colors, play audio, and build actual animations. Works great on modern terminals.

Examples

Install

pip install animpy

Quick Start

import animpy

scene = animpy.Scene()
text = animpy.Text("Hello!", 10, 5, r=255, g=100, b=50)
scene.add(text)
scene.render()

How It Works

Text – Create animated text:

text = animpy.Text("Hi", 0, 0, r=255, g=0, b=0)
text.moveX(10)  # Move right
text.moveY(5)   # Move down
text.centerX()  # Center horizontally
text.change_rgb_values(0, 255, 0)  # Change color
text.collides_with(other_text)  # Check collision with another text
text.on_collide_callback(other_text, callback)  # Set a callback for when it collides with another text
text.width, text.height  # Get dimensions
text.type_out("Type me!", speed=0.05, scene=scene)  # Type effect
text.fall(velocity=2, floor=15)  # Falling effect
text.change_frame()  # Cycle through frames (if you used a list)

Group – Group multiple texts together:

group = animpy.Group(text1, text2, text3)
group.add(text4)  # Add another text to the group
group.remove(text2)  # Remove text2 from the group
group.position(5, 0)  # Move the entire group right by 5

Scene – Render everything:

scene = animpy.Scene()
scene.add(text1, text2, text3)
scene.remove(text2)  # Remove text2 from the scene
scene.render()
scene.set_bg_rgb(0, 0, 255)  # Set background color to blue
scene.clear()
scene.shake(intensity=2)  # Shake the scene
scene.dt  # Get time since last frame (for smooth movement)

Interactive Scene – Handle real-time input:

scene = animpy.Scene()
scene.add(text1, text2, text3)
scene.remove(text2)  # Remove text2 from the scene
scene.render()
scene.set_bg_rgb(0, 0, 255)  # Set background color to blue
scene.clear()
scene.shake(intensity=2)  # Shake the scene
scene.key_pressed("w")  # Check if 'w' is pressed
scene.dt  # Get time since last frame (for smooth movement)

Audio – Play sounds:

audio = animpy.Audio()
audio.load("bg", "music.mp3")
audio.play("bg", loop=-1)
audio.stop_all()
audio.is_playing("track")

Animpy (extras) – Some extra methods for animations:

animpy.lerp(start, end, t)  # Linear interpolation between start and end

Support the project

Sponsor 13DoesPython

Version History

v1.5.5

  • Added new Group class for grouping multiple Text objects together and moving them as a unit
  • Added collision detection method on_collide_callback to Text class for triggering callbacks when two Text objects collide

v1.5.1

  • Added full guide to project folder

v1.5.0

  • Added linear interpolation function lerp to animpy for smooth animations
  • Added dt property to Scene for easy frame timing and smooth movement
  • Added z-index support to Text for layering items in the scene
  • Added scene shaking effect with shake method for dramatic animations

v1.4.5

  • Added background color support to Scene with set_bg_rgb method

v1.4.1

  • Added scene.remove method to remove items from the scene

v1.4.0

  • Added three new examples to Github example folder
  • Added new class InteractiveScene that allows for real-time keyboard input
  • Added collision detection method collides_with to Text class

v1.3.8

  • Added audio.is_playing() method to check if audio is currently playing
  • Added two more examples to Github example folder

v1.3.5

  • Added scene.clear method to clear the scene
  • Added version history to README

Made with ❤️ by a human.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

animpy-1.5.5.1.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

animpy-1.5.5.1-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file animpy-1.5.5.1.tar.gz.

File metadata

  • Download URL: animpy-1.5.5.1.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for animpy-1.5.5.1.tar.gz
Algorithm Hash digest
SHA256 4caeafa18f3dbd0347f8e6948da5fe2280dce0f0325d886e20d4e5970ce7d4f9
MD5 0f9d9ee7e99089107d01a9b91281b4e0
BLAKE2b-256 ac9f4764fb90f9b61b1f99dc1c3f6b1e4367aea862fe426d9916c6e02d68ee4b

See more details on using hashes here.

File details

Details for the file animpy-1.5.5.1-py3-none-any.whl.

File metadata

  • Download URL: animpy-1.5.5.1-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for animpy-1.5.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bf0bc65464c8dfdf6c11c30901b72347343b03a71dc2da2203f3cc604e1fca43
MD5 5d839356d8be43300c7e6c4b16ed2a5a
BLAKE2b-256 614cbd233e578020d42649623a40c097ed714ea97513cdbbc4643889c1c36698

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page