Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

157
Visualizações
Canvas and arc drawing doesnt work properly in html and javascript

So I have this Canvas on which I have my circle and when I try to change the x and y of my circle it glitches.It appears like this when I try to move it towards the left by changing the x value to 10 changing the x to any other value makes no change: When I change arc's x value to 10 or below

When I change y to more than 110:

When I change arc's y value to 110 or above

HTML:

<span id="span_canvas">
<canvas id ="MyCanvas" style="padding-left: 1215px;padding-bottom: 415px;margin: 
0px;border:ridge rgb(127, 117, 117);"></canvas>
</span>

Javascript:

function Circle(radius ,fillcolor){
    let canvas=document.getElementById("MyCanvas");
    let ctx= canvas.getContext("2d");
    ctx.beginPath();
    ctx.arc(100, 110, 50, 0, 2 * Math.PI);
    ctx.strokeStyle="#c3c3c3";
    ctx.fillStyle=fillcolor
    ctx.stroke()
    ctx.fill();
    fillcolor=red
}
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Remove padding-left: 1215px;padding-bottom: 415px; and see what is going on. The area where the circle appears to be cut out is padding area. In other words, the position of the circle is outside the content area.

about 4 years ago · Juan Pablo Isaza Relatório

0

You need to Include Height an Width Tags to xour canvas

<canvas id ="canvas" height="200px" style="padding-left: 1215px;padding-bottom: 415px;margin: 
0px;border:ridge rgb(127, 117, 117);"></canvas>

Then it will work.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda