3

For those that don't know, processing is a language/ Java library primarily used for displaying data nice and pretty.

Processing.js is its javascript port made by John Resiq. Everything that guy makes is a treasure.

As per a previous question I learned that Processing's many libraries would not work in processing.js. Why is this? Processing provides a makeshift compiler that turns the processing code into its javascript equivalent.

For context to this question, I'm building a game for a final year project and am looking into using processing.js as the base. Whats holding the processing.js back from being an even bigger force in the web is the lack of libraries (honorable mention to box2d.js).

The 2 problems with processing.js is that the compiler for pde to js doesn't handle any other processing.js libraries. Only the core processing objects and functions.

The other is the sheer lack of Processing libraries ported to work with processing.js


So the question summarized:

What is it that holds processing and processing.js back from using the libraries already buit?

Is it worth my time following John resiq's steps and porting some of the processing libraries to Javascript? bare in mind, it took him 7 months.

IS it worth while building on top of his compiler and trying to make it somewhat dynamic in figuring out where external libraries have been called.

OVERTONE
  • 11,797
  • 20
  • 71
  • 87
  • Perhaps someone could say why they think it should be closed? – OVERTONE Oct 12 '11 at 16:38
  • 1
    possible duplicate of [Using processing libraries in processing.js](http://stackoverflow.com/questions/7681540/using-processing-libraries-in-processing-js) – Oded Nov 02 '11 at 20:21

1 Answers1

6

Processing.js and Processing may look similar, but obviously there are differences.

AFAIK Processing was made to make the life of designers/artists wanting to extend they're toolset via programming easier. Originally it was built as a Java library and a minimal IDE (the PDE). Processing.js is a port of that library in javascript.

This means that while to the user, Processing and Processing.js may look the same, behind the scenes the implementation is very different. As different as Java is to Javascript actually :)

To understand why Processing libraries won't work in Processing.js is to understand the differences between Java and Javascript. For example, javascript is a scripting language interpreted by the browser, while java code get's compiled into bytecode that is then executed by a virtual machine (the Java Virtual Machine (JVM)).

In conclusion, you can not use a Processing library (which is a Java library) with Processing.js, but you can port a Processing library from Java to Javascript if you want to. Toxiclibs.js is great example of that.

toxiclibs1 toxiclibs2 toxiclibs3

George Profenza
  • 50,687
  • 19
  • 144
  • 218
  • very explicit clear answer. Thanks very much. Any thoughts on me adding to the processing.js converter so it handles libraries. In other words it can figure out this piece of processing code belong to the toxilib.js library. Too ambitious? – OVERTONE Oct 12 '11 at 16:27
  • I'm glad my explanations help. I'm afraid I'm not familiar with the processing.js converter. What you're suggesting is to check Processing java code and if it contains toxiclibs code for example, you would use toxiclibs.js if that's the case ? – George Profenza Oct 12 '11 at 17:48
  • yes.sorry if thats not clear. http://processingjs.org/reference/articles/jsQuickStart#processingcodetojavascript. This is a compiler that parses processing code and turns it to js. I would be building on that so that it could detect libraries and attempt a link to the js files. – OVERTONE Oct 13 '11 at 00:03
  • Other Processing libraries that are 'cross-platform' (that is, they work with Java and Javascript): [Guido](https://github.com/fjenett/Guido) and [RiTa](http://www.rednoise.org/RiTa/) – rednoyz Feb 22 '14 at 09:43