Java Code Examples for android.support.v4.view.animation.PathInterpolatorCompat#create()

The following examples show how to use android.support.v4.view.animation.PathInterpolatorCompat#create() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ContextualSearchImageControl.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
private void animateStaticImageVisibility(boolean visible) {
    // If the panel is expanded then #onUpdateFromPeekToExpand() is responsible for setting
    // mStaticImageVisibility and the static image appearance should not be animated.
    if (visible && mExpandedPercentage > 0.f) return;

    if (mStaticImageVisibilityInterpolator == null) {
        mStaticImageVisibilityInterpolator =
                PathInterpolatorCompat.create(0.4f, 0.f, 0.6f, 1.f);
    }

    mOverlayPanelAnimation.cancelAnimation(this, AnimationType.STATIC_IMAGE_VISIBILITY);

    float endValue = visible ? 1.f : 0.f;
    mOverlayPanelAnimation.addToAnimation(this, AnimationType.STATIC_IMAGE_VISIBILITY,
            mStaticImageVisibilityPercentage, endValue,
            OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS, 0, false,
            mStaticImageVisibilityInterpolator);
}
 
Example 2
Source File: ContextualSearchImageControl.java    From 365browser with Apache License 2.0 6 votes vote down vote up
private void animateCustomImageVisibility(boolean visible) {
    // If the panel is expanded then #onUpdateFromPeekToExpand() is responsible for setting
    // mCustomImageVisibility and the custom image appearance should not be animated.
    if (visible && mExpandedPercentage > 0.f) return;

    if (mCustomImageVisibilityInterpolator == null) {
        mCustomImageVisibilityInterpolator =
                PathInterpolatorCompat.create(0.4f, 0.f, 0.6f, 1.f);
    }

    mOverlayPanelAnimation.cancelAnimation(this, AnimationType.CUSTOM_IMAGE_VISIBILITY);

    float endValue = visible ? 1.f : 0.f;
    mOverlayPanelAnimation.addToAnimation(this, AnimationType.CUSTOM_IMAGE_VISIBILITY,
            mCustomImageVisibilityPercentage, endValue,
            OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS, 0, false,
            mCustomImageVisibilityInterpolator);
}
 
Example 3
Source File: EaseInCirc.java    From Flubber with Apache License 2.0 4 votes vote down vote up
@Override
public Interpolator createInterpolatorFor(AnimationBody animationBody) {
    return PathInterpolatorCompat.create(0.6f, 0.04f, 0.98f, 0.335f);
}
 
Example 4
Source File: EaseInOutExpo.java    From Flubber with Apache License 2.0 4 votes vote down vote up
@Override
public Interpolator createInterpolatorFor(AnimationBody animationBody) {
    return PathInterpolatorCompat.create(1f, 0f, 0f, 1f);
}
 
Example 5
Source File: EaseInExpo.java    From Flubber with Apache License 2.0 4 votes vote down vote up
@Override
public Interpolator createInterpolatorFor(AnimationBody animationBody) {
    return PathInterpolatorCompat.create(0.95f, 0.05f, 0.795f, 0.035f);
}
 
Example 6
Source File: EaseInBack.java    From Flubber with Apache License 2.0 4 votes vote down vote up
@Override
public Interpolator createInterpolatorFor(AnimationBody animationBody) {
    return PathInterpolatorCompat.create(0.6f, -0.28f, 0.735f, 0.045f);
}
 
Example 7
Source File: BzrSpring.java    From Flubber with Apache License 2.0 4 votes vote down vote up
@Override
public Interpolator createInterpolatorFor(AnimationBody animationBody) {
    final float force = animationBody.getForce();
    return PathInterpolatorCompat.create(0.5f, 1.1f + force / 3, 1f, 1f);
}
 
Example 8
Source File: EaseOutQuart.java    From Flubber with Apache License 2.0 4 votes vote down vote up
@Override
public Interpolator createInterpolatorFor(AnimationBody animationBody) {
    return PathInterpolatorCompat.create(0.165f, 0.84f, 0.44f, 1f);
}
 
Example 9
Source File: EaseInOutSine.java    From Flubber with Apache License 2.0 4 votes vote down vote up
@Override
public Interpolator createInterpolatorFor(AnimationBody animationBody) {
    return PathInterpolatorCompat.create(0.445f, 0.05f, 0.55f, 0.95f);    }
 
Example 10
Source File: EaseOutBack.java    From Flubber with Apache License 2.0 4 votes vote down vote up
@Override
public Interpolator createInterpolatorFor(AnimationBody animationBody) {
    return PathInterpolatorCompat.create(0.175f, 0.885f, 0.32f, 1.275f);
}
 
