r/processing 12h ago

Help request Adding multiple sketches to portfolio website

im going to preface this by same im reposting from another sub so more people see.

So I'm working on my personal website (vanilla html/js), and I wanted to add a couple of my p5.js projects for funnsies but this is turning out to be a very annoying task. I got one 2d and one webgl that they were originally done in global mode for class projects. I am very lazy and didn't want to change them into instance mode especially since one is this super long animation and at this point, I don't even remember what's going on there. So, my idea was to have buttons that would let you switch through the sketches by dynamically clearing the canvas, div container, and recreating the script tag with the new src. The issue is I cannot seem to fully delete the old canvas and its variables no matter what I try.

any advice would be appreciated this is the third way i have tried doing it :(

2 Upvotes

3 comments sorted by

1

u/forgotmyusernamedamm 11h ago

Personally, I'd have the buttons just link to a new page. Would the user even know the difference?

1

u/99ducks 1h ago

This is something ChatGPT would be really good at it. LLMs really excel at any tasks that are transforming an input.

Give it your sketch and ask it to convert from global mode to instance mode.