Android animation interpolator: AcceletateDecelerate
Posted petewell
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Android animation interpolator: AcceletateDecelerate相关的知识,希望对你有一定的参考价值。
android animation interpolator: AcceletateDecelerate
AccelerateDecelerate:
y = cos((t+1)π)/2+0.5
可让动画看起来较平顺,系统默认的interpolator也是AcceletateDecelerate
Demo:
Source:
public class AccelerateDecelerateInterpolator extends BaseInterpolator implements NativeInterpolatorFactory
public AccelerateDecelerateInterpolator()
@SuppressWarnings("UnusedDeclaration")
public AccelerateDecelerateInterpolator(Context context, AttributeSet attrs)
public float getInterpolation(float input)
return (float)(Math.cos((input + 1) * Math.PI) / 2.0f) + 0.5f;
// y = cos((t + 1)Math.PI)/2 + 0.5
@Override
public long createNativeInterpolator()
return NativeInterpolatorFactoryHelper.createAccelerateDecelerateInterpolator();
原文:大专栏 Android animation interpolator: AcceletateDecelerate
以上是关于Android animation interpolator: AcceletateDecelerate的主要内容,如果未能解决你的问题,请参考以下文章
Android - 如何获取 android.R.anim.slide_in_right
android之animator 和animation 的区别