You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.8 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Rectangle Testing</title>
  6. <link rel="stylesheet" href="../css/style.css">
  7. <!-- IE 9: display inline SVG -->
  8. <meta http-equiv="X-UA-Compatible" content="IE=9">
  9. <script type="text/javascript" src="../../dist/paper-full.js"></script>
  10. <script type="text/paperscript" canvas="canvas">
  11. var point1 = new Point(10, 10);
  12. var size1 = new Size(50, 50);
  13. var rectangle1 = new Rectangle(point1, size1);
  14. var path1 = new Path.Rectangle(rectangle1);
  15. path1.strokeColor = 'black';
  16. path1.fillColor = 'red';
  17. path1.id = "square1";
  18. path1.strokeCap = "square";
  19. path1.opacity = ".1";
  20. path1.dashArray = [5, 2];
  21. path1.dashOffset = "0";
  22. var point2 = new Point(75, 75);
  23. var point22 = new Point(100, 100);
  24. var path2 = new Path.Rectangle(point2, point22);
  25. path2.strokeColor = 'red';
  26. path2.strokeWidth = '4';
  27. path2.fillColor = 'blue';
  28. path2.id = "square2";
  29. path2.strokeCap = "butt";
  30. path2.opacity = "1";
  31. var point3 = new Point(150, 150);
  32. var size3 = new Size(50, 50);
  33. var rectangle3 = new Rectangle(point3, size3);
  34. var path3 = new Path.Rectangle(rectangle3);
  35. path3.strokeColor = 'blue';
  36. var point4 = new Point(200, 200);
  37. var size4 = new Size(100, 100);
  38. var rectangle4 = new Rectangle(point4, size4);
  39. var cornerSize4 = new Size(30, 30);
  40. var path4 = new Path.Rectangle(rectangle4, cornerSize4);
  41. path4.strokeColor= 'yellow';
  42. path4.fillColor='purple';
  43. document.body.appendChild(project.exportSVG());
  44. </script>
  45. </head>
  46. <body>
  47. <canvas id="canvas" width="500" height="500"></canvas>
  48. </body>
  49. </html>