[pde-processing] 文件如何与 [html-webpage] 一起工作

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

我正在尝试使用 html 网页加载 pde(处理)文件,以便它们可以协同工作。 在网站的主文件夹中有pde文件和processing.js库文件。

我把这串代码写在"head":

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

然后在 "body" 的末尾我写了 "canvas" 字符串:

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

我正在处理的网页非常简单,只有一个文本 link 列表。当我测试 index.html 时,网页显示正确但 pde 不工作。我还注意到,由于 "canvas" 字符串,最后一个 link 不再起作用。

pde代码是从Processing网站上复制过来的样例,基本上就是鼠标一按就画图

感谢您的帮助指教!

确保检查 developer tools 是否有错误。具体来说,请查看您的 JavaScript 控制台和网络选项卡。

如您所见,您可以使用 Processing.js to deploy simple Processing sketches to the web. Note that Processing.js is pretty old now, so you should only use it if you really need to. If deploying to the web is a priority, you should consider switching to P5.js

无耻的自我推销:here 是使用 Processing.js 部署 Processing sketch 的指南。

如果您仍然无法正常工作,请提供您收到的任何错误的全文,以及 MCVE 以准确说明您在做什么。