Processing-style 2D drawing for Ruby, backed by Tessel and RBGL.
Features · Installation · Quick Start · Browser · CLI
Gesso is a small creative-coding DSL for sketches that run in an RBGL window or render deterministic PNG frames without a window.
- Immediate-mode setup and draw callbacks.
- Lines, shapes, images, transforms, text, and configurable stroke styles.
- RGB and HSB color modes with corner, center, and radius shape modes.
- Seeded random values and deterministic smooth noise.
- Optional rlsl shader backgrounds and Twiddle control panels.
- Interactive windows and headless frame rendering.
Add Gesso to your Gemfile:
gem "gesso"Then run:
bundle installOr install the released gem:
gem install gesso- Ruby 3.1 or newer.
- A C toolchain is needed when Bundler builds Larb's native extension.
require "gesso"
sketch = Gesso.run(width: 320, height: 200) do
setup { background 16, 24, 39 }
draw do
fill 240, 120, 80
circle width / 2, height / 2, 30
end
end
sketch.canvas.write("shot.png")Install the optional Flipbook gem to record the next frames as an animated GIF:
Gesso.run(width: 320, height: 200) do
save_gif("sketch.gif", frames: 120, fps: 30)
draw do
background 16, 24, 39
fill 240, 120, 80
circle width / 2 + Math.sin(millis / 200.0) * 40, height / 2, 30
end
endFor a top-level sketch file, load the automatic DSL:
require "gesso/auto"
size 320, 200
draw do
background "#101827"
fill "#f07850"
circle 160, 100, 30
endgesso run examples/bubbles.rb
gesso render examples/bubbles.rb --frames 3 -o framesUse --backend file for a headless window run. The
examples/gui_sketch.rb example shows the optional Twiddle panel.
Add the Webvas gem to the application bundle to run a sketch in a browser worker. The Webvas playground build includes Gesso and its graphics dependencies.
require "gesso"
Gesso.run(width: 480, height: 320, runner: :web) do
background "#171a18"
draw do
background "#171a18"
fill "#d38a62"
circle 240, 160, 48
end
endbundle install
bundle exec rake verifyBug reports and pull requests are welcome at rbgfx/gesso.