简体   繁体   English

[pde-processing]文件如何与[html-webpage]一起使用

[英]How can a [pde-processing] file work with [html-webpage]

I am trying to load a pde (processing) file with an html webpage so that they can work together. 我正在尝试使用html网页加载pde(处理)文件,以便它们可以一起工作。 In the main folder of the website there are the pde file and the processing.js library file. 在网站的主文件夹中,有pde文件和processing.js库文件。

I wrote this string of code in the "head": 我在“ head”中编写了以下代码字符串:

<script type="text/javascript" src="/scripts/processing.js"></script>

Then at the end of "body" I wrote the "canvas" string: 然后,在“ body”的末尾,我编写了“ canvas”字符串:

<canvas id="your-id-here" data-processing-sources="file1.pde"></canvas>

The webpage that I am working on is really simple, there is only a text link list. 我正在处理的网页非常简单,只有一个文本链接列表。 When I test the index.html the webpage is displayed correctly but the pde doesn't work. 当我测试index.html时,网页可以正确显示,但pde不起作用。 I also noticed that because of the "canvas" string the last link doesn't work anymore. 我还注意到,由于“画布”字符串,最后一个链接不再起作用。

The pde code is a sample copied from the Processing website, basically is drawing with the mouse just when you press the mouse button. pde代码是从Processing网站复制的示例,基本上是在您按下鼠标按钮时使用鼠标进行绘制。

Thank you for your help in advice! 感谢您的帮助!

Make sure you're checking the developer tools for errors. 确保您正在检查开发人员工具中的错误。 Specifically, look at your JavaScript console and the networking tab. 具体来说,请查看您的JavaScript控制台和“网络”标签。

Like you've discovered, you can use Processing.js to deploy simple Processing sketches to the web. 就像发现的一样,您可以使用Processing.js将简单的Processing草图部署到Web上。 Note that Processing.js is pretty old now, so you should only use it if you really need to. 请注意,Processing.js现在已经很老了,因此仅在确实需要时才使用它。 If deploying to the web is a priority, you should consider switching to P5.js . 如果优先部署到Web,则应考虑切换到P5.js。

Shameless self-promotion: here is a guide on using Processing.js to deploy a Processing sketch. 无耻的自我推广: 是有关使用Processing.js部署Processing草图的指南。

If you still can't get it working, please provide the full text of any errors you're receiving, as well as a MCVE that demonstrates exactly what you're doing. 如果仍然无法正常运行,请提供您收到的任何错误的全文,并提供一个MCVE来演示您的工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM