Using Processing.js Across Multiple Pages
I have a problem using processing.js across multiple pages. I have a master page (test.html) which loads, via jquery, all pages into a div named 'contentarea'. This is just an exer
Solution 1:
This might still be a problem since it won't be solved in the library until the next version: For now, the solution is to not rely on Processing auto-loading, since that only happens on DOMContentLoaded events. Instead, when you change page content you can grab the canvas's data-processing-sources attribute and create a new Processing instance from the indicated source code:
function loadSketchOnContentSwap() {
var canvas = /* get the relevant canvas however you want */
var sources = canvas.getAttribute("data-processing-sources").split(/\s+/);
Processing.loadSketchFromSources(canvas, sources);
}
Post a Comment for "Using Processing.js Across Multiple Pages"