2

When I try to move graphical objects across the screen at steps which are not whole numbers (for example, 0.5 pixels per frame) this results in choppy and 'laggy' movement; as the object will simply move 1 pixel every two frames.

I understand why this is happening as the x / y values of an object must be Integers, but I wonder if there is anyway to create smooth slow movement, such as there is in Adobe Flash.

Acidic
  • 5,984
  • 10
  • 44
  • 79

1 Answers1

4

Graphics2D allows you to draw at sub-pixel accuracy and as long as your actual object is drawn using its primitive (as opposed to being a fixed bitmap), this should actually have a visible effect.

Make sure that the KEY_ANTIALIASING rendering hint is set to VALUE_ANTIALIASING_ON

Joachim Sauer
  • 291,719
  • 55
  • 540
  • 600