Hello all! I am an experienced web developer who is brand new to p5.js and generative art in general. I’ve spent several hours searching around for an answer to this question, and I suspect I am just thinking about this the wrong way.
I want to use p5.js to generate an SVG image, capture the SVG markup text, and then use that string as a variable a React application.
I’m using p5.js-svg to generate the SVG image, and I’ve been able to capture the SVG markup using getDataURL(). I’d like to be able to wrap this in a module with a function like ‘generateImageMarkup()’, but when I do so I get this error: “ReferenceError: window is not defined”.
It seems like I am trying to force this library to do something it’s not designed to do. What is the right way to approach this problem? What is the p5.js-native approach?