sketch 1
sketch 2
sketch 3
This example shows the use of Processing.reload(), used to tell Processing to rescan the DOM for sketches that should be loaded after DOM manipulations such as swapping content in/out. Sketches are unloaded after calling sketch.exit() on them, and their sketch bindings are removed from Processing's instances list.
<script type="text/javascript"> function swap_content() { var html = "<... ... ...>"; document.getElementById('content').innerHTML = html; Processing.reload(); } </script> <input type="button" onclick="swap_content()">
sketch 1
sketch 2
sketch 3
Press the button to swap the content for three different sketches