Example 11
Source File: EaseOutQuint.java    From Flubber with Apache License 2.0 4 votes vote down vote up
@Override
public Interpolator createInterpolatorFor(AnimationBody animationBody) {
    return PathInterpolatorCompat.create(0.23f, 1f, 0.32f, 1f);
}
 
Example 12
Source File: EaseOutCirc.java    From Flubber with Apache License 2.0 4 votes vote down vote up
@Override
public Interpolator createInterpolatorFor(AnimationBody animationBody) {
    return PathInterpolatorCompat.create(0.075f, 0.82f, 0.165f, 1f);
}
 
Example 13
Source File: EaseOutQuad.java    From Flubber with Apache License 2.0 4 votes vote down vote up
@Override
public Interpolator createInterpolatorFor(AnimationBody animationBody) {
    return PathInterpolatorCompat.create(0.25f, 0.46f, 0.45f, 0.94f);
}
 
Example 14
Source File: EaseInCubic.java    From Flubber with Apache License 2.0 4 votes vote down vote up
@Override
public Interpolator createInterpolatorFor(AnimationBody animationBody) {
    return PathInterpolatorCompat.create(0.55f, 0.055f, 0.675f, 0.19f);
}
 
Example 15
Source File: EaseInOutCirc.java    From Flubber with Apache License 2.0 4 votes vote down vote up
@Override
public Interpolator createInterpolatorFor(AnimationBody animationBody) {
    return PathInterpolatorCompat.create(0.785f, 0.135f, 0.15f, 0.86f);
}
 
Example 16
Source File: EaseInOut.java    From Flubber with Apache License 2.0 4 votes vote down vote up
@Override
public Interpolator createInterpolatorFor(AnimationBody animationBody) {
    return PathInterpolatorCompat.create(0.42f, 0.0f, 0.58f, 1.0f);
}
 
Example 17
Source File: EaseInSine.java    From Flubber with Apache License 2.0 4 votes vote down vote up
@Override
public Interpolator createInterpolatorFor(AnimationBody animationBody) {
    return PathInterpolatorCompat.create(0.47f, 0f, 0.745f, 0.715f);
}
 
Example 18
Source File: EaseInOutQuad.java    From Flubber with Apache License 2.0 4 votes vote down vote up
@Override
public Interpolator createInterpolatorFor(AnimationBody animationBody) {
    return PathInterpolatorCompat.create(0.455f, 0.03f, 0.515f, 0.955f);
}
 
Example 19
Source File: EaseInQuad.java    From Flubber with Apache License 2.0 4 votes vote down vote up
@Override
public Interpolator createInterpolatorFor(AnimationBody animationBody) {
    return PathInterpolatorCompat.create(0.55f, 0.085f, 0.68f, 0.53f);
}
 
Example 20
Source File: Keyframe.java    From atlas with Apache License 2.0 4 votes vote down vote up
static <T> Keyframe<T> newInstance(JSONObject json, LottieComposition composition, float scale,
    AnimatableValue.Factory<T> valueFactory) {
  PointF cp1 = null;
  PointF cp2 = null;
  float startFrame = 0;
  T startValue = null;
  T endValue = null;
  Interpolator interpolator = null;

  if (json.has("t")) {
    startFrame = (float) json.optDouble("t", 0);
    Object startValueJson = json.opt("s");
    if (startValueJson != null) {
      startValue = valueFactory.valueFromObject(startValueJson, scale);
    }

    Object endValueJson = json.opt("e");
    if (endValueJson != null) {
      endValue = valueFactory.valueFromObject(endValueJson, scale);
    }

    JSONObject cp1Json = json.optJSONObject("o");
    JSONObject cp2Json = json.optJSONObject("i");
    if (cp1Json != null && cp2Json != null) {
      cp1 = JsonUtils.pointFromJsonObject(cp1Json, scale);
      cp2 = JsonUtils.pointFromJsonObject(cp2Json, scale);
    }

    boolean hold = json.optInt("h", 0) == 1;

    if (hold) {
      endValue = startValue;
      // TODO: create a HoldInterpolator so progress changes don't invalidate.
      interpolator = LINEAR_INTERPOLATOR;
    } else if (cp1 != null) {
      interpolator = PathInterpolatorCompat.create(
          cp1.x / scale, cp1.y / scale, cp2.x / scale, cp2.y / scale);
    } else {
      interpolator = LINEAR_INTERPOLATOR;
    }
  } else {
    startValue = valueFactory.valueFromObject(json, scale);
    endValue = startValue;
  }
  return new Keyframe<>(composition, startValue, endValue, interpolator, startFrame, null);
}