Even though I use & like that Processing sketch hosting site very much, for more complex sketches, I’d rather choose other hosting options w/ more code flexibility.
There are many approaches we can go with for multi-pick sketch.
But b/c all the sketches you intend to run are using “instance mode”, that makes things much easier.
So I’ve come up with an example which uses createRadio() to pick the activeSketch from among those stored in sketches[]:
Every time the current option() is changed(), it calls back runPickedSketch(); which in turn calls destroyMe() for the activeSketch, then calls createMe() using the index - 1 from method value().
You can see it running online at this JS hosting site below:
And also edit it here: Glitch :・゚✧
Fullscreen presentation: radio-pick-active-sketch.Glitch.me
P.S.: Due to a bug in methods option() & value(), I had to store sketches[]'s indices starting at 1
, b/c those methods can’t store the value 0
!