A Visual DSL for UI/UX and Creative Coding
Viper is a toy GUI and domain-specific language designed to make creating interactive UI/UX experiences and creative code effortless. It combines declarative syntax, reactive state management, and built-in visual primitives for everything from fractals to shaders to animations.
Whether you're building a dashboard, visualizing mathematical concepts, or crafting generative art—Viper lets you express complex visuals with minimal boilerplate.
Built-in shapes: box, circle, path, text, image. Advanced: fractals, curves, polygons, tilings, polynomials.
Smooth motion with lerp, decay, hybrid, leap, and spring easing. Motion paths with splines.
GPU-accelerated effects: plasma, noise, glass morphing, crackle, Jian ware textures.
Call external code: Rust, GLSL, Python, Go, C++, Uiua, and more. With built-in caching.
Declarative state management with state keyword. Changes propagate automatically.
Reusable UI blocks with parameters, event handling, and theme support.
state count = 0
component Button {
param label: String
draw box(on: tap => count = count + 1) {
text(content: label + ": " + count)
}
}
Button(label: "Click Me")
state zoom = 1.5
bridge {
call: "rust:mandelbrot"
args: { zoom: zoom, center: [0, 0] }
cache with zoom
on result {
canvas {
draw image(data: result, format: "pixels")
}
}
}
state targetPos = { x: 100, y: 100 }
animation.smooth(type: "spring", stiffness: 120, damping: 0.9) {
follow(node: button, to: targetPos)
}
curve(type: "custom", params: {
fn: |t| { x: sin(t * 5), y: cos(t * 3) }
}) {
draw path(stroke: "cyan", strokeWidth: 2)
}
shader(type: "glass", params: { blur: 8, refraction: 1.2 }) {
canvas(width: 512, height: 512)
}
Call code from 15+ languages with automatic caching:
Primitives: Int, UInt, F64, F32, Byte, Bool, Char, Str
Visual Types: Color, Vec2, Vec3, Vec4, matrix
Composites: Tuple, List, Set, Hash
Specialized: Fractal, Shape, Curve
Explore the full language reference and examples:
Declarative. Write what you want, not how to compute it.
Reactive. State changes automatically propagate through your UI.
Visual-First. Build visual experiences without fighting abstraction layers.
Minimal. No unnecessary boilerplate—just expressive, focused syntax.
Performant. Compiled to WebAssembly with GPU acceleration for shaders.