Skip to main content

Crate opui

Crate opui 

Source
Expand description

OpUI is a Rust library for building stylish realtime 2D visuals.

It provides a small scene runtime, reusable visual layers, and built-in layered presets for atmospheric hero scenes.

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;

Re-exports§

pub use app::VisualApp;
pub use color::Palette;
pub use layers::GlassWaveConfig;
pub use layers::GlassWaveLayer;
pub use layers::GradientLayer;
pub use layers::HaloLayer;
pub use layers::Layer;
pub use layers::LayerScene;
pub use layers::LiquidOrbConfig;
pub use layers::LiquidOrbLayer;
pub use layers::OrbSpec;
pub use layers::ParticleMistLayer;
pub use layers::ScanlineLayer;
pub use layers::VignetteLayer;
pub use primitives::GlowStyle;
pub use primitives::Particle;
pub use primitives::ParticleField;
pub use scene::FrameContext;
pub use scene::Scene;

Modules§

app
color
layers
presets
primitives
scene

Type Aliases§

SceneStack