candycore / candy-flip
ASCII GIF viewer — port of namzug16/gifterm on the SugarCraft stack.
v0.2.0
2026-05-07 01:58 UTC
Requires
- php: >=8.1
- ext-gd: *
- sugarcraft/candy-core: @dev
- sugarcraft/candy-sprinkles: @dev
Requires (Dev)
- phpunit/phpunit: ^10.0
This package is not auto-updated.
Last update: 2026-05-08 01:47:09 UTC
README
CandyFlip
ASCII GIF viewer on the SugarCraft stack — port of namzug16/gifterm. Decodes a .gif on disk via ext-gd, downsamples each frame to a configurable cell grid, and renders the animation into the terminal as ANSI-coloured Unicode block-glyphs at a configurable framerate.
composer require sugarcraft/candy-flip candy-flip my-animation.gif # solid-block preset (default) candy-flip 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
| File | Role |
|---|---|
Decoder |
Reads the GIF, locates per-frame image-descriptor offsets, hands each frame to GD, downsamples to a cell grid, returns a list of {@see Frame}. |
Frame |
Pure value — 2-D RGB grid in cell coordinates. |
Renderer |
ANSI emitter. Two presets: solid (24-bit █ blocks) or density (luminance ramp). |
Player |
SugarCraft Model — index + paused + preset state. Cmd::tick(...) schedules frame advance. |
TickMsg |
Frame-tick message produced by the Cmd. |
The decoder caps at 256 frames so a runaway file can't OOM the runtime; pause + manual step are always available even on long animations.
Test
composer install vendor/bin/phpunit
