49 lines
873 B
JavaScript
49 lines
873 B
JavaScript
const defaultSketch = `// liveUpdate
|
|
|
|
function drawMask(detection) {
|
|
stroke('red');
|
|
strokeWeight(2);
|
|
rect(detection.box.x, detection.box.y, detection.box.width, detection.box.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;
|
|
}
|
|
`;
|
|
|
|
export default function createDefaultFiles() {
|
|
return {
|
|
'index.html': {
|
|
content: defaultHTML
|
|
},
|
|
'style.css': {
|
|
content: defaultCSS
|
|
},
|
|
'sketch.js': {
|
|
content: defaultSketch
|
|
}
|
|
};
|
|
}
|