IntelliJ IDEA中的P5.js?

几天前我开始学习p5.js,现在我想使用IntelliJ IDEA代替p5.js online editorconst array1 =[{"id": 1,"value": false},{"id": 2,{"id": 3,"value": true},{"id": 4,"value": false}] const array2 = [{"id": 1},{"id": 4}] const result = array1.map(({id,value}) => ({ id,value: value || array2.some(item => item.id === id) })) console.log(result)setup()draw()函数之类的大多数东西都可以正常工作,但是ellipse()函数却无法正常工作-它带有绿色下划线,并且错误消息显示“未解决的函数或方法createCanvas()”。

我尝试使用VSCode,并且在那里运行良好,但是我更喜欢使用IntelliJ,所以我想知道是否(如果可以)如何使它在IntelliJ中工作。

createCanvas()
<script src="p5.js"></script> //p5.js is the file with all the code from the official p5js.org homepage.
<script src="sketch.js"></script> //sketch.js is the file where my code that should be executed is located
hanxuesong1988 回答:IntelliJ IDEA中的P5.js?

p5函数定义为p5.prototype.<function name> = function(){},因此IDE在这里需要一个名称空间...作为一种解决方法,请尝试安装p5类型:在 Preferences |语言和框架| JavaScript |库,请按下载... ,然后从列表中选择p5。这应该可以解决问题

enter image description here

,

我曾经通过结合使用Live Edit插件和分屏式Chrome和IntelliJ来模仿IntelliJ IDEA中的p5js在线编辑器。该插件会在Chrome窗口中自动更新您的HTML / JS,您可以立即看到更改p5js代码的结果。仅当您在调试模式下运行HTML / JS文件时,它才起作用。

这是一个例子:

enter image description here

本文链接:https://www.f2er.com/3166877.html

大家都在问