termcinema-engine

Crates.iotermcinema-engine
lib.rstermcinema-engine
version0.1.0
created_at2025-06-10 05:27:51.457615+00
updated_at2025-06-10 05:27:51.457615+00
description🧠 Core typewriter-style terminal animation engine (SVG renderer) for termcinema
homepagehttps://github.com/pokeyaro/termcinema
repositoryhttps://github.com/pokeyaro/termcinema
max_upload_size
id1706677
size94,582
Pokeya (pokeyaro)

documentation

https://docs.rs/termcinema-engine

README

🧱 termcinema-engine

Low-level rendering engine for TermCinema
turn terminal-style text into animated SVG with fine-grained control over fonts, layout, cursor, and animation timing.

Note: This is the rendering core. For end-user usage, see termcinema-cli


✨ What It Does

termcinema-engine provides programmatic APIs to:

  • 🖋 Render multi-line terminal text with typing animations

  • 🎨 Style output with custom fonts, colors, alignment, and layout

  • 🧑‍🎨 Animate cursors with blinking and movement trails

  • 📜 Support both free-form text and structured REPL/script formats

  • 🧩 Export to SVG strings — suitable for embedding in web or docs

🔧 Usage (as a library)

Add to your Cargo.toml:

termcinema-engine = "0.1"

Basic usage example:

use termcinema_engine::{
    StyleSpec, LayoutSpec, CursorSpec, ControlSpec,
    render_svg_from_input,
};

fn main() {
    let svg = render_svg_from_input(
        "echo hello",        // input text
        false,               // is script-style? false = typing mode
        &StyleSpec::default(),
        &LayoutSpec::default(),
        &CursorSpec::default(),
        &ControlSpec::default(),
    );   
}

Output is a full <svg>...</svg> string — ready to embed or save to file.

📦 Features

  • ✅ Minimal dependencies
  • ✅ No I/O: pure in → SVG string out
  • 🧱 Designed for integration into:
    • WASM frontends

    • Static site generators

    • Code documentation pipelines

    • Terminal recording tools

🪄 Advanced Control

Use the structured API for precise layout, animation, and output control:

use termcinema_engine::{
    render_typing_from_text,
    StyleSpec, LayoutSpec, CursorSpec, ControlSpec,
    ContentSpec,
};

fn main() {
    let svg = render_typing_from_text(
        &ContentSpec { text: "Hello\nWorld!".into() },
        &StyleSpec {
            font_family: "Fira Code".into(),
            font_size: 18,
            text_color: Some("#00ffcc".into()),
            background_color: Some("#000000".into()),
            ..Default::default()
        },
        &LayoutSpec::default(),
        &CursorSpec::default(),
        &ControlSpec {
            frame_delay: 80,
            fade_duration: 120,
            ..Default::default()
        },
    );
}

🔗 See Also

Commit count: 2

cargo fmt