Search by

sugarcraft / candy-gifview

detain

Terminal GIF and .ansi-art viewer (gifterm port) — the command-line front end of sugarcraft/sugar-animation.

Package info

github.com/sugarcraft/candy-gifview

Homepage

Documentation

Type:project

pkg:composer/sugarcraft/candy-gifview

Statistics

Installs: 0

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

dev-master 2026-10-17 07:19 UTC

This package is auto-updated.

Last update: 2026-10-17 07:24:19 UTC


README

candy-gifview

CandyGifView

CI codecov Packagist Version License PHP

demo

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.