问题
I downloaded the just released Unfolding Maps for Processing 2.1 and the examples work fine in Java mode but fail to run in the JavaScript mode. Is there anything which can be done to make them JavaScript mode compatible?
The error I'm getting is uncaught exception: Processing.js: Unable to execute pjs sketch: ReferenceError: UnfoldingMap is not defined
回答1:
The technology behind Processing and Processingjs is completely different. A library for Processing/Java will not work with Processingjs/Javascript. Processingjs is still very young, so there aren't many supporting libraries yet.
However, you could make a Java applet. Open the Processing IDE and go to Tools > Add Tool... and install the AppletMaker tool. An Applet is basically a small java program embedded on a web page that runs within a browser. In this way you could still use Unfolding Maps in your project.
Disclosure: I've never used the Processing Applet Export and Signer tool before, so check whether it is a feasible solution or not to your problem.
回答2:
No, unfortunately not. (Unfolding developer, here)
Unfolding does not support Processing.js, due to the reasons described by @user2468700
来源:https://stackoverflow.com/questions/21586554/unfolding-for-processing-2-1-fails-in-javascript-mode