项目源码在github,欢迎star:https://github.com/toly1994328/NumGo
使用
mNumGo1.setInterpolator(new D_Sin_Inter())sin式减速
mNumGo1 = new NumGo(); mNumGo1.setInterpolator(new D_Sin_Inter()); mNumGo1.setOnUpdate(new NumGo.OnUpdate() { @Override public void onUpdate(float rate) { mSinD.setTranslationY(-1200 * rate); } });sin式加速
mNumGo2 = new NumGo(); mNumGo2.setInterpolator(new A_Sin_Inter()); mNumGo2.setOnUpdate(new NumGo.OnUpdate() { @Override public void onUpdate(float rate) { mSinA.setTranslationY(-1200 * rate); } });x平方式减速:
mNumGo3 = new NumGo(); mNumGo3.setInterpolator(new D_X2_Inter()); mNumGo3.setOnUpdate(new NumGo.OnUpdate() { @Override public void onUpdate(float rate) { mXD.setTranslationY(-1200 * rate); } });x平方式加速:
mNumGo4 = new NumGo(); mNumGo4.setInterpolator(new A_X2_Inter()); mNumGo4.setOnUpdate(new NumGo.OnUpdate() { @Override public void onUpdate(float rate) { mXA.setTranslationY(-1200 * rate); } });运行:
@OnClick(R.id.start) public void onViewClicked() { mNumGo1.go(); mNumGo2.go(); mNumGo3.go(); mNumGo4.go(); }转载于:https://www.cnblogs.com/toly-top/p/9782010.html
相关资源:JAVA上百实例源码以及开源项目