opui 0.1.0

A Rust library for stylish realtime 2D motion visuals and layered hero scenes.
Documentation
  • Coverage
  • 0.79%
    1 out of 127 items documented1 out of 85 items with examples
  • Size
  • Source code size: 52.1 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 6.01 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 32s Average build duration of successful builds.
  • all releases: 32s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • FUXKVOB/opui
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • FUXKVOB

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

cargo run --example showcase

Example API

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 and generate an API token.
  2. Log in locally:
cargo login
  1. Replace the placeholder GitHub URLs in Cargo.toml with your real repository.
  2. Dry-run the package:
cargo publish --dry-run
  1. Publish:
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