Introduction
​Valora is a brush for generative fine art. With valora you can write visual compositions that
  • are repeatable with rng seeds managed for you
  • can be reproduced at arbitrary resolutions without changing the scale of the composition
  • have strict type-safe color semantics that won't surprise you in print (thanks to palette!)
  • leverage all of your hardware (You can shade each path with a different fragment shader!)
  • you will rarely have to debug, thanks to Rust!
This guide covers valora in depth, but to start let's see some pixels! Keep the docs open to follow along.
1
cargo new art --bin && cd art
2
cargo install cargo-edit && cargo add valora
Copied!
Put the following in your main.rs:
1
use valora::prelude::*;
2
​
3
fn main() -> Result<()> {
4
run_fn(Options::from_args(), |_gpu, world, _rng| {
5
Ok(move |ctx: Context, canvas: &mut Canvas| {
6
canvas.set_color(LinSrgb::new(1., 1., 1.));
7
canvas.paint(Filled(ctx.world));
8
​
9
let max_radius = world.width / 3.;
10
let radius = ctx.time.as_secs_f32().cos().abs() * max_radius;
11
​
12
canvas.set_color(LinSrgb::new(1., 0., 0.));
13
canvas.paint(Filled(Ellipse::circle(world.center(), radius)));
14
})
15
})
16
}
Copied!
Now execute:
1
cargo run --release
Copied!
The first time, compilation will take a while. When valora starts, you should see a window with a red circle oscillating in size.
Your first valora result!
​
Last modified 1yr ago
Copy link