5

For those that don't know, Processing is a great Java library =for rendering nice visualizations of data and serves as a wrapper for JOGL.

Processing.js is the Javascript port of this library.

In order to create a processing applet inside HTML, you need 3 things.

  1. processing.js
  2. anything.html
  3. anything.pde // Processing program

I'm basically trying out the js version and the problem is that if any libraries are included in the pde, it won't load inside the canvas.


Here are 2 examples:

  1. This is an example that spawns some basic shapes with no libraries required.
  2. This is an example that uses the handy fisica library. If I try it in the same format as this then it will not load.

I have 2 hypotheses:

  1. There is some configuration that must be done before using any libraries in processing.js.
  2. All libraries for Processing are put in the default library folder \Processing\modes\java. This is obviously not being reached by the HTML file so perhaps there is another way to add the files into the application?
3
  • Possible duplicate - stackoverflow.com/questions/7742617 Commented Nov 2, 2011 at 20:33
  • @ChrisF This question was how. That question was why. Commented Nov 3, 2011 at 13:47
  • 1
    I wasn't 100% sure, that's why I just presented the link and didn't vote to close. Commented Nov 3, 2011 at 13:48

1 Answer 1

2

Unfortunately, Processing.js does not support Processing libraries. This because they are compiled Java bytecode, not Java source code. For physics, you could use Box2D.js. See a tutorial on processingjs.org. For more information on the limitations of Processing.js as compared to Processing, see our P5 quick start guide.

Sign up to request clarification or add additional context in comments.

1 Comment

There ARE some libraries which are 'cross-platform', that is, they work with (at least) Java and Javascript. Two examples I know of are Guido and RiTa, but there may well be others...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.