Animation speed on different devices

2020-08-01 07:15发布

问题:

I have a simple translation animation in an Android game I am developing. When I test it on several devices, it runs at very different speeds on 10-inch tablets, 7-inch tablets and smartphones.

What is the "state of the art" way of getting a uniform animation speed on different devices?

Thanks,

回答1:

I finally decided to use display.metrics to get the pixel density of the devices. Then I adjust the translation motion speed by dividing by the density value.

Still wondering if this is the "state of the art" way of controlling animation speed on various devices???



回答2:

Animation duration should be same on all devices. But since the dimensions change, also the visual "distance" changes ad that's why you have an impression that the speed is different.

Possible solution for this is to switch between different screen sizes and set different animation duration for them