This is the P2PU Archive. If you want the current site, go to www.p2pu.org!

Programming Visual Media

My recent threads

You haven't posted any discussions yet.

Recently updated threads

Processing in Java vs. JS/Canvas

Go back to: General discussion

In another class, Creative Programming 2010, we'll be focusing on Processing using the JDK.  So, I've taken the liberty of installing JDK and downloaded the Processing.exe.

I understand that the syntax in the Javascript port is almost identical, but are there any pitfalls to watch out for?  Obviously, not all of the user contributed libraries will be available in processing.js/sketchpad.  Which is another question that I'm sure we'll get to down the road (what other .js libraries integrate with processing?).  But, will I have any problems working mostly offline in the JDK and then copying my sketches over to sketchpad to share?  It seems to be working fine so far, but I just wanted to check.

Thanks.

tapesofwrath's picture
tapesofwrath
Tue, 2010-09-21 06:02

It appears that you can't edit the first post of a thread. But, anyway, I wanted to add that I just found this article in the processing.js reference:

http://processingjs.org/reference/articles/comparing-processing

So, there's no need to link to that. But, if there's anything else that the article missed, I'm all ears :D

Ari Bader-Natal's picture
Ari Bader-Natal
Wed, 2010-09-22 08:42

Good find. The main difference is that you can't access libraries written in Java. You can access amy Javascript libraries that you'd like (e.g. physics engines.) To load an external Javascript file in sketchpad, you'll need to add some non-standard code to your sketch:

loadScript(script_url, callback_function);

(where script URL is the absolute path of the script, and the optional callback_function is the name of a function in your sketch that you would like to be called once the external script has finished loading.)

If you (or anyone else) would like to try this out and post a link to your code, please feel free!