gitmyhub

broadsheet

Rust ★ 48 updated 27d ago

A Rust library for building newspaper styled 2D animations that explain how algorithms and data structures work, exportable as video.

Rustmacroquadffmpegsetup: moderatecomplexity 3/5

Broadsheet is a Rust library for building 2D animations that explain algorithms and data structures, styled to look like the pages of an old newspaper: off white paper, ink colored strokes, a single spot color, serif headlines, and monospace data. It is built on top of a graphics library called macroquad and is meant for people making explainer videos about how code works.

You write a movie as Rust code. First you declare a starting scene made of shapes like circles, arrows, and text, some of them hidden at the start. Then you script a sequence of animated beats, such as fading a shape in, moving it, highlighting it, or changing text, either one after another or at the same time. Built in widgets can generate a whole data structure with one function call, including an array, hash table, linked list, tree, graph, hash ring, and skip list, and each returns handles you can then animate. Named roles like Active, Visited, Found, or Deleted map to specific colors so you can talk about algorithm state without hardcoding colors everywhere.

While building a movie, running it opens a live preview window with playback controls: pausing, stepping frame by frame, jumping to named section markers, and scrubbing, which is meant to help you line up narration with the animation. A slideshow mode lets the movie pause at marked boundaries so you can present it live, advancing forward or back one step at a time.

To turn a movie into an actual video file, you run it with a record flag and it renders at a fixed frame rate, piping frames into ffmpeg if that is installed on your machine, or writing individual PNG frames if not. Several export flags control things like output resolution scaling, a fast low frame rate preview pass, exporting a single still frame, or adding a newsprint style grain and vignette effect to the final video.

The library is available as a crate through cargo add broadsheet, and its only dependency outside of Rust itself is ffmpeg, and only when exporting video.

Where it fits