Search code examples
html5-canvaskineticjs

kineticjs how to calculate inner radius


When I define a circle what is the actual size of the circle in pixels? inside and outside the stroke? for example if I define the following circle:

  var circle = new Kinetic.Circle({
    x: stage.width()/2,
    y: stage.height()/2,
    radius: 600,
    stroke: 'black',
    strokeWidth: 1000,
      draggable:true
  });

I would expect a radius of 1600 with an inner radius of 600 but that is not what I get so how do I calculate the inner radius and outter radius?


Solution

  • the inner radius is radius - half the stroke width

    the outter radius is radius + half the stroke width