Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A framework for creating generative art in Go

License

NotificationsYou must be signed in to change notification settings

aldernero/sketchy

Repository files navigation

sketchy_logo

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:

Fractal

fractal_example

Noise

noise_example

10PRINT

10print_example

Installation

Build Prerequisites

Sketchy requires Go version 1.23 or higher. It assumes thatgo is in the system path.

Clone the repo

git clone https://github.com/aldernero/sketchy.git

Compile the sketchy binary

go build -o sketchy ./cmd/sketchy/main.go

Running the examples

For any of the examples in theexamples directory, run using standard go commands:

cd~/sketchy/examples/lissajous❯ go run main.go

Creating a new sketch

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.

Running a sketch

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

The control panel contains both custom controls defined in thesketch.json file and builtin controls. Below is an examplecontrol_panel

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.

Saving sketches and configurations

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 formatscreenshot_<timestamp>.png

[8]ページ先頭

©2009-2025 Movatter.jp