A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/apis/canvas/CanvasRenderingContext2D/miterLimit below:

miterLimit ยท WebPlatform Docs

miterLimit Summary

The current miter limit ratio.

Property of apis/canvas/CanvasRenderingContext2Dapis/canvas/CanvasRenderingContext2D

Syntax
var result = CanvasRenderingContext2D.miterLimit;
CanvasRenderingContext2D.miterLimit = value;
Return Value

Returns an object of type NumberNumber

When setting, values that are not finite values greater than zero are ignored. Default is 10.0.

Examples

The following example shows the effect of the miterLimit

function draw() {
  var ctx = document.getElementById('canvas').getContext('2d');

  
  ctx.clearRect(0,0,150,150);

  
  ctx.strokeStyle = '#09f';
  ctx.lineWidth   = 2;
  ctx.strokeRect(-5,50,160,50);

  
  ctx.strokeStyle = '#000';
  ctx.lineWidth = 10;

  
  ctx.miterLimit = 7;

  
  ctx.beginPath();
  ctx.moveTo(0,100);
  for (i=0;i<24;i++){
    var dy = i%2==0 ? 25 : -25 ;
    ctx.lineTo(Math.pow(i,1.5)*2,75+dy);
  }
  ctx.stroke();
  return false;
}
Notes

The miter length is the distance from the point where two lines meet to the point where two lines that are drawn along the outer edges of the two lines would intersect. If the ratio of these values exceeds the miterLimit value, a lineJoin miter style is not drawn.

Related specifications
W3C HTML Canvas 2D Specification
W3C Candidate Recommendation
Attributions

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4