# OpUI
OpUI is a small Rust library for building stylish realtime 2D visuals.
Current building blocks:
- `VisualApp` to run a scene loop
- `Scene` as the trait for custom visuals
- `Palette` with reusable color sets
- `layers` for composable visual stacks
- `primitives` with shared helpers like `draw_gradient_background`, `draw_glow_circle`, `draw_polyline`, and `ParticleField`
- `SceneStack` as a cleaner alias for layered scene composition
- `liquid_glass()`, `aurora_bloom()`, and `neon_flow()` as built-in layered hero presets
## Run the examples
```bash
cargo run --example showcase
```
## Example API
```rust
use macroquad::prelude::*;
use opui::{GlassWaveConfig, GlowStyle, LiquidOrbConfig, OrbSpec, Palette, SceneStack, VisualApp};
let scene = SceneStack::new()
.gradient(color_u8!(7, 14, 29, 255), color_u8!(9, 28, 54, 255))
.mist(color_u8!(118, 238, 255, 255), 220)
.glass_waves(
color_u8!(108, 238, 255, 255),
color_u8!(255, 127, 209, 255),
GlassWaveConfig::new(24, 12)
.spacing(40.0)
.amplitude(18.0)
.speed(0.9),
)
.liquid_orbs(
LiquidOrbConfig::new(Palette::neon_night())
.orbs(vec![
OrbSpec::new(84.0, 90.0, 0.95, 0.0, 18.0, color_u8!(83, 255, 233, 255)),
OrbSpec::new(140.0, 145.0, -0.72, 1.4, 24.0, color_u8!(255, 84, 176, 255)),
])
.glow_style(GlowStyle::soft()),
)
.scanlines(WHITE)
.vignette(color_u8!(8, 18, 38, 255));
VisualApp::new(scene).run().await;
```
## Publish to crates.io
1. Create an account on [crates.io](https://crates.io) and generate an API token.
2. Log in locally:
```bash
cargo login
```
3. Replace the placeholder GitHub URLs in [Cargo.toml](D:/OpUI/Cargo.toml) with your real repository.
4. Dry-run the package:
```bash
cargo publish --dry-run
```
5. Publish:
```bash
cargo publish
```
If you want the README screenshots and docs.rs page to look strong, the next useful step is adding a real GitHub repo and a couple of rendered images/GIFs to the repository.
## What is ready now
- animated backgrounds
- glow circles and layered lighting
- particle fields
- composable layer stacks
- chainable scene builder API
- mouse-driven motion
- reusable presets
- live showcase demo for layered hero scenes
## Good next steps
- shader materials
- camera and layered compositing
- export frames or GIF/video
- audio-reactive visuals
- a Rust/WASM renderer that replaces the temporary browser canvas layer