Hi everyone I'm new to the forums and I really hope I can get some help with this problem
I've been working really hard lately looking everywhere to try and figure out how to get my Java animations to flow smoothly, the main problem I have is the animation runs smooth with hiccups every 2 seconds where the animation appears to "pop" ahead of itself and then "pop" back making the animation look choppy.
Here's a short example that I created to show you guys the problem i'm having. Should be easy to compile and run if you wanna give it a try. When you run it you'll see a blue rectangle slide back and fourth on the screen, if you watch it for a bit you should notice that the rectangle seems to stop and start briefly, or "pop" ahead of itself and then jump back making the animation kinda choppy.
So my question is, what could be causing this? Any suggestions on the code or maybe some ideas on better ways to achieve a nice animation?
Thank you all for taking the time
I've also tried the following to account for the time it might take to draw a frame and compensate for the that time by sleeping less if the frame took time to draw, didn't seem to help :/