Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <canvas id='cv' width=400 height=500></canvas>
</body>
</html>
 
var ctx=document.getElementById('cv').getContext('2d');
function drawLine(x, y, thk, alpha) {
  ctx.save();
  ctx.translate(x,y);
  ctx.fillText('line drawn at ' + x  + ' ' + y + '   lineWidth ' + thk + '   alpha ' + alpha  , 0,0);
  ctx.moveTo(0,50);
  ctx.lineTo(50, 50);
  ctx.lineTo(50, 20);
  ctx.closePath();
  ctx.lineWidth=thk;
  ctx.globalAlpha  = alpha;
  ctx.stroke();
  ctx.restore();
  
}
drawLine(10,20,1.0, 1.0);
drawLine(10.5,80 + 20.5,1.0, 1.0 );
drawLine(10.5, 2*80 + 20.5, 0.5, 1.0 );
drawLine(10.5, 3*80 + 20.5, 1.0, 0.8  );
drawLine(10.5, 4*80 + 20.5, 0.25, 1.0 );
drawLine(10.5, 5*80 + 20.5, 1.0, 0.5 );
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers