Skip to main content

PyAsciiMotion

Play ASCII Motion animations in your Python terminal.

Parses session files (.json, .asciimtn), JSON exports, and plain-text frame files from ascii-motion.app — then renders them with full ANSI color support, frame-by-frame playback, and interactive controls.

Install

pip install pyasciimotion

Quick start

from pyasciimotion import AsciiMotion

anim = AsciiMotion.load("demo.json")
anim.play()

Python API

Loading

from pyasciimotion import AsciiMotion

# From a file
anim = AsciiMotion.load("path/to/file.json")
anim = AsciiMotion.load("path/to/file.asciimtn")
anim = AsciiMotion.load("path/to/file.txt")

# From a string
anim = AsciiMotion.from_string(json_text, name="my animation")

Inspecting

print(anim.frame_count)      # number of frames
print(anim.width, anim.height)
print(anim.meta.frame_rate)
print(anim.meta.name)

# Iterate frames
for frame in anim:
    print(frame.to_plain_text())

# Access a single frame
frame = anim[3]
text = anim.frame_text(3)

Playing

# Interactive playback (blocking, keyboard controls)
anim.play(fps=10, loop=True, color=True)

# Render a single frame to stdout
anim.render(index=0, color=True)

Keyboard controls during playback

Key Action
Space Pause / Resume
q Quit
. or ] Step forward
, or [ Step backward
0 Jump to first frame
+ Increase FPS
- Decrease FPS

Advanced player

player = anim.player(fps=12, loop=True, color=True)
player.play(blocking=False)   # runs in background thread

player.pause()
player.resume()
player.seek(10)
player.step(1)
player.fps = 24
player.stop()

print(player.state)           # State.PLAYING, State.PAUSED, etc.
print(player.current_frame)

Low-level access

from pyasciimotion import load, render_frame, Cell, Frame

animation = load("demo.json")
frame = animation.get_frame(0)

cell = frame.cell_at(5, 3)
print(cell.char, cell.fg, cell.bg)

for cell in frame.row(0):
    print(cell.char, end="")

CLI

pyasciimotion play demo.json
pyasciimotion play demo.json --fps 24 --no-loop --no-color
pyasciimotion info demo.json
pyasciimotion frame demo.json --index 3
pyasciimotion frame demo.json --index 0 --plain

Also works via module:

python -m pyasciimotion play demo.json

Supported formats

Format Extension Description
Session v1/v2 .json, .asciimtn Full project state from ascii-motion.app
JSON export .json Compact frame data with color dictionaries
Plain text .txt Character-only frames separated by ---

Architecture

pyasciimotion/
├── __init__.py    # Public API (AsciiMotion class)
├── models.py      # Cell, Frame, Animation, AnimationMeta
├── parser.py      # File format detection and parsing
├── renderer.py    # ANSI terminal rendering
├── player.py      # Threaded playback with controls
├── cli.py         # Command-line interface
└── utils.py       # Terminal detection, formatting

The parser auto-detects format from file extension and content structure. The renderer uses 24-bit ANSI color sequences (truecolor). The player runs playback on a background thread with pause/resume/seek via threading primitives.

Requirements

  • Python 3.10+
  • No external dependencies

License

MIT

Metadata

Release files for pyasciimotion 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyasciimotion 0.1.1
File Size Uploaded Provenance Actions
pyasciimotion-0.1.1.tar.gz 853.3 kB With provenance Details for pyasciimotion-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyasciimotion 0.1.1
File Interpreter ABI Platform Actions
pyasciimotion-0.1.1-py3-none-any.whl Python 3 none any Details for pyasciimotion-0.1.1-py3-none-any.whl

Total release size: 868.1 kB

Release files / pyasciimotion-0.1.1.tar.gz

Download URL pyasciimotion-0.1.1.tar.gz
Size 853.3 kB
Tags Source
SHA-256 checksum
How to use checksums
eda69aa3f43f56d2e5e78631cb46727bd7aedfda038b2fd565088ab4d55ffbd3
BLAKE2b-256 checksum
How to use checksums
f6da323605d5b9e6a2e1ded13ef31acfbe86ba6ab9f80f6d7deb57e6fd94b8d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 30, 2026.

Transparency log

Release files / pyasciimotion-0.1.1-py3-none-any.whl

Download URL pyasciimotion-0.1.1-py3-none-any.whl
Size 14.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ba4e11a0a1e60d1a71d2e1a1593b167fe055f97b265e00ca6debca3a98eaa5b
BLAKE2b-256 checksum
How to use checksums
a27a77d5ceac0349db99e12357a83665aa42e7fa1f1aa3c0cf871e58c463d871
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 30, 2026.

Transparency log

Security for pyasciimotion 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pyasciimotion-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page