p5.js-web-editor/server/domain-objects/createDefaultFiles.js

51 lines
908 B
JavaScript

const defaultSketch = `// liveUpdate
function drawMask(detection) {
stroke('red')
strokeWeight(2)
rect(detection.x, detection.y, detection.width, detection.height)
}
`;
const defaultHTML =
`<!DOCTYPE html>
<html>
<head>
<script src="/assets/p5.js"></script>
<script src="/assets/ml5.js"></script>
<script src="/assets/webcam.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
<meta charset="utf-8" />
</head>
<body>
<script src="sketch.js"></script>
</body>
</html>
`;
const defaultCSS =
`html, body {
margin: 0;
padding: 0;
}
canvas {
display: block;
width: 100% !important;
height: auto !important;
}
`;
export default function createDefaultFiles() {
return {
'index.html': {
content: defaultHTML
},
'style.css': {
content: defaultCSS
},
'sketch.js': {
content: defaultSketch
}
};
}