path.html 700 B

123456789101112131415161718192021222324252627282930313233343536
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Path Example</title>
  5. <script src="../dist/kity.js"></script>
  6. <style>
  7. .stroke-green {
  8. stroke: green;
  9. stroke-linejoin: round;
  10. }
  11. </style>
  12. </head>
  13. <body></body>
  14. <script>
  15. var paper = new kity.Paper(document.body).pipe(function() {
  16. this.setWidth(900);
  17. this.setHeight(600);
  18. this.setViewBox(0, 0, 400, 300);
  19. });
  20. var path = new kity.Path().pipe(function() {
  21. this.getDrawer().pipe(function(d) {
  22. d.moveTo(10, 10);
  23. d.carcTo(60, 100, 100);
  24. d.lineTo(200, 50);
  25. d.close();
  26. });
  27. this.fill('none');
  28. this.stroke('red');
  29. });
  30. paper.addShape(path);
  31. </script>
  32. </html>