开发者

Slow Moving Objects (Visual)

开发者 https://www.devze.com 2023-04-04 02:10 出处:网络
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

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 c开发者_运维技巧reate smooth slow movement, such as there is in Adobe Flash.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消