valora

A declarative generative art toolkit!

Here's a demo. (Code below)

See some actual pieces I've made with it here.

````rust extern crate valora;

use palette::; use rand::StdRng; use valora::;

struct Circle { radius: f32, count: usize, }

impl Sketch for Circle { fn sketch(&self, ctx: &SketchContext, mut rng: StdRng) -> Result { let dotgen = |c: Colorer| { move |p: Point| Mesh { src: Ellipse::circle(p, self.radius), colorer: c.clone() } }; let dots: Vec>> = [Colorer::from(Colora::rgb(1.0, 0.0, 0.0, 0.7)), Colorer::blue()] .intoiter() .flatmap(|c| { sparkles(self.count, &Rect::frame(), &mut rng) .intoiter() .map(dotgen(c.clone())) }) .enumerate() .map(|(i, mesh)| { Tween::from(mesh).animscale(1.0, 1.5, Interpolation::Oscillation { oscillation: Oscillation::Sine, start: i, period: 100, }) }) .collect(); Ok(Composition::new() .add(Mesh { src: Rect::frame(), colorer: Colorer::black() }) .add(dots)) } }

fn main() { sketch(SketchCfg { size: 500, rootframefilename: Some(String::from("circle")), seed: None }, Circle { radius: 0.05, count: 25 }) .expect("sketch"); } ````