use of android.view.animation.PathInterpolator in project android_frameworks_base by DirtyUnicorns.
the class FlingAnimationUtils method getDismissingProperties.
private AnimatorProperties getDismissingProperties(float currValue, float endValue, float velocity, float maxDistance) {
float maxLengthSeconds = (float) (mMaxLengthSeconds * Math.pow(Math.abs(endValue - currValue) / maxDistance, 0.5f));
float diff = Math.abs(endValue - currValue);
float velAbs = Math.abs(velocity);
float y2 = calculateLinearOutFasterInY2(velAbs);
float startGradient = y2 / LINEAR_OUT_FASTER_IN_X2;
Interpolator mLinearOutFasterIn = new PathInterpolator(0, 0, LINEAR_OUT_FASTER_IN_X2, y2);
float durationSeconds = startGradient * diff / velAbs;
if (durationSeconds <= maxLengthSeconds) {
mAnimatorProperties.interpolator = mLinearOutFasterIn;
} else if (velAbs >= mMinVelocityPxPerSecond) {
// Cross fade between linear-out-faster-in and linear interpolator with current
// velocity.
durationSeconds = maxLengthSeconds;
VelocityInterpolator velocityInterpolator = new VelocityInterpolator(durationSeconds, velAbs, diff);
InterpolatorInterpolator superInterpolator = new InterpolatorInterpolator(velocityInterpolator, mLinearOutFasterIn, mLinearOutSlowIn);
mAnimatorProperties.interpolator = superInterpolator;
} else {
// Just use a normal interpolator which doesn't take the velocity into account.
durationSeconds = maxLengthSeconds;
mAnimatorProperties.interpolator = Interpolators.FAST_OUT_LINEAR_IN;
}
mAnimatorProperties.duration = (long) (durationSeconds * 1000);
return mAnimatorProperties;
}
use of android.view.animation.PathInterpolator in project Android-Material-Examples by saulmm.
the class GUIUtils method configureWindowEnterExitExplodeTransition.
public static void configureWindowEnterExitExplodeTransition(Window w) {
Fade ex = new Fade();
ex.setInterpolator(new PathInterpolator(0.4f, 0, 1, 1));
ex.setDuration(5000);
w.setExitTransition(ex);
w.setEnterTransition(ex);
}
Aggregations