Hey all,
Is there a way to pass an arguments array/object to a new sketch in instance mode?
I would like to pass settings to the new sketch, like information on who is it’s parent element. But this could also be used to send other settings like colors or dimensions of stuff to be drawn.
This was my first approach/guess
var p5Back = function( sketch, args ) {
let parentDivId = args.parentId;
console.log( parentDivId );
}
let sketch_01 = new p5( p5Back, ‘sketch_01’, { parentId: ‘sketch_01’ } );
let sketch_02 = new p5( p5Back, ‘sketch_02’, { parentId: ‘sketch_02’ } );
But this prints TypeError: args is undefined
in the console.
Is there a way to pass arguments to the new sketch?