How to clear the old position circle path?


#1

hey! I have a problem that if I want to move the position of a circle path the old position is always still here, my question is how to I remove the old position circle when I set a new position of a circle path. Thanks you for any help.
code just like that:
Path p1;
p1.addEllipse(0, 0, 100, 100);
g.fillPath(p1); //old position
p1.applyTransform(AffineTransform::translation(200, 200));
g.fillPath(p1); //new position


#2

Path::clear()!!!
https://docs.juce.com/master/classPath.html#a69d4fda65a46a1f1f32cbec49ebc0910
Read the docs!
https://docs.juce.com/master/classGraphics.html#ae965bf1c5fadee50c665b6508eb3e8f4
Graphics::fillEllipse()


#3

You are filling the path two times, therefore the path is displayed two times :slight_smile:
During one paint call you can only paint one frame. So you want either draw only the old position or the new position. You can use e.g. a timer callback and call repaint() on your component, so it gets redrawn after that (async).