Giter Club home page Giter Club logo

sketchy's Introduction

sketchy_logo_002

Sketchy is a framework for making generative art in Go. It is inspired by vsketch and openFrameworks. It uses canvas for drawing and the ebiten game engine for the GUI. It's designed to provide controls (sliders) via simple JSON that can be used within a familiar update() and draw() framework to enable quick iteration on designs.

The Getting 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

Screenshot_20230318_123516

10PRINT

10print_example

Installation

Prerequisites

Sketchy requires Go version 1.17 or higher. It assumes that go is in the system path. If you are running Windows, install Windows Subsystem for Linux (WSL), so that you have bash, which is used by the install script.

Clone the repo

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

Install sketchy environment

cd sketchy/scripts
./sketch_install.sh <target_directory>

This will create a directory target_directory, build the sketchy binary, and copy the binary and template files to the newly created directory.

Example:

cd ~/sketchy/scripts
❯ ./sketchy_install.sh ~/sketchy_files
Sucessfully installed sketchy environment to /home/vernon/sketchy_files
❯ tree ~/sketchy_files
/home/vernon/sketchy_files
├── sketchy
└── template
    ├── main.go
    └── sketch.json

1 directory, 3 files

Sketchy is now installed and ready to run from target_directory.

Running the examples

For any of the examples in the examples 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 is sketchy init project_name. This will create a new directory with a configuration file and base sketch file:

❯ ./sketchy init mysketch
❯ tree mysketch
mysketch
├── go.mod
├── go.sum
├── main.go
└── sketch.json

Sketchy init's a go module and runs go mod tidy to get all of the go dependencies.

The next step are to configure sketch parameter and controls in sketch.json and add the drawing code to main.go. See the examples directory and documentation for more details.

Running a sketch

The syntax for running a sketch is sketchy run project_name. This is just a wrapper around running go 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.

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 during sketchy 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 during sketchy init project_name)

"Expert" Mode

If you are already familiar with Go, you have probably realized you can just copy the template files into a new directory and run typical Go commands to build and run the sketch:

cp sketchy/template/* ~/my_sketch_dir/
cd ~/my_sketch_dir
go mod init sketch
go mod tidy

Make your file edits, then

go run main.go

sketchy's People

Contributors

aldernero avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

bombshen

sketchy's Issues

Unexpected result in 100PRINT sample

Hi,

On my machine (arch linux, go version go1.21.6 linux/amd64) the 100PRINT produce only straight lines.
Investigating the value of the noise variable in the init function, every value is between 0.76 and 0.81, producing only one type of tiles.

Tweaking the persistence parameter I get the same visual result with values of noise above 1.

It seems that Noise2D doesn't produce valid values.

bug

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.