android.support.v4.view.animation.PathInterpolatorCompat Java Examples
The following examples show how to use
android.support.v4.view.animation.PathInterpolatorCompat.
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: NestedTouchScrollingLayout.java From NestedTouchScrollingLayout with MIT License | 6 votes |
/** * 即将下掉 * @param event */ @Deprecated public void onActionRelease(MotionEvent event) { float distance = countDragDistanceFromMotionEvent(event); if (mTransYAnim != null && mTransYAnim.isRunning()) { mTransYAnim.cancel(); } mTransYAnim = ObjectAnimator.ofFloat(mChildView, View.TRANSLATION_Y, mChildView.getTranslationY(), 0.0F); mTransYAnim.setDuration(200L); mTransYAnim.setInterpolator(PathInterpolatorCompat.create(0.4F, 0.0F, 0.2F, 1.0F)); mTransYAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { } }); mTransYAnim.start(); }
Example #2
Source File: ContextualSearchImageControl.java From 365browser with Apache License 2.0 | 6 votes |
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: ArtboardView.java From mirror with GNU General Public License v3.0 | 6 votes |
private void onActionRelease() { if (mCallback != null && Math.abs(mDragDistance) > mDragDismissDistance) { mCallback.onDragDismiss(this, mIsDragDown); } else { if (mTransYAnim != null && mTransYAnim.isRunning()) { mTransYAnim.cancel(); } mTransYAnim = ObjectAnimator.ofFloat(this, View.TRANSLATION_Y, getTranslationY(), 0.0F); mTransYAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { float dragTo = (Float) animation.getAnimatedValue(); if (mCallback != null) { mCallback.onDrag(ArtboardView.this, mDragDismissDistance, dragTo); } } }); mTransYAnim.setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime)); mTransYAnim.setInterpolator(PathInterpolatorCompat.create(0.4F, 0.0F, 0.2F, 1.0F)); mTransYAnim.start(); } }
Example #4
Source File: ContextualSearchImageControl.java From AndroidChromium with Apache License 2.0 | 6 votes |
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 #5
Source File: AnimationAction.java From ucar-weex-core with Apache License 2.0 | 5 votes |
private @Nullable Interpolator createTimeInterpolator() { String interpolator = mAnimationBean.timingFunction; if (!TextUtils.isEmpty(interpolator)) { switch (interpolator) { case WXAnimationBean.EASE_IN: return new AccelerateInterpolator(); case WXAnimationBean.EASE_OUT: return new DecelerateInterpolator(); case WXAnimationBean.EASE_IN_OUT: return new AccelerateDecelerateInterpolator(); case WXAnimationBean.LINEAR: return new LinearInterpolator(); default: //Parse cubic-bezier try { SingleFunctionParser<Float> parser = new SingleFunctionParser<>( mAnimationBean.timingFunction, new SingleFunctionParser.FlatMapper<Float>() { @Override public Float map(String raw) { return Float.parseFloat(raw); } }); List<Float> params = parser.parse(WXAnimationBean.CUBIC_BEZIER); if (params != null && params.size() == WXAnimationBean.NUM_CUBIC_PARAM) { return PathInterpolatorCompat.create( params.get(0), params.get(1), params.get(2), params.get(3)); } else { return null; } } catch (RuntimeException e) { return null; } } } return null; }
Example #6
Source File: FlyRefreshLayout.java From FlyRefresh with MIT License | 5 votes |
@Override public void startRefresh() { if (mFlyAnimator != null) { mFlyAnimator.end(); } final View iconView = getIconView(); UIUtils.clearAnimator(iconView); AnimatorSet flyUpAnim = new AnimatorSet(); flyUpAnim.setDuration(800); ObjectAnimator transX = ObjectAnimator.ofFloat(iconView, "translationX", 0, getWidth()); ObjectAnimator transY = ObjectAnimator.ofFloat(iconView, "translationY", 0, -mHeaderController.getHeight()); transY.setInterpolator(PathInterpolatorCompat.create(0.7f, 1f)); ObjectAnimator rotation = ObjectAnimator.ofFloat(iconView, "rotation", -45, 0); rotation.setInterpolator(new DecelerateInterpolator()); ObjectAnimator rotationX = ObjectAnimator.ofFloat(iconView, "rotationX", 0, 60); rotationX.setInterpolator(new DecelerateInterpolator()); flyUpAnim.playTogether(transX, transY, rotationX, ObjectAnimator.ofFloat(iconView, "scaleX", 1, 0.5f), ObjectAnimator.ofFloat(iconView, "scaleY", 1, 0.5f), rotation ); mFlyAnimator = flyUpAnim; mFlyAnimator.start(); if (mListener != null) { mListener.onRefresh(FlyRefreshLayout.this); } }
Example #7
Source File: TouchPullView.java From BeFoot with Apache License 2.0 | 5 votes |
private void initTangentInterpolator() { if (mCircleRadius > 0 && (mDragHeight >= mCircleRadius * 2)) { // The run // 270~360~mTangentAngle=>0~90~mTangentAngle // When drag double radius the angle = MIN_RUN_ANGLE mTangentInterpolator = PathInterpolatorCompat.create((mCircleRadius * 2) / mDragHeight, MIN_RUN_ANGLE / (MIN_RUN_ANGLE + mTangentAngle)); } }
Example #8
Source File: ChatActivity.java From belvedere with Apache License 2.0 | 5 votes |
@Override public void onScroll(int height, int scrollArea, float scrollPosition) { final Interpolator interpolator = PathInterpolatorCompat.create(.19f,0f,.2f,1f); final float interpolation = interpolator.getInterpolation((scrollPosition * .30f)); final int bottomPadding = (int) (-1f * interpolation * scrollArea); findViewById(R.id.activity_input).setTranslationY(bottomPadding); findViewById(R.id.activity_recyclerview).setTranslationY(bottomPadding); }
Example #9
Source File: WXAnimationModule.java From weex-uikit with MIT License | 5 votes |
private static @Nullable Interpolator createTimeInterpolator(@NonNull WXAnimationBean animation) { String interpolator = animation.timingFunction; if (!TextUtils.isEmpty(interpolator)) { switch (interpolator) { case WXAnimationBean.EASE_IN: return new AccelerateInterpolator(); case WXAnimationBean.EASE_OUT: return new DecelerateInterpolator(); case WXAnimationBean.EASE_IN_OUT: return new AccelerateDecelerateInterpolator(); case WXAnimationBean.LINEAR: return new LinearInterpolator(); default: //Parse cubic-bezier try { SingleFunctionParser<Float> parser = new SingleFunctionParser<>( animation.timingFunction, new SingleFunctionParser.FlatMapper<Float>() { @Override public Float map(String raw) { return Float.parseFloat(raw); } }); List<Float> params = parser.parse(WXAnimationBean.CUBIC_BEZIER); if (params != null && params.size() == WXAnimationBean.NUM_CUBIC_PARAM) { return PathInterpolatorCompat.create( params.get(0), params.get(1), params.get(2), params.get(3)); } else { return null; } }catch (RuntimeException e){ return null; } } } return null; }
Example #10
Source File: EaseInSine.java From Flubber with Apache License 2.0 | 4 votes |
@Override public Interpolator createInterpolatorFor(AnimationBody animationBody) { return PathInterpolatorCompat.create(0.47f, 0f, 0.745f, 0.715f); }
Example #11
Source File: TreeDrawable.java From FlyRefresh with MIT License | 4 votes |
public void updateTree() { final Interpolator interpolator = PathInterpolatorCompat.create(0.8f, -0.6f * mBendScale); final float width = DEFAULT_WIDTH * mSizeFactor; final float height = DEFAULT_HEIGHT * mSizeFactor; final float maxMove = width * 0.45f * mBendScale; final float trunkSize = width * 0.05f; final float branchSize = width * 0.2f; final float x0 = width / 2; final float y0 = height; mBaseLine.reset(); mBaseLine.moveTo(x0, y0); final int N = 50; final float dp = 1f / N; final float dy = -dp * height; float y = y0; float p = 0; float[] xx = new float[N + 1]; float[] yy = new float[N + 1]; for (int i = 0; i <= N; i++) { xx[i] = interpolator.getInterpolation(p) * maxMove + x0; yy[i] = y; mBaseLine.lineTo(xx[i], yy[i]); y += dy; p += dp; } mTrunk.reset(); mTrunk.moveTo(x0 - trunkSize, y0); int max = (int) (N * 0.6f); int max1 = (int) (max * 0.6f); float diff = max - max1; for (int i = 0; i < max; i++) { if (i < max1) { mTrunk.lineTo(xx[i] - trunkSize, yy[i]); } else { mTrunk.lineTo(xx[i] - trunkSize * (max - i) / diff, yy[i]); } } for (int i = max - 1; i >= 0; i--) { if (i < max1) { mTrunk.lineTo(xx[i] + trunkSize, yy[i]); } else { mTrunk.lineTo(xx[i] + trunkSize * (max - i) / diff, yy[i]); } } mTrunk.close(); mBranch.reset(); int min = (int) (N * 0.4f); diff = N - min; mBranch.addArc(new RectF(xx[min] - branchSize, yy[min] - branchSize, xx[min] + branchSize, yy[min] + branchSize), 0f, 180f); for (int i = min; i <= N; i++) { mBranch.lineTo(xx[i] + branchSize - ((i - min) / diff) * branchSize, yy[i]); } for (int i = N; i >= min; i--) { mBranch.lineTo(xx[i] - branchSize + ((i - min) / diff) * branchSize, yy[i]); } mBranch.close(); }
Example #12
Source File: EaseIn.java From Flubber with Apache License 2.0 | 4 votes |
@Override public Interpolator createInterpolatorFor(AnimationBody animationBody) { return PathInterpolatorCompat.create(0.42f, 0.0f, 1.0f, 1.0f); }
Example #13
Source File: EaseInQuint.java From Flubber with Apache License 2.0 | 4 votes |
@Override public Interpolator createInterpolatorFor(AnimationBody animationBody) { return PathInterpolatorCompat.create(0.755f, 0.05f, 0.855f, 0.06f); }
Example #14
Source File: EaseOut.java From Flubber with Apache License 2.0 | 4 votes |
@Override public Interpolator createInterpolatorFor(AnimationBody animationBody) { return PathInterpolatorCompat.create(0.0f, 0.0f, 0.58f, 1.0f); }
Example #15
Source File: EaseInOutQuad.java From Flubber with Apache License 2.0 | 4 votes |
@Override public Interpolator createInterpolatorFor(AnimationBody animationBody) { return PathInterpolatorCompat.create(0.455f, 0.03f, 0.515f, 0.955f); }
Example #16
Source File: EaseOutCubic.java From Flubber with Apache License 2.0 | 4 votes |
@Override public Interpolator createInterpolatorFor(AnimationBody animationBody) { return PathInterpolatorCompat.create(0.215f, 0.61f, 0.355f, 1f); }
Example #17
Source File: EaseOutSine.java From Flubber with Apache License 2.0 | 4 votes |
@Override public Interpolator createInterpolatorFor(AnimationBody animationBody) { return PathInterpolatorCompat.create(0.39f, 0.575f, 0.565f, 1f); }
Example #18
Source File: EaseOutCirc.java From Flubber with Apache License 2.0 | 4 votes |
@Override public Interpolator createInterpolatorFor(AnimationBody animationBody) { return PathInterpolatorCompat.create(0.075f, 0.82f, 0.165f, 1f); }
Example #19
Source File: EaseInOutBack.java From Flubber with Apache License 2.0 | 4 votes |
@Override public Interpolator createInterpolatorFor(AnimationBody animationBody) { return PathInterpolatorCompat.create(0.68f, -0.55f, 0.265f, 1.55f); }
Example #20
Source File: EaseInBack.java From Flubber with Apache License 2.0 | 4 votes |
@Override public Interpolator createInterpolatorFor(AnimationBody animationBody) { return PathInterpolatorCompat.create(0.6f, -0.28f, 0.735f, 0.045f); }
Example #21
Source File: EaseInOutPathInterpolator.java From android_additive_animations with Apache License 2.0 | 4 votes |
public static Interpolator create() { return PathInterpolatorCompat.create(0.25f, 0.1f, 0.25f, 1.f); }
Example #22
Source File: EaseInQuart.java From Flubber with Apache License 2.0 | 4 votes |
@Override public Interpolator createInterpolatorFor(AnimationBody animationBody) { return PathInterpolatorCompat.create(0.895f, 0.03f, 0.685f, 0.22f); }
Example #23
Source File: Keyframe.java From atlas with Apache License 2.0 | 4 votes |
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); }
Example #24
Source File: EaseInQuad.java From Flubber with Apache License 2.0 | 4 votes |
@Override public Interpolator createInterpolatorFor(AnimationBody animationBody) { return PathInterpolatorCompat.create(0.55f, 0.085f, 0.68f, 0.53f); }
Example #25
Source File: EaseInOutQuint.java From Flubber with Apache License 2.0 | 4 votes |
@Override public Interpolator createInterpolatorFor(AnimationBody animationBody) { return PathInterpolatorCompat.create(0.86f, 0f, 0.07f, 1f); }
Example #26
Source File: EaseOutExpo.java From Flubber with Apache License 2.0 | 4 votes |
@Override public Interpolator createInterpolatorFor(AnimationBody animationBody) { return PathInterpolatorCompat.create(0.19f, 1f, 0.22f, 1f); }
Example #27
Source File: EaseInOut.java From Flubber with Apache License 2.0 | 4 votes |
@Override public Interpolator createInterpolatorFor(AnimationBody animationBody) { return PathInterpolatorCompat.create(0.42f, 0.0f, 0.58f, 1.0f); }
Example #28
Source File: EaseInOutQuart.java From Flubber with Apache License 2.0 | 4 votes |
@Override public Interpolator createInterpolatorFor(AnimationBody animationBody) { return PathInterpolatorCompat.create(0.77f, 0f, 0.175f, 1f); }
Example #29
Source File: EaseInCubic.java From Flubber with Apache License 2.0 | 4 votes |
@Override public Interpolator createInterpolatorFor(AnimationBody animationBody) { return PathInterpolatorCompat.create(0.55f, 0.055f, 0.675f, 0.19f); }
Example #30
Source File: EaseOutQuad.java From Flubber with Apache License 2.0 | 4 votes |
@Override public Interpolator createInterpolatorFor(AnimationBody animationBody) { return PathInterpolatorCompat.create(0.25f, 0.46f, 0.45f, 0.94f); }