celluloid-core

Crates.iocelluloid-core
lib.rscelluloid-core
version0.0.1
created_at2025-12-16 19:53:15.780575+00
updated_at2025-12-16 19:53:15.780575+00
descriptionData models for Celluloid grid-based animations
homepagehttps://github.com/careyi3/celluloid
repositoryhttps://github.com/careyi3/celluloid
max_upload_size
id1988546
size18,034
Ian Carey (careyi3)

documentation

README

celluloid-core

Data models for Celluloid grid-based animations.

This crate provides the core data structures for creating grid-based animations that can be visualized with the Celluloid viewer. Perfect for Advent of Code visualizations, cellular automata, pathfinding algorithms, and other grid-based simulations.

Usage

Add this to your Cargo.toml:

[dependencies]
celluloid-core = "0.1"

Example

use celluloid_core::{AnimationData, Frame, CellState};

fn main() {
    let mut animation = AnimationData::new("My Animation", 10, 10)
        .with_frame_delay(100.0);

    let mut grid = vec![vec![CellState::Empty as u8; 10]; 10];
    grid[5][5] = CellState::Start as u8;
    
    let frame = Frame::new(0, grid, "Initial state");
    animation.add_frame(frame);

    let json = serde_json::to_string_pretty(&animation).unwrap();
    std::fs::write("animation.json", json).unwrap();
}

Cell States

  • Empty (0) - Empty cell
  • Obstacle (1) - Blocked cell
  • Start (2) - Starting position
  • End (3) - Goal position
  • Visited (4) - Visited during search
  • Path (5) - Part of final path

Viewing Animations

Install the Celluloid viewer:

cargo install --git https://github.com/careyi3/celluloid --path server

Then run it in a directory with your animation JSON files:

celluloid

License

Licensed under MIT license.

Commit count: 0

cargo fmt