🎛
JS Playground
The GEN.ART Playground provides an easy way for artists to create Generative Art Scripts that comply with the GA Script Standard. It also complies your code and checks for any runtime or type errors.
The Playground injects the GA library into your project. It provides you with properties and functions to communicate with the GEN.ART Rendering Engine. Read more about it here.
Tweaks provide a way to modify input variables with a UI pane. Before you can use it, you have to define your tweaks object in the
tweaks.json
file.- Numerical range
- Boolean
- Hex color
- RGBA
- RGB
- Text value
- Select
{
"tweak_range": {
"value": 1,
"min": -10,
"max": 10,
"step": 1
},
"tweak_range_2": {
"value": 1,
"min": -10,
"max": 10
},
"bool": true,
"tweak_select": {
"value": "Up",
"label": "Down",
"options": ["Up", "Down"]
},
"text_value": "foo",
"hex_color": "#ff005b",
"rgba_color": {
"r": 248,
"g": 214,
"b": 40,
"a": 1
}
}
In your javascript code (
sketch.js
) you can access the values by the name of your tweak input value.setup() {
const hash = options.hash;
const rnd = new Random(hash, 4);
background(tweaks.hex_color);
setMetadata('color', tweaks.hex_color);
setMetadata('size', rnd.random_int(2, 3));
onMetadata();
}
draw() {
/**
* draw something
*/
onDone();
}
Last modified 3mo ago