A functional tool for generative art, built in Clojure and Quil. Sketches are defined as pure data — spec-validated maps describing where things go (layout), how they look (style), and what to draw. These primitives compose into layered visual structures (Particles, Strokes, and Fields) and combine through ordinary Clojure functions, threading, and higher-order transformations. Imperative rendering happens only at the final stage, as a projection of the resolved data onto the canvas. Inspired by the algorithmic rigor of Vera Molnár.
Copyright © 2025 Noel Rivas
The definition of a sketch has evolved with the project. Initially, it was a drawing defined by a configuration map, which included a layout function, a style function and a drawing function. See notes about them below under Particle drawing.
In the most recent version, I think of a sketch in the following terms:
A Particle is a single object (a square, circle, line... ) that's drawn by a drawing function.
Particles are essential to a sketch, but aren't produced manually; they are the outcomes of processing a Stroke (layer) configuration.
A Stroke is a collection of Particles. It's defined by the triad of layout, style and drawing function.
In the configuration spec and the core functions, it's referred to as a layer.
Strokes are essential to a sketch. Even for single-particle drawing, a stroke has to be used to generate its configuration.
A Field is a collection of Strokes. The concept is derived from the wave_depth sketch, in which I used a function to produce a set of layers, which define something that looks like a color field (or plane, passage, patch, whatever you want to call an identifiable surface on a painting).
Fields are not essential for a sketch; they are helpers that aid in the creation of stroke progressions.
Determines the size, position and rotation of objects to be drawn.
Takes a step and num-steps as input, and produces a Transform Map.
Determines the visual properties (colors, stroke, etc) for each object.
Takes a transform map and a style config, and produces a Style Map.
Actually draws objects on the canvas. Takes a geometry map (which is the result of projecting the Transform Map to the canvas) and a style map.
See specs.clj
See bvm.sketches.minimal.
# bvm.sketches.minimal has its own -main function so it can be called directly
# Running through Lein is required to use the dependencies defined in project.clj
lein run -m bvm.sketches.minimalStart the REPL server. The simplest way is to do that with Leiningen:
lein replWhile you can use the REPL server directly, Rebel readline provides a better experience. You caon connect to a running REPL server with:
./scripts/nrebel.shVim-fireplace allows you to run expressions from within Vim.
cqqprepopulate the command window with the expression under the cursor.cqcblank line in command window
The current intended output is PNG or PDF. The code can be modified to run in the browser but it's not currently set up that way.
Run the vera function with a valid configuration object:
(bvm.core/vera bvm.sketches.minimal/config)