We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello,
I'm looking for a way to add a toggle button to a p5js sketch. Something like https://www.google.fr/search?q=toggle+button I have only been able to find this example https://p5js.org/examples/dom-input-and-button.html which make use of classic (monostable) button Is there a way to add a bistable button ?
Kind regards
Answers
A toggle is just a glorified checkbox. You can make it look 'pretty' with a bit of CSS...
Thanks blindfish but how to have several toggle buttons with differents text inside like https://www.google.fr/search?q=toggle+button&prmd=isvn&source=lnms&tbm=isch&sa=X&ved=0ahUKEwj11ru4yIPXAhUCOxoKHYuaD3gQ_AUICSgB&biw=835&bih=1336#imgrc=WOno7YzQqkmXnM: on/off yes/no master/slave ...
It's still just a glorified checkbox: just with some event handlers to change the text. If you want that to be configurable then you'd want to define an object that allows you to define the states (e.g. text, colours etc.) for each instance of your custom checkbox...