https://github.com/thesephi/genarts
Simple Generative Arts with JavaScript
https://github.com/thesephi/genarts
Last synced: 22 days ago
JSON representation
Simple Generative Arts with JavaScript
- Host: GitHub
- URL: https://github.com/thesephi/genarts
- Owner: Thesephi
- License: mit
- Created: 2015-02-07T00:12:24.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2017-08-12T20:52:13.000Z (almost 9 years ago)
- Last Synced: 2025-12-22T08:49:49.941Z (6 months ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# genarts
Simple Generative Arts with JavaScript ([live example](https://kha.ngdinh.com/genarts/))

### To build the library:
```
npm install
grunt
```
### Usage:
Please view the `examples/index.html` file for more details on setting up the canvas and handling different browser sizes. I personally prefer a fullscreen experience, but you might want to set things up the way you want. The Genarts library itself is used as shown below:
```
var genarts = new GenArts(ctx); // ctx is the HTML5 canvas context
/*
* basic mode of the show: 2 beams bouncing off the canvas borders until timeout
*/
genarts.basic(
window.innerWidth/2, // x coordinate of the point where you want the beams to start from
window.innerHeight/2, // y coordinate of the point where you want the beams to start from
Math.random()*20-10, // original x velocity of the beam
Math.random()*16-8 // original y velocity of the beam
);
```
and then you can press Fullscreen and enjoy a modest screen-saver :)
### Miscellaneous:
- Press *Spacebar* to pause / unpause the engine.
- By default, after *330 seconds* the engine will halt. You can hit *Spacebar* twice to make it resume.