We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Would anybody be able to help me understand how to include a processing sketch inside a lightbox effect on a webpage? As in when you click on an image, the lightbox appears and you can then interact with the sketch inside the lightbox window. I understand how to simply place a sketch onto a page but am struggling to implement in other places. Thanks
Answers
I don't know for sure, but I think lightbox is for displaying images only, what are you looking for is a modal window. There are different plugins and frameworks that allow you to use these, for example a bootstrap modal. Or here are instructions on how to make it from scratch with html5/css3.
I think you are right about not being able to have anything other than images in lightbox. Thanks very much, a modal window seems to be what I'm looking for.
I've seen lightbox scripts that will run video, so in principle you might be able to embed a canvas element in one. In practice I'd expect a couple of possible issues, which would probably apply to any type of modal box, which is basically just a div element with some css positioning anyway...
Is your plan to have multiple sketch images which when clicked launch the associated sketch? If so you'll have to make sure you shut down any running sketch before launching a new one; and obviously figure out how to load in a new one! You'll also have to figure out how to target the modal div element that will host the processing canvas element; though I'd expect that to be the most straightforward aspect of doing this.
I like a challenge, so wouldn't mind having a go at implementing a proof of concept, but time is at a premium so don't know if I'll get the chance :/
See dynamically-loading-processingjs-sketches :)