canvas html
snippet in html

canvas html

user1126


<canvas id="myCanvas" width="200" height="100"></canvas>
 

canvas html

user7477


 var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");

 ctx.moveTo(0, 0);
ctx.lineTo(200, 100);

 ctx.stroke(); 

javascript canvas

user4695

#this code creates a circle within a canvas that must be created in HTML
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.beginPath();
ctx.arc(95, 50, 40, 0, 2 * Math.PI);
ctx.stroke();