Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

156
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda