0
我無法讓Paper.js繪製一個矩形。我按照教程,但似乎沒有任何工作。你能告訴我下面的代碼有什麼問題嗎?如何在Paper.js中繪製矩形?
<!DOCTYPE html>
<html>
<head>
<!--load paper.js-->
<script type="text/javascript" src="http://localhost/node_modules/paper/dist/paper-core.js"></script>
<!--drawing script-->
<script type="text/javascript" canvas="canvas">
window.onload = function() {
var canvas = document.getElementById("canvas");
paper.setup(canvas);
var meterStart = new paper.Point(5,5);
var meterSize = new paper.Size(40, 720);
var meter = new paper.Rectangle(meterStart, meterSize);
meter.strokeColor = 'black';
paper.view.draw();
}
</script>
</head>
<body>
<canvas id="canvas" height="750px" width="600px"></canvas>
</body>
</html>
這就是我需要知道。謝謝! – imsamimsamimsam
更多信息可以在這裏找到:http://paper.js/tutorials/paths/creating-predefined-shapes/ 如果您覺得這篇文章有幫助,請留下評論。 – ethanchewy