return;
}
final long startTime = System.currentTimeMillis();
final AnimationCallback animationCallback = new AnimationCallback() {
@Override
public void execute(double now) {
if (now >= startTime + step.getTime()) {
ScrollPanelTouchImpl.this.pos(step.x, step.y);
ScrollPanelTouchImpl.this.animating = false;
if (issueEvent) {
fireEvent(new ScrollAnimationEndEvent());
}
ScrollPanelTouchImpl.this.startAnimation(issueEvent);
return;
}
now = (now - startTime) / step.getTime() - 1;
double easeOut = Math.sqrt(1 - now * now);
int newX = (int) Math.round((step.getX() - startX) * easeOut + startX);
int newY = (int) Math.round((step.getY() - startY) * easeOut + startY);
ScrollPanelTouchImpl.this.pos(newX, newY);
fireEvent(new ScrollAnimationMoveEvent());
if (ScrollPanelTouchImpl.this.animating)
ScrollPanelTouchImpl.this.aniTime = AnimationScheduler.get().requestAnimationFrame(this);
}
};
animationCallback.execute(startTime);
}