mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 11:18:21 +00:00
27 lines
627 B
Java
27 lines
627 B
Java
|
|
package com.android.launcher3;
|
||
|
|
|
||
|
|
import android.animation.TimeInterpolator;
|
||
|
|
|
||
|
|
public class LogDecelerateInterpolator implements TimeInterpolator {
|
||
|
|
|
||
|
|
int mBase;
|
||
|
|
int mDrift;
|
||
|
|
final float mLogScale;
|
||
|
|
|
||
|
|
public LogDecelerateInterpolator(int base, int drift) {
|
||
|
|
mBase = base;
|
||
|
|
mDrift = drift;
|
||
|
|
|
||
|
|
mLogScale = 1f / computeLog(1, mBase, mDrift);
|
||
|
|
}
|
||
|
|
|
||
|
|
static float computeLog(float t, int base, int drift) {
|
||
|
|
return (float) -Math.pow(base, -t) + 1 + (drift * t);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public float getInterpolation(float t) {
|
||
|
|
return computeLog(t, mBase, mDrift) * mLogScale;
|
||
|
|
}
|
||
|
|
}
|