Jump to content

Filled arc not covering entire angle


cokelid
 Share

Recommended Posts

I'm trying to draw something like a pie-chart style with filled wedges / arcs. However when I do a filled arc it does not quite fill the entire angle-span.

E.g. These two arcs span different angles, even though the calls to graphics.arc are identical...

    // Filled Arc
    graphics.lineStyle(1, 0xffd900, 1);
    graphics.beginFill(0xFF700B);
    graphics.arc(0, 0, r, game.math.degToRad(0), game.math.degToRad(90), true);
    graphics.endFill();
    
    // Non-filled Arc
    graphics.lineStyle(1, 0x00ffff, 1);
    graphics.arc(0, 0, r, game.math.degToRad(0), game.math.degToRad(90), true);

 

See here: //phaser.io/sandbox/VouJszKL/play

The non-filled arc covers the full 270 degrees, but the filled arc is missing the last bit.

Any ideas?

Thanks!

Link to comment
Share on other sites

You can set the accuracy/fidelity as a final argument:

graphics.arc(0, 0, r, game.math.degToRad(0), game.math.degToRad(90), true,800);

http://phaser.io/docs/2.6.1/PIXI.Graphics.html#arc

it will add more segments/ calculation points to your arc.I think (after measuring) your execution time will increase linearly, but you cannot really see a difference in the arc above 800-1000 segments.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...