Anthony Restaino
8 years ago
11 changed files with 53 additions and 9 deletions
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
package acr.browser.lightning.interpolator; |
||||
|
||||
import android.os.Build; |
||||
import android.support.annotation.NonNull; |
||||
import android.view.animation.DecelerateInterpolator; |
||||
import android.view.animation.Interpolator; |
||||
import android.view.animation.PathInterpolator; |
||||
|
||||
/** |
||||
* Bezier decelerate curve similar to iOS. |
||||
* On Kitkat and below, it reverts to a |
||||
* decelerate interpolator. |
||||
*/ |
||||
public class BezierDecelerateInterpolator implements Interpolator { |
||||
|
||||
@NonNull |
||||
private static final Interpolator PATH_INTERPOLATOR; |
||||
|
||||
static { |
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { |
||||
PATH_INTERPOLATOR = new PathInterpolator(0.25f, 0.1f, 0.25f, 1); |
||||
} else { |
||||
PATH_INTERPOLATOR = new DecelerateInterpolator(); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public float getInterpolation(float input) { |
||||
return PATH_INTERPOLATOR.getInterpolation(input); |
||||
} |
||||
} |
@ -0,0 +1,6 @@
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:controlX1="0.25" |
||||
android:controlY1="0.1" |
||||
android:controlX2="0.25" |
||||
android:controlY2="1"/> |
@ -0,0 +1,2 @@
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<decelerateInterpolator/> |
Loading…
Reference in new issue