I use the physics engine for motion, but I do time based animation and it is smooth on both android phone and desktop:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| private boolean processAnimation() { if (_animationSpeed == 0) { return false; }
if (!_animate) { return false; }
final double timeDiff = System.currentTimeMillis() - _lastTime; if (timeDiff < _animationSpeed) { return false; }
_lastTime += _animationSpeed; if ((++_currentFrame) >= _totalFrames) { _currentFrame = 0; } return true; } |
It ++s to ensure that if a frame gets skipped due to time delay it will keep incrementing frames until we get to where we are supposed to be (I guess the 'tunnel' effect, but with animation).