Example usage for android.animation ObjectAnimator setInterpolator

List of usage examples for android.animation ObjectAnimator setInterpolator

Introduction

In this page you can find the example usage for android.animation ObjectAnimator setInterpolator.

Prototype

@Override
public void setInterpolator(TimeInterpolator value) 

Source Link

Document

The time interpolator used in calculating the elapsed fraction of this animation.

Usage

From source file:com.hannesdorfmann.home.filter.FilterAdapter.java

@Override
public FilterViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
    final FilterViewHolder holder = new FilterViewHolder(
            LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.filter_item, viewGroup, false));

    holder.itemView.setOnClickListener(new View.OnClickListener() {
        @Override/*from   w w  w.  j av a  2  s .  co  m*/
        public void onClick(View v) {
            final int position = holder.getAdapterPosition();
            if (position == RecyclerView.NO_POSITION)
                return;

            final SourceFilterPresentationModel filter = filters.get(position);
            holder.itemView.setHasTransientState(true);
            ObjectAnimator fade = ObjectAnimator.ofInt(holder.filterIcon, ViewUtils.IMAGE_ALPHA,
                    filter.getEnabled() ? FILTER_ICON_DISABLED_ALPHA : FILTER_ICON_ENABLED_ALPHA);
            fade.setDuration(300);
            fade.setInterpolator(AnimationUtils.loadInterpolator(holder.itemView.getContext(),
                    android.R.interpolator.fast_out_slow_in));
            fade.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    holder.itemView.setHasTransientState(false);
                    clickedListener.onSourceFilterClicked(filter);
                }
            });
            fade.start();
        }
    });
    return holder;
}

From source file:andoridhost.imczy.com.activitymaterial.custom.ReturnChangePosition.java

@Override
public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {
    if (null == startValues || null == endValues) {
        return null;
    }//from www.  j  a v a  2  s  .c  om

    if (startValues.view.getId() > 0) {
        Rect startRect = (Rect) startValues.values.get(PROPNAME_POSITION);
        Rect endRect = (Rect) endValues.values.get(PROPNAME_POSITION);

        final View view = endValues.view;

        Log.e(TAG, "createAnimator: startRect = " + startRect + " , endRect = " + endRect);

        Path changePosPath = getPathMotion().getPath(startRect.centerX(), startRect.centerY(),
                endRect.centerX(), endRect.centerY() - endRect.height() / 2);

        int radius = startRect.centerY() - endRect.centerY();

        Log.e(TAG, "createAnimator: startRect center x = " + startRect.centerX() + " , centerY= "
                + startRect.centerY());
        Log.w(TAG, "createAnimator: end rect  center x = " + endRect.centerX() + " , centerY= "
                + endRect.centerY());

        ObjectAnimator objectAnimator = ObjectAnimator.ofObject(view, new PropPosition(PointF.class, "position",
                new PointF(startRect.centerX(), startRect.centerY())), null, changePosPath);
        objectAnimator.setInterpolator(new FastOutSlowInInterpolator());

        return objectAnimator;
    }
    return null;

}

From source file:io.vit.vitio.StartScreens.DetailFragment.java

public void animate() {
    ObjectAnimator animatorY = ObjectAnimator.ofFloat(displayImage, "translationY", 200, 0);
    ObjectAnimator animatorA = ObjectAnimator.ofFloat(displayImage, "alpha", 0, 1);
    animatorY.setDuration(200);/*from  w  w  w  . j a  v  a  2 s .co  m*/
    animatorA.setDuration(200);
    animatorY.setInterpolator(new AccelerateInterpolator());
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(animatorY, animatorA);
    animatorSet.start();
}

From source file:com.google.samples.apps.topeka.widget.quiz.AbsQuizView.java

private void resizeViewProperty(Property<View, Float> property, float targetScale, int durationOffset) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(this, property, 1f, targetScale);
    animator.setInterpolator(mLinearOutSlowInInterpolator);
    animator.setStartDelay(FOREGROUND_COLOR_CHANGE_DELAY + durationOffset);
    animator.start();/*from ww w  . j a  v a  2 s. co  m*/
}

From source file:com.example.android.interpolator.InterpolatorFragment.java

/**
 * Start an animation on the sample view.
 * The view is animated using an {@link android.animation.ObjectAnimator} on the
 * {@link View#SCALE_X} and {@link View#SCALE_Y} properties, with its animation based on a path.
 * The only two paths defined here ({@link #mPathIn} and {@link #mPathOut}) scale the view
 * uniformly.//from w w  w  .  j a v a2 s  . c o  m
 *
 * @param interpolator The interpolator to use for the animation.
 * @param duration     Duration of the animation in ms.
 * @param path         Path of the animation
 * @return The ObjectAnimator used for this animation
 * @see android.animation.ObjectAnimator#ofFloat(Object, String, String, android.graphics.Path)
 */
public ObjectAnimator startAnimation(Interpolator interpolator, long duration, Path path) {
    // This ObjectAnimator uses the path to change the x and y scale of the mView object.
    ObjectAnimator animator = ObjectAnimator.ofFloat(mView, View.SCALE_X, View.SCALE_Y, path);

    // Set the duration and interpolator for this animation
    animator.setDuration(duration);
    animator.setInterpolator(interpolator);

    animator.start();

    return animator;
}

