sugarcraft / candy-gifview
Terminal GIF and .ansi-art viewer (gifterm port) — the command-line front end of sugarcraft/sugar-animation.
Requires
- php: ^8.3
- sugarcraft/sugar-animation: dev-master
- sugarcraft/sugar-core: dev-master
- sugarcraft/sugar-pty: dev-master
Requires (Dev)
- phpunit/phpunit: ^10.0
- sugarcraft/sugar-testing: dev-master
Suggests
- ext-gd: Required to decode GIF animations (via sugarcraft/sugar-animation); ANSI art playback needs neither.
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-17 07:24:19 UTC
README
CandyGifView
Terminal GIF and .ansi-art viewer for PHP 8.3+ — the command-line front end built on sugarcraft/sugar-animation. Point it at a .gif on disk and it decodes via ext-gd, sizes the frame grid to your terminal, and plays the animation in the alternate screen as 24-bit background-coloured blocks or a Unicode luminance ramp.
composer require sugarcraft/candy-gifview candy-gifview my-animation.gif # solid-block preset (default) candy-gifview my-animation.gif density # ASCII luminance ramp
Keys
| Key | Action |
|---|---|
Space |
Pause / resume |
← |
Step back one frame |
→ |
Step forward one frame |
d |
Toggle solid ↔ density preset |
q / Esc |
Quit |
Architecture
The whole animation engine — Decoder, Frame, Renderer, Player, and the
.ansi art surface (AnsiArt / ArtLibrary / ArtLoop) — lives in
sugarcraft/sugar-animation. This package is only the viewer app:
| File | Role |
|---|---|
bin/candy-gifview |
Autoload probe + Cli::main() shim — deliberately two lines of logic. |
src/Cli.php |
Argv parsing (--help, preset token), viewport sizing (viewportCells() — descriptor 1 behind a core stream_isatty gate), decode-failure exits, Player wiring, Program launch. A $play closure seam keeps every branch testable without entering the blocking loop. |
src/Lang.php |
i18n facade over the shared T registry, namespace gifview (cli.usage, cli.no_autoload). |
Test
composer install vendor/bin/phpunit
Credits & inspiration
Design antecedent: namzug16/gifterm. The decode/render/playback layer it mirrors is developed here as sugarcraft/sugar-animation; SugarCraft is a native PHP project on the Charm-inspired TEA stack.
