candycore/candy-flip

ASCII GIF viewer — port of namzug16/gifterm on the SugarCraft stack.

Maintainers

Package info

github.com/sugarcraft/candy-flip

Homepage

Documentation

Type:project

pkg:composer/candycore/candy-flip

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.2.0 2026-05-07 01:58 UTC

This package is not auto-updated.

Last update: 2026-05-08 01:47:09 UTC


README

candy-flip

CandyFlip

CI codecov Packagist Version License PHP

demo

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