Skip to main content

Module gif_export

Module gif_export 

Source
Expand description

Seamless GIF export.

  • One global palette: the scene palette (at most 255 colours, by construction) plus index 255 as the transparent colour. No per-frame quantisation, no dithering.
  • Frame 0 is the full image. Every later frame is exactly one sub-image: the bounding box of pixels that changed, with unchanged pixels inside it set to the transparent index (helps LZW), DisposalMethod::Keep. A frame identical to the previous one is merged into the previous frame’s delay.
  • Delays are whole centiseconds, dithered so they sum exactly to the loop.
  • The loop length is a multiple of the particle period, and the character follows its loop script (Clock::Loop), so the last frame flows into the first with no seam.

Structs§

GifStats
What an export produced.

Enums§

GifError
Smoothness
Smoothness, capped by what GIF delays can express.

Constants§

JOURNEY_GIF_MAX_MS
The longest journey loop a GIF holds whole; past it, a journey’s GIF is an excerpt of the length asked for (its land jumps where it repeats).

Functions§

encode_gif
Renders a seamless looping GIF of a recipe.
encode_package_gif
Exports a saved scene as a looping GIF, exactly as saved (no generator).
frame_delays
Per-frame delays in centiseconds that sum exactly to the loop, as even as possible around the target (e.g. a mix of 16 and 17 cs).
valid_loop_ms
Valid loop lengths: whole multiples of the particle period.