下面列出了android.view.animation.DecelerateInterpolator#getInterpolation() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private void animateDown(long delta)
{
int minHeight = bar.getRadius() * 2;
int fromHeight = (int) (bar.getMaxHeight() * toHeightPart);
float timePart = (float) delta / BAR_ANIMATION_DOWN_DURATION;
DecelerateInterpolator interpolator = new DecelerateInterpolator();
int height = minHeight + (int) ((1f - interpolator.getInterpolation(timePart)) * (fromHeight - minHeight));
if (height > bar.getHeight()) {
return;
}
if (height <= minHeight) {
finish();
return;
}
bar.setHeight(height);
bar.update();
}
private void animateDown(long delta) {
int minHeight = bar.getRadius() * 2;
int fromHeight = (int) (bar.getMaxHeight() * toHeightPart);
float timePart = (float) delta / BAR_ANIMATION_DOWN_DURATION;
DecelerateInterpolator interpolator = new DecelerateInterpolator();
int height = minHeight + (int) ((1f - interpolator.getInterpolation(timePart)) * (fromHeight - minHeight));
if (height > bar.getHeight()) {
return;
}
if (height <= minHeight) {
finish();
return;
}
bar.setHeight(height);
bar.update();
}
private void animateDown(long delta) {
int minHeight = bar.getRadius() * 2;
int fromHeight = (int) (bar.getMaxHeight() * toHeightPart);
float timePart = (float) delta / BAR_ANIMATION_DOWN_DURATION;
DecelerateInterpolator interpolator = new DecelerateInterpolator();
int height = minHeight + (int) ((1f - interpolator.getInterpolation(timePart)) * (fromHeight - minHeight));
if (height > bar.getHeight()) {
return;
}
if (height <= minHeight) {
finish();
return;
}
bar.setHeight(height);
bar.update();
}