在processing.js中使用处理库 [英] Using processing libraries in processing.js
问题描述
对于那些不知道的,处理是一个伟大的Java库=用于呈现良好的数据可视化,并作为JOGL的包装器。
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 是Javascript端口
Processing.js is the Javascript port of this library.
为了在HTML中创建一个处理applet,你需要3件事情。
In order to create a processing applet inside HTML, you need 3 things.
- processing.js
- anything.html
- anything.pde //处理程序
我基本上尝试js版本,问题是如果任何库包含在pde中,它将不会加载到画布中。
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.
以下是两个示例:
- 这是一个生成一些基本形状的示例,不需要库。
- 这是一个使用方便的fisica库的示例。如果我以与此格式相同的格式尝试,则不会加载。
- This is an example that spawns some basic shapes with no libraries required.
- 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:
- 在processing.js中使用任何库之前,必须进行一些配置。
- 处理的所有库都放在默认库文件夹\Processing\modes\java中。这显然是HTML文件没有达到的,所以也许有另一种方式添加文件到应用程序?
推荐答案
不幸的是,Processing.js不支持Processing库。这是因为它们是编译的Java字节码,而不是Java源代码。对于物理,你可以使用Box2D.js。有关processingjs.org的信息,请参见教程。有关Processing与Processing相比的限制的详细信息,请参阅我们的 P5快速入门指南 。
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.
这篇关于在processing.js中使用处理库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!