我正在尝试在电子桌面应用程序中使用p5.js。我尝试使用来自github的模板,但是它没有工作,我尝试了设置我自己的,它也不起作用。
下面是我的index.html代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Test</title>
<script src="p5.js" type="text/javascript" charset="utf-8"/>
<script src="sketch.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
</body>
</html> 下面是我的index.js代码:
const {app, BrowserWindow} = require('electron');
app.on('ready', () => {
let window = new BrowserWindow({
width: 1000,
height: 500,
webPreferences: {
nodeIntegration: true,
},
})
window.loadFile('index.html');
}) 发布于 2021-04-14 18:09:18
我想您可以从p5.js本身复制index.html,因为rn似乎并不是在引用其中任何一个文件中的实际库。这应该是您需要的所有html:
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.2.0/p5.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.2.0/addons/p5.sound.min.js"></script>
</head>以及:
<body>
<script src="sketch.js"></script>
</body>https://stackoverflow.com/questions/67042473
复制相似问题