html canvas 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
I made a library for thr HTML5 canvas.
https://jsfiddle.net/Catking/g0z6o1fb/
Example 3: javascript create canvas
var canvas = document.createElement("canvas");
document.body.appendChild(canvas);
Example 4: javascritp canvas
var canvas = document.body.appendChild(document.createElement("canvas"));
var ctx = canvas.getContext("2d");
ctx.beginPath();
ctx.arc(canvas.width / 2, canvas.height / 2, 50, 0, Math.PI * 2);
ctx.fillStyle = "red";
ctx.strokeStyle = "black";
ctx.stroke();
ctx.fill();
Example 5: canvas tag html
<canvas id="canv"></canvas>
var canvas = document.getElementById("canv");
canvas.width = canvas.height = 100;
var ctx = canvas.getContext("2d");
ctx.fillStyle = "red";
ctx.fillRect(10, 10, 80, 80);
Example 6: html5 canvas
<canvas id="" width="" height=""></canvas>
<script>
</script>