Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
221 views
in Technique[技术] by (71.8m points)

java - What is it that stops processings libraries from being used to processing.js

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...