Hello and good day.
I am currently acessing a string of a small p5js project and I want to use it to run a new project in a specific div. Any quick help with this?
/** small project multiline string */
function setup() {
createCanvas(400, 400);
}
function callback() {
background(200);
}
/** running new p5js sketch like this is not very efficient if I want to add custom functions in the used string */
let sketch = function(p) {
p.setup = function(){
eval("p." + variable_with_setup);
eval("p." + variable_with_callback);
}
};
new p5(sketch, div);