gridvid
gridvid is a Rust wrapper library for rendering MP4 videos from 2D vectors using a minimal interface.
The outer vector translates to the X-axis and the inner vectors translate to the Y-axis.
Usage
// Create a 2D Vec of any element type, bool in this example
let mut grid: = vec!;
// fn to map grid element type to RGB tuple `(u8, u8, u8)`
let convert = ;
// Initialize video encoder
let mut video = new.build?;
// Update the grid as desired, adding a new frame for each grid state
for i in 0..grid.len
// Write encoded video to output file
video.close?;
This sample code renders and exports the following:
Additional Options
use Gridlines;
let mut video = new
.fps // Change video frame rate to 20 fps
.scale // Scale each grid element to a 16x16 pixel square
.gridlines // Set gridline color to white
.gridlines // Hide gridlines
.build?;
Defaults:
- Video frame rate is 4 fps
- Black
Gridlinesare inserted in between elements - Video is scaled to fit in a 720 pixel square
Documentation
Gallery
Sample output from examples/game_of_life.rs
License
Currently licensed under AGPL-3.0, but looking into options that would allow for a more permissive license.