html5 canvas to code code example

Example 1: javascript canvas

<canvas id="canvas"></canvas>
<script>

	var canvas = document.getElementById('canvas');
    var ctx = canvas.getContext('2d');
  
	ctx.beginPath();
	ctx.rect(x, y, width, height);
  	ctx.fillStyle = 'limegreen';
  	ctx.fill();
  
  	ctx.beginPath();
  	ctx.arc(x, y, radius, startAngle, endAngle, counterClockWise(optional));
  	ctx.strokeStyle = 'black';
  	ctx.stroke();

</script>

Example 2: html5 canvas

<canvas id="" width="" height=""></canvas>
<script>
	
</script>

Tags:

Html Example