Closed nulpoet closed 12 years ago
this will show you how your code looks once it has been converted:
var processingCode = "…";
var jsCode = Processing.compile(processingCode).sourceCode;
basically it converts your code to javascript and places it all within a closure. Anything that references the processing instance gets "p." prepended to it. One easy way to get your variables watchable / debuggable in a development tool is to simply put a reference on the global:
window.myPhysicsVar = myPhysicsVar;
Processing.js talks about their compliation method on their JS Quick Start page Or you can dig into their code on github.
Thanks a lot.. this helps.
On Mon, Jan 16, 2012 at 12:24 AM, Kyle Phillips < reply@reply.github.com
wrote:
this will show you how your code looks once it has been converted:
var processingCode = ""; var jsCode = Processing.compile(processingCode).sourceCode;
basically it converts your code to javascript and places it all within a closure. Anything that references the processing instance gets "p." prepended to it. One easy way to get your variables watchable / debuggable in a development tool is to simply put a reference on the global:
window.myPhysicsVar = myPhysicsVar;
Processing.js talks about their compliation method on their JS Quick Start page Or you can dig into their code on github.
Reply to this email directly or view it on GitHub: https://github.com/hapticdata/toxiclibsjs/issues/19#issuecomment-3500898
Rohit Hiwale Final year Dual Degree (Bachelors+Masters) student Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur
I am trying to debug my modified version of the example ''Attraction2D_pjs.html'.[https://github.com/hapticdata/toxiclibsjs/blob/master/examples/Attraction2D_pjs.html] using firebug console in web browser. I can access the processing instance using the global variable 'Processing.instances[0]' as stated in [http://processingjs.org/articles/jsQuickStart.html#accessingprocessingfromjs]. I can access all the functions as Processing.instances[0].setup, but can't access the top level variables like 'VerletPhysics2D physics'.
Can you explain or where can I read about how processing.js converts processing code to javascript ?
To be specific, I need to check some properties for some particles at specific times. Using console.log floods the console. How did you debug the examples you have written?