user2587454 user2587454 - 23 days ago 8
CSS Question

how to draw a shape by using canvas or css?

i'm looking for a way to create this shape with html(css) or canvas.

thanks.

enter image description here

Answer

Try this:

<script>
  var canvas = document.getElementById('myCanvas'),
      context = canvas.getContext('2d'),
      startAngle = 1.2 * Math.PI,
      endAngle = 0.8 * Math.PI;

  context.beginPath();
  context.moveTo(50, 70);
  context.lineTo(250, 70);
  context.arc(300, 100, 50, startAngle, endAngle, false);
  context.lineTo(50, 130);
  context.closePath();
  context.lineWidth = 5;
  context.strokeStyle = 'blue';
  context.stroke();
</script>

For detailed information have a look here

Comments