From source file:sg.fxl.topeka.widget.quiz.AbsQuizView.java

private void resizeViewProperty(Property<View, Float> property, float targetScale, int durationOffset) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(this, property, 1f, targetScale);
    animator.setInterpolator(linearOutSlowInInterpolator);
    animator.setStartDelay(FOREGROUND_COLOR_CHANGE_DELAY + durationOffset);
    animator.start();/* w ww  .  j a  va 2 s.c o m*/
}

From source file:andoridhost.imczy.com.activitymaterial.custom.ChangePosition.java

@Override
public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {
    if (null == startValues || null == endValues) {
        return null;
    }/*from   w w w .j  ava  2  s.c o  m*/

    if (startValues.view.getId() > 0) {
        Rect startRect = (Rect) startValues.values.get(PROPNAME_POSITION);
        Rect endRect = (Rect) endValues.values.get(PROPNAME_POSITION);

        final View view = endValues.view;

        Log.e(TAG, "createAnimator: startRect = " + startRect + " , endRect = " + endRect);

        Path changePosPath = getPathMotion().getPath(startRect.centerX(), startRect.centerY(),
                endRect.centerX(), endRect.centerY());

        int radius = startRect.centerY() - endRect.centerY();

        ObjectAnimator objectAnimator = ObjectAnimator.ofObject(view,
                new PropPosition(PointF.class, "position", new PointF(endRect.centerX(), endRect.centerY())),
                null, changePosPath);
        objectAnimator.setInterpolator(new FastOutSlowInInterpolator());

        return objectAnimator;
    }
    return null;

}

From source file:com.gigigo.imagerecognition.vuforia.VuforiaActivity.java

private void startBoringAnimation() {
    scanLine.setVisibility(View.VISIBLE);
    // Create animators for y axe
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        int yMax = 0;
        yMax = getResources().getDisplayMetrics().heightPixels; //mVuforiaView.getDisplay().getHeight();
        yMax = (int) (yMax * 0.9);// 174;

        ObjectAnimator oay = ObjectAnimator.ofFloat(scanLine, "translationY", 0, yMax);
        oay.setRepeatCount(Animation.INFINITE);
        oay.setDuration(ANIM_DURATION);/*ww w  . ja va2  s  .c o  m*/
        oay.setRepeatMode(ValueAnimator.REVERSE);

        oay.setInterpolator(new LinearInterpolator());
        oay.start();

        //for draw points near ir_scanline
        markFakeFeaturePoint.setObjectAnimator(oay);
    }

    //scanAnimation.

}

From source file:com.telenav.expandablepager.SlidingContainer.java

/**
 * Animate translationY to the next stopValue
 * @param amount translationY amount//  w  ww.j a  va2 s.  co m
 * @param duration animation duration
 * @param interpolator  animation interpolator
 */
private void animate(final float amount, int duration, Interpolator interpolator) {
    ObjectAnimator oa = ObjectAnimator.ofFloat(this, View.TRANSLATION_Y, amount).setDuration(duration);
    oa.setInterpolator(interpolator);
    oa.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            notifySlideEvent(Math.round(((Float) animation.getAnimatedValue())));
        }
    });
    oa.addListener(new CustomAnimationListener() {
        @Override
        public void onAnimationEnd(Animator animator) {
            onSettled(stopValueIndex);
        }
    });
    oa.start();
}

From source file:com.hippo.widget.ProgressView.java

private void setupAnimators() {
    ObjectAnimator trimStart = ObjectAnimator.ofFloat(this, "trimStart", 0.0f, 0.75f);
    trimStart.setDuration(1333L);//www  .  j  av  a2  s .  c  o m
    trimStart.setInterpolator(TRIM_START_INTERPOLATOR);
    trimStart.setRepeatCount(Animation.INFINITE);

    ObjectAnimator trimEnd = ObjectAnimator.ofFloat(this, "trimEnd", 0.0f, 0.75f);
    trimEnd.setDuration(1333L);
    trimEnd.setInterpolator(TRIM_END_INTERPOLATOR);
    trimEnd.setRepeatCount(Animation.INFINITE);

    ObjectAnimator trimOffset = ObjectAnimator.ofFloat(this, "trimOffset", 0.0f, 0.25f);
    trimOffset.setDuration(1333L);
    trimOffset.setInterpolator(LINEAR_INTERPOLATOR);
    trimOffset.setRepeatCount(Animation.INFINITE);

    ObjectAnimator trimRotation = ObjectAnimator.ofFloat(this, "trimRotation", 0.0f, 720.0f);
    trimRotation.setDuration(6665L);
    trimRotation.setInterpolator(LINEAR_INTERPOLATOR);
    trimRotation.setRepeatCount(Animation.INFINITE);

    mAnimators.add(trimStart);
    mAnimators.add(trimEnd);
    mAnimators.add(trimOffset);
    mAnimators.add(trimRotation);
}