animation - Drawing Concentric Circles, appearing one at a time, Java -
i'm trying draw concentric circles appear 1 @ time, smallest largest outward. i'm wanting give illusion of circle expanding, adding additional circle outside of existing outer circle each time loop executes. @ moment circles appear @ same time when run program. please help, have no idea how this. in advance.
public static void drawcircles(graphics g) { int radius = 10; int x = 0; while(x <= 10) { int z = radius / 2; g.drawoval(100 - z, 100 - z, radius, radius); x++; radius = radius + 10; } }
to pause program between circle draws add call thread.sleep(long millis) millis number of milliseconds want pause.
public static void drawcircles(graphics g) { int radius = 10; int x = 0; while(x <= 10) { int z = radius / 2; g.drawoval(100 - z, 100 - z, radius, radius); try { thread.sleep(1000); } catch (interruptedexception e) { } x++; radius = radius + 10; } }
Comments
Post a Comment