Answers for "get canvas javascript"

3

javascript canvas

#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();
Posted by: Guest on April-03-2020
0

js draw canvas on canvas

<canvas id="canvas-1"></canvas>
<canvas id="canvas-2"></canvas>
<script>
  const canvas1 = document.getElementById("canvas-1");
  const canvas2 = document.getElementById("canvas-2");
  const ctx1 = canvas1.getContext("2d");
  const ctx2 = canvas2.getContext("2d");
  ctx1.fillStyle = "red";
  ctx1.fillRect(10, 10, canvas1.width - 20, canvas.height - 20);
  ctx2.drawImage(canvas1, 0, 0);
</script>
Posted by: Guest on January-10-2022

Code answers related to "Javascript"

Browse Popular Code Answers by Language