Skip to content

Latest commit

 

History

History
56 lines (41 loc) · 1.82 KB

README.md

File metadata and controls

56 lines (41 loc) · 1.82 KB

uxn-player

An animation player for the Uxn virtual machine.

cat

It displays 1 bpp animations stored with a custom made file format. Audio isn't supported.

This project started as an exercise for learning Uxntal and is still a work in progress.

File format

Clips used by uxn-player follow the custom 1ba file format (for 1-bit animation), described in ENCODING.md.

Requirements

  • Python 3 with the Pillow module
  • uxn assembler and emulator

Build

uxnasm player.tal player.rom

Usage

Encoding GIF files

Use gif21ba.py to generate the encoded file:

python gif21ba.py src-file encoded-file

The encoder converts color GIFs into grayscale, and uses ordered dithering with a 2x2 Bayer matrix to turn them into 1 bpp images. Custom threshold values for dithering can be specified with the -t/--thresholds option. For example, the command bellow uses the following threshold matrix:

$${\left\lbrack \matrix{80 & 100 \cr 150 & 60} \right\rbrack}$$
python gif21ba.py -t 60 80 100 150 src-file encoded-file

Playback

To play the animation, pass it as an argument to player.rom. Window size is set dynamically:

uxnemu player.rom encoded-file

Use Space to pause the video.

TODO

  • Use transparency optimization to reduce file size
  • Adjust playback speed (currently set to 30 fps)
  • Rewrite encoder in uxntal
  • Add support for 2 bpp frames

Licensing

The code for this project is licensed under the terms of the GNU GPLv3 license.