termcinema-engine 0.1.0

🧠 Core typewriter-style terminal animation engine (SVG renderer) for termcinema
Documentation
# 🧱 termcinema-engine

Low-level rendering engine for [TermCinema](../README.md) —  
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`]../cli/README.md

---


## ✨ 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`:

```toml
termcinema-engine = "0.1"
```

Basic usage example:

```rust
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:

```rust
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

- [Back to Project Overview]../README.md
- [docs.rs/termcinema-engine]https://docs.rs/termcinema-engine
- [Changelog]./CHANGELOG.md
- [License]./LICENSE