在processing.js 中使用处理库
对于那些不知道的人来说,Processing 是一个很棒的 Java 库 = 用于呈现漂亮的数据可视化效果,并用作以下内容的包装器:乔格。
Processing.js 是该库的 Javascript 端口。
为了在 HTML 中创建处理小程序,您需要 3 样东西。
- processing.js
- everything.html
- everything.pde // 处理程序
我基本上正在尝试 js 版本,问题是如果 pde 中包含任何库,它就不会加载到画布内。
以下是 2 个示例:
- 此是一个无需库即可生成一些基本形状的示例。
- 这是一个使用方便的 fisica 库的示例。如果我尝试使用与此相同的格式,则它将无法加载。
我有两个假设:
- 在使用processing.js 中的任何库之前必须完成一些配置。
- 所有用于处理的库都放在默认库文件夹 \Processing\modes\java 中。 HTML 文件显然无法达到这一点,因此也许还有另一种方法可以将文件添加到应用程序中?
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.
- processing.js
- anything.html
- 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:
- 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:
- There is some configuration that must be done before using any libraries in processing.js.
- 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是,Processing.js 不支持处理库。这是因为它们是编译后的 Java 字节码,而不是 Java 源代码。对于物理学,您可以使用 Box2D.js。请参阅processingjs.org 上的教程。如需详细了解与Processing相比Processing.js的局限性,请参阅我们的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.