List of usage examples for android.support.v4.view.animation PathInterpolatorCompat create
public static Interpolator create(float controlX1, float controlY1, float controlX2, float controlY2)
From source file:org.chromium.chrome.browser.compositor.bottombar.contextualsearch.ContextualSearchImageControl.java
private void animateThumbnailVisibility(boolean visible) { if (mThumbnailVisibilityInterpolator == null) { mThumbnailVisibilityInterpolator = PathInterpolatorCompat.create(0.4f, 0.f, 0.6f, 1.f); }/*from w ww . java 2 s . com*/ mOverlayPanelAnimation.cancelAnimation(this, AnimationType.THUMBNAIL_VISIBILITY); float endValue = visible ? 1.f : 0.f; mOverlayPanelAnimation.addToAnimation(this, AnimationType.THUMBNAIL_VISIBILITY, mThumbnailVisibilityPercentage, endValue, OverlayPanelAnimation.BASE_ANIMATION_DURATION_MS, 0, false, mThumbnailVisibilityInterpolator); }
From source file:com.cuelogic.android.WheelIndicatorView.java
public void startItemsAnimation() { ObjectAnimator animation = ObjectAnimator.ofInt(WheelIndicatorView.this, "filledPercent", 0, filledPercent); animation.setDuration(ANIMATION_DURATION); animation.setInterpolator(PathInterpolatorCompat.create(0.4F, 0.0F, 0.2F, 1.0F)); animation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override//from w ww . j a v a2 s . c om public void onAnimationUpdate(ValueAnimator animation) { recalculateItemsAngles(); invalidate(); } }); animation.start(); }
From source file:com.zhihu.android.app.mirror.widget.ArtboardView.java
private void onActionRelease() { if (mCallback != null && Math.abs(mDragDistance) > mDragDismissDistance) { mCallback.onDragDismiss(this, mIsDragDown); } else {//from ww w. j a v a2s.co m 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(); } }
From source file:com.brayanarias.alarmproject.activity.AlarmScreenActivity.java
private void starAnimation() { View pulseView = findViewById(R.id.pulse); View pulseDismiss = findViewById(R.id.pulseDismiss); View pulseSnooze = findViewById(R.id.pulseSnooze); ValueAnimator pulseAnimator = ObjectAnimator.ofPropertyValuesHolder(pulseView, PropertyValuesHolder.ofFloat(View.SCALE_X, 0.0f, 1.0f), PropertyValuesHolder.ofFloat(View.SCALE_Y, 0.0f, 1.0f), PropertyValuesHolder.ofFloat(View.ALPHA, 1.0f, 0.0f)); pulseAnimator.setDuration(2000);/*from ww w .j a v a2 s. c om*/ pulseAnimator.setRepeatCount(ValueAnimator.INFINITE); Interpolator interpolator = PathInterpolatorCompat.create(0.0f, 0.0f, 0.2f, 1.0f); pulseAnimator.setInterpolator(interpolator); pulseAnimator.start(); ValueAnimator dismissAnimator = ObjectAnimator.ofPropertyValuesHolder(pulseDismiss, PropertyValuesHolder.ofFloat(View.SCALE_X, 0.0f, 1.0f), PropertyValuesHolder.ofFloat(View.SCALE_Y, 0.0f, 1.0f), PropertyValuesHolder.ofFloat(View.ALPHA, 1.0f, 0.0f)); dismissAnimator.setDuration(1000); dismissAnimator.setRepeatCount(ValueAnimator.INFINITE); dismissAnimator.setInterpolator(interpolator); dismissAnimator.start(); ValueAnimator snoozeAnimator = ObjectAnimator.ofPropertyValuesHolder(pulseSnooze, PropertyValuesHolder.ofFloat(View.SCALE_X, 0.0f, 1.0f), PropertyValuesHolder.ofFloat(View.SCALE_Y, 0.0f, 1.0f), PropertyValuesHolder.ofFloat(View.ALPHA, 1.0f, 0.0f)); snoozeAnimator.setDuration(1000); snoozeAnimator.setRepeatCount(ValueAnimator.INFINITE); snoozeAnimator.setInterpolator(interpolator); snoozeAnimator.start(); }
From source file:com.savvasdalkitsis.betwixt.Interpolators.java
/** * <strong>ANDROID INTERPOLATOR</strong><br/><br/> * Create an Interpolator for a cubic Bezier curve. The end points (0, 0) and (1, 1) are assumed. * @param controlX1 the x coordinate of the first control point of the cubic Bezier * @param controlY1 the y coordinate of the first control point of the cubic Bezier * @param controlX2 the x coordinate of the second control point of the cubic Bezier * @param controlY2 the y coordinate of the second control point of the cubic Bezier *//*from w w w . ja va2s . c o m*/ @NonNull public static Interpolator path(int controlX1, int controlY1, int controlX2, int controlY2) { return PathInterpolatorCompat.create(controlX1, controlY1, controlX2, controlY2); }
From source file:com.taobao.weex.dom.action.AnimationAction.java
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:// w w w.j a v a 2 s .com //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; }
From source file:io.imoji.sdk.grid.ui.ResultView.java
private Animation getAppearAnimation() { Animation fadeInAnimation = AnimationUtils.loadAnimation(context, R.anim.search_widget_result_fade_in); fadeInAnimation.setInterpolator(PathInterpolatorCompat.create(0.3f, 0.14f, 0.36f, 1.36f)); return fadeInAnimation; }
From source file:io.imoji.sdk.grid.ui.ResultView.java
private Animation getDisappearAnimation() { Animation fadeOutAnimation = AnimationUtils.loadAnimation(context, R.anim.search_widget_result_fade_out); fadeOutAnimation.setInterpolator(PathInterpolatorCompat.create(0.25f, 0.1f, 0.25f, 1)); return fadeOutAnimation; }
From source file:com.taobao.weex.ui.animation.WXAnimationModule.java
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://ww w . j av a 2 s.c o m //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; }
From source file:com.android.deskclock.timer.TimerFullScreenFragment.java
private Animator getRevealAnimator(View source, int revealColor) { final ViewGroup containerView = (ViewGroup) source.getRootView().findViewById(android.R.id.content); final Rect sourceBounds = new Rect(0, 0, source.getHeight(), source.getWidth()); containerView.offsetDescendantRectToMyCoords(source, sourceBounds); final int centerX = sourceBounds.centerX(); final int centerY = sourceBounds.centerY(); final int xMax = Math.max(centerX, containerView.getWidth() - centerX); final int yMax = Math.max(centerY, containerView.getHeight() - centerY); final float startRadius = Math.max(sourceBounds.width(), sourceBounds.height()) / 2.0f; final float endRadius = (float) Math.sqrt(xMax * xMax + yMax * yMax); final CircleView revealView = new CircleView(source.getContext()).setCenterX(centerX).setCenterY(centerY) .setFillColor(revealColor);//from w w w. jav a 2 s . co m containerView.addView(revealView); final Animator revealAnimator = ObjectAnimator.ofFloat(revealView, CircleView.RADIUS, startRadius, endRadius); revealAnimator.setInterpolator(PathInterpolatorCompat.create(0.0f, 0.0f, 0.2f, 1.0f)); final ValueAnimator fadeAnimator = ObjectAnimator.ofFloat(revealView, View.ALPHA, 0.0f); fadeAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { containerView.removeView(revealView); } }); final AnimatorSet animatorSet = new AnimatorSet(); animatorSet.setDuration(TimerFragment.ANIMATION_TIME_MILLIS); animatorSet.playSequentially(revealAnimator, fadeAnimator); return revealAnimator; }