亲爱的,我没有找到一个正常的解释,所以我决定寻求你的帮助。我想在 html 文件中创建一个 paper.js 项目。我无法连接它们的问题我尝试使用 var scope = new paper.PaperScope();
scope.setup(myCanvas);
但它没有成功。这是取自 Paper.js 网站的代码
<!DOCTYPE html>
<html>
<head>
<!-- Load the Paper.js library -->
<script type="text/javascript" src="paper.js"></script>
<!-- Define inlined JavaScript -->
<script type="text/javascript">
// Only executed our code once the DOM is ready.
var scope = new paper.PaperScope();
scope.setup(myCanvas);
var myPath = new Path();
myPath.strokeColor = 'black';
// This function is called whenever the user
// clicks the mouse in the view:
function onMouseDown(event) {
// Add a segment to the path at the position of the mouse:
myPath.add(event.point);
}
</script>
</head>
<body>
<canvas id="myCanvas" resize></canvas>
</body>
</html>
但它在这里没有做任何事情......感谢您的关注。