- Notifications
You must be signed in to change notification settings - Fork3
A framework for creating generative art in Go
License
aldernero/sketchy
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Sketchy is a framework for making generative art in Go. It is inspired byvsketch andopenFrameworks. It usescanvas for drawing and theebiten game engine for the GUI. It's designed to provide controls (sliders, checkboxes, buttons) via simple JSON that can be used within a familiarupdate()
anddraw()
framework to enable quick iteration on designs.
TheGetting Started guide is a good place to start, and even walk through creating a "Hello Circle" sketch from scratch.
Below are a couple of screenshots from the example sketches:
Sketchy requires Go version 1.23 or higher. It assumes thatgo
is in the system path.
git clone https://github.com/aldernero/sketchy.git
go build -o sketchy ./cmd/sketchy/main.go
For any of the examples in theexamples
directory, run using standard go commands:
❯cd~/sketchy/examples/lissajous❯ go run main.go
The syntax for creating a new sketch issketchy init project_name
. This will create a new directory with a configuration file and base sketch file:
❯ ./sketchy init mysketch❯ tree mysketchmysketch├── go.mod├── go.sum├── icon.png├── main.go└── sketch.json
Sketchy init's a go module and runsgo mod tidy
to get all of the go dependencies.
The next step are to configure sketch parameter and controls insketch.json
and add the drawing code tomain.go
. See theexamples
directory and documentation for more details.
The syntax for running a sketch issketchy run project_name
. This is just a wrapper around runninggo run main.go
from the project directory. Even the empty example above will run, althought you'll just see the 2 example controls and a blank drawing area.
The control panel contains both custom controls defined in thesketch.json
file and builtin controls. Below is an example
The builtins section controls the random seed and saving images and configurations. These also have keyboard shortcutsthat are listed in the next section of README. The control panel will not show up in saved images. If you close thecontrol panel, you can reopen it by pressing the space bar.
There are three builtin keyboard shortcuts for saving sketch images and configurations:
- "s" key - saves the current frame as an SVG file. The filename has the format
<prefix>_<timestamp>.svg
, where<prefix>
by default is the project name (what you used duringsketchy init project_name
) - "p" key - same as above but saves the current frame as a PNG image.
- "c" key - saves the configuration (control values and sketch parameters) as JSON. The filename has the format
<prefix>_config_<timestamp>.json
, where<prefix>
by default is the project name (what you used duringsketchy init project_name
) - "Esc" key - saves a screenshot whole window, including the control panel. The filename has the format
screenshot_<timestamp>.png
About
A framework for creating generative art in Go