带LinearInterpolator的android动画
我有一些点,它们是按钮,从屏幕的顶部到底部垂直设置动画。带LinearInterpolator的android动画,android,animation,linear-interpolation,Android,Animation,Linear Interpolation,我有一些点,它们是按钮,从屏幕的顶部到底部垂直设置动画。我实现了以下功能: spot.animate().x(x2).y(y2).scaleX(SCALE_X).scaleY(SCALE_Y).setDuration(animationTime).setListener ( new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator ani
我实现了以下功能:
spot.animate().x(x2).y(y2).scaleX(SCALE_X).scaleY(SCALE_Y).setDuration(animationTime).setListener
(
new AnimatorListenerAdapter()
{
@Override
public void onAnimationStart(Animator animation)
{
animators.add(animation);
}
public void onAnimationEnd(Animator animation)
{
animators.remove(animation);
if (!gamePaused )
{
....
}
}
}
);
问题:
我发现按钮在动画开始时加速,动画结束时减速
如何使用LinearInterpolator
修改代码,以使动画在整个过程中保持匀速
谢谢 是否尝试使用ViewPropertyImator类中的方法?因此,您的代码如下所示:
spot.animate().x(x2).y(y2).scaleX(SCALE_X).scaleY(SCALE_Y).setInterpolator(new LinearInterpolator()).setDuration(animationTime).setListener(
new AnimatorListenerAdapter()
{
@Override
public void onAnimationStart(Animator animation)
{
animators.add(animation);
}
public void onAnimationEnd(Animator animation)
{
animators.remove(animation);
if (!gamePaused )
{
....
}
}
}
);