CanvasContext.setLineJoin

解释:设置线条的交点样式。

方法参数

String lineJoin

lineJoin参数说明 :有效值:'bevel'、'round'、'miter', 线条的结束交点样式。

示例

在开发者工具中预览效果

扫码体验

CanvasContext.setLineJoin - 图1请使用百度APP扫码

图片示例

图片

代码示例

  1. const canvasContext = swan.createCanvasContext('myCanvas');
  2. canvasContext.beginPath();
  3. canvasContext.moveTo(10, 10);
  4. canvasContext.lineTo(100, 50);
  5. canvasContext.lineTo(10, 90);
  6. canvasContext.stroke();
  7. canvasContext.beginPath();
  8. canvasContext.setLineJoin('bevel');
  9. canvasContext.setLineWidth(10);
  10. canvasContext.moveTo(50, 10);
  11. canvasContext.lineTo(140, 50);
  12. canvasContext.lineTo(50, 90);
  13. canvasContext.stroke();
  14. canvasContext.beginPath();
  15. canvasContext.setLineJoin('round');
  16. canvasContext.setLineWidth(10);
  17. canvasContext.moveTo(90, 10);
  18. canvasContext.lineTo(180, 50);
  19. canvasContext.lineTo(90, 90);
  20. canvasContext.stroke();
  21. canvasContext.beginPath();
  22. canvasContext.setLineJoin('miter');
  23. canvasContext.setLineWidth(10);
  24. canvasContext.moveTo(130, 10);
  25. canvasContext.lineTo(220, 50);
  26. canvasContext.lineTo(130, 90);
  27. canvasContext.stroke();
  28. canvasContext.draw();