Java Code Examples for com.nineoldandroids.animation.ObjectAnimator#setInterpolator()

The following examples show how to use com.nineoldandroids.animation.ObjectAnimator#setInterpolator() . 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: RippleBackground.java    From Mover with Apache License 2.0 6 votes vote down vote up
/**
 * Starts the enter animation.
 */
public void enter() {
    cancel();

    final int outerDuration = (int) (1000 * 1.0f / WAVE_OUTER_OPACITY_ENTER_VELOCITY);
    final ObjectAnimator outer = ObjectAnimator.ofFloat(this, "outerOpacity", 0, 1);
    outer.setAutoCancel(true);
    outer.setDuration(outerDuration);
    outer.setInterpolator(LINEAR_INTERPOLATOR);

    mAnimOuterOpacity = outer;

    // Enter animations always run on the UI thread, since it's unlikely
    // that anything interesting is happening until the user lifts their
    // finger.
    outer.start();
}
 
Example 2
Source File: AnimUtils.java    From PaymentKit-Droid with Apache License 2.0 6 votes vote down vote up
/**
 * @param shouldResetTextColor if true make sure you end the previous animation before starting this one.
 */
public static ObjectAnimator getShakeAnimation(final TextView textView, final boolean shouldResetTextColor) {
    final int textColor = textView.getCurrentTextColor();
    textView.setTextColor(Color.RED);

    ObjectAnimator shakeAnim = ObjectAnimator.ofFloat(textView, "translationX", -16);
    shakeAnim.setDuration(SHAKE_DURATION);
    shakeAnim.setInterpolator(new CycleInterpolator(2.0f));
    shakeAnim.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator anim) {
            if (shouldResetTextColor) {
                textView.setTextColor(textColor);
            }
        }
    });
    return shakeAnim;
}
 
Example 3
Source File: MemoFragment.java    From MaterialCalendar with Apache License 2.0 5 votes vote down vote up
void release() {
    ObjectAnimator objectAnimator = ObjectAnimator.ofInt(mBluePair, "bottom", mBluePair.getBottom(), startBluePairBottom);
    objectAnimator.addListener(new SimpleListener() {
        @Override
        public void onAnimationEnd(Animator animator) {
            disappearBluePair();
        }
    });
    objectAnimator.setInterpolator(ACCELERATE_DECELERATE);
    objectAnimator.start();
}
 
Example 4
Source File: ButtonFloat.java    From meiShi with Apache License 2.0 5 votes vote down vote up
public void hide(){
	
	ObjectAnimator animator = ObjectAnimator.ofFloat(ButtonFloat.this, "y", hidePosition);
	animator.setInterpolator(new BounceInterpolator());
	animator.setDuration(1500);
	animator.start();
	
	isShow = false;
}
 
Example 5
Source File: ButtonFloat.java    From meiShi with Apache License 2.0 5 votes vote down vote up
public void show(){
	ObjectAnimator animator = ObjectAnimator.ofFloat(ButtonFloat.this, "y", showPosition);
	animator.setInterpolator(new BounceInterpolator());
	animator.setDuration(1500);
	animator.start();
	isShow = true;
}
 
Example 6
Source File: ButtonFloat.java    From MaterialDesignLibrary with Apache License 2.0 5 votes vote down vote up
public void hide(){
	
	ObjectAnimator animator = ObjectAnimator.ofFloat(ButtonFloat.this, "y", hidePosition);
	animator.setInterpolator(new BounceInterpolator());
	animator.setDuration(1500);
	animator.start();
	
	isShow = false;
}
 
Example 7
Source File: ButtonFloat.java    From MoeGallery with GNU General Public License v3.0 5 votes vote down vote up
public void hide() {

        ObjectAnimator animator = ObjectAnimator.ofFloat(ButtonFloat.this, "y", hidePosition);
        animator.setInterpolator(new BounceInterpolator());
        animator.setDuration(1500);
        animator.start();

        isShow = false;
    }
 
Example 8
Source File: FilckerAnimationListView.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
protected ObjectAnimator animateY(final View view, final float oldY, final float newY,
		final float durationUnit) {
	final int duration = getDuration(oldY, newY, durationUnit);

	final ObjectAnimator anim = ObjectAnimator.ofFloat(AnimatorProxy.wrap(view),
			"translationY", oldY - newY, 0);

	final int finalDuration = Math
			.min(Math.max(duration, MIN_ANIM_DURATION), MAX_ANIM_DURATION);

	anim.setDuration((long) (finalDuration * animationDurationFactor));
	anim.setInterpolator(translateInterpolater);

	return anim;
}
 
Example 9
Source File: MenuRVAdapter.java    From AndroidSweetSheet with Apache License 2.0 5 votes vote down vote up
private void animation(MenuVH menuVH) {

        ViewHelper.setAlpha(menuVH.itemView, 0);

        ViewHelper.setTranslationY(menuVH.itemView, 300);
        ObjectAnimator translationY = ObjectAnimator.ofFloat(menuVH.itemView, "translationY", 500, 0);
        translationY.setDuration(300);
        translationY.setInterpolator(new OvershootInterpolator(1.6f));
        ObjectAnimator alphaIn = ObjectAnimator.ofFloat(menuVH.itemView, "alpha", 0, 1);
        alphaIn.setDuration(100);
        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.playTogether(translationY, alphaIn);
        animatorSet.setStartDelay(30 * menuVH.getAdapterPosition());
        animatorSet.start();
    }
 
Example 10
Source File: ButtonFloat.java    From PhoneTutorial with Apache License 2.0 5 votes vote down vote up
public void hide(){
	
	ObjectAnimator animator = ObjectAnimator.ofFloat(ButtonFloat.this, "y", hidePosition);
	animator.setInterpolator(new BounceInterpolator());
	animator.setDuration(1500);
	animator.start();
	
	isShow = false;
}
 
Example 11
Source File: MemoFragment.java    From MaterialCalendar with Apache License 2.0 5 votes vote down vote up
void upRed() {
    startRedX = ViewHelper.getX(mRed);
    startRedY = ViewHelper.getY(mRed);
    ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(mRed, "y", ViewHelper.getY(mRed),
            mBluePair.getBottom() - mRed.getHeight() / 2);
    objectAnimator.addListener(new SimpleListener() {
        @Override
        public void onAnimationEnd(Animator animation) {
            disappearRed();
        }
    });
    objectAnimator.setDuration(650);
    objectAnimator.setInterpolator(ACCELERATE_DECELERATE);
    objectAnimator.start();
}
 
Example 12
Source File: AnimUtil.java    From PullRefreshView with Apache License 2.0 5 votes vote down vote up
public static Animator startScale(final View view, float toScale, long duration, long startDelay, Interpolator setInterpolator) {
    ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(view, "scaleX", ViewHelper.getScaleX(view), toScale).setDuration(duration);
    objectAnimator.setStartDelay(startDelay);
    objectAnimator.setInterpolator(setInterpolator);
    objectAnimator.start();
    objectAnimator = ObjectAnimator.ofFloat(view, "scaleY", ViewHelper.getScaleY(view), toScale).setDuration(duration);
    objectAnimator.setStartDelay(startDelay);
    objectAnimator.setInterpolator(setInterpolator);
    objectAnimator.start();
    return objectAnimator;
}
 
Example 13
Source File: SwitchAnimationUtil.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
private void runAlphaAnimation(View view, long delay) {
	view.setAlpha(0);
	ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(view, "alpha",
			0, 1);
	objectAnimator.setStartDelay(delay);
	objectAnimator.setDuration(mDuration);
	objectAnimator.setInterpolator(new LinearInterpolator());
	objectAnimator.start();
}
 
Example 14
Source File: TreeView.java    From ThinkMap with Apache License 2.0 5 votes vote down vote up
public void looperBusiness(Integer item) {
    EaseCubicInterpolator easeCubicInterpolator = new EaseCubicInterpolator(0.39f, 0.13f, 0.33f, 1f);
    ObjectAnimator animator1;
    ObjectAnimator animator2;

    if (item == -1) {

        animator1 = ObjectAnimator.ofFloat(TreeView.this, "scaleX", getScaleX(), 0.3f)
                .setDuration(500);
        animator2 = ObjectAnimator.ofFloat(TreeView.this, "scaleY", getScaleX(), 0.3f)
                .setDuration(500);

    } else if (item == 0) {
        animator1 = ObjectAnimator.ofFloat(TreeView.this, "scaleX", getScaleX(), 1.0f)
                .setDuration(500);
        animator2 = ObjectAnimator.ofFloat(TreeView.this, "scaleY", getScaleX(), 1.0f)
                .setDuration(500);
    } else {
        animator1 = ObjectAnimator.ofFloat(TreeView.this, "scaleX", getScaleX(), 1.6f)
                .setDuration(500);
        animator2 = ObjectAnimator.ofFloat(TreeView.this, "scaleY", getScaleX(), 1.6f)
                .setDuration(500);
    }

    animator1.setInterpolator(easeCubicInterpolator);
    animator2.setInterpolator(easeCubicInterpolator);
    animator1.start();
    animator2.start();
}
 
Example 15
Source File: FlipAnimater.java    From JPTabBar with Apache License 2.0 5 votes vote down vote up
@Override
public void onSelectChanged(View v,boolean selected) {
    float end = selected?180f:0f;
    ObjectAnimator flipAnimator = ObjectAnimator.ofFloat(v,"rotationY",end);
    flipAnimator.setDuration(400);
    flipAnimator.setInterpolator(new DecelerateInterpolator());
    flipAnimator.start();
}
 
Example 16
Source File: JumpAnimater.java    From JPTabBar with Apache License 2.0 5 votes vote down vote up
@Override
public void onSelectChanged(View v, boolean selected) {
    int end = selected?-10:0;
    ObjectAnimator jumpAnimator = ObjectAnimator.ofFloat(v,"translationY",end);
    jumpAnimator.setDuration(300);
    jumpAnimator.setInterpolator(new AnticipateInterpolator());
    jumpAnimator.start();
}
 
Example 17
Source File: RotateAnimater.java    From JPTabBar with Apache License 2.0 5 votes vote down vote up
@Override
public void onSelectChanged(View v, boolean selected) {
    int end = selected ? 360 : 0;
    ObjectAnimator rotateAnimator = ObjectAnimator.ofFloat(v, "rotation",  end);
    rotateAnimator.setDuration(400);
    rotateAnimator.setInterpolator(new AnticipateInterpolator());
    rotateAnimator.start();
}
 
Example 18
Source File: FoldingLayoutActivity.java    From Folding-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Animates the folding view inwards (to a completely folded state) from its
 * current state and then back out to its original state.
 */
public void animateFold() {
	float foldFactor = mFoldLayout.getFoldFactor();

	ObjectAnimator animator = ObjectAnimator.ofFloat(mFoldLayout,
			"foldFactor", foldFactor, 1);
	animator.setRepeatMode(ValueAnimator.REVERSE);
	animator.setRepeatCount(1);
	animator.setDuration(FOLD_ANIMATION_DURATION);
	animator.setInterpolator(new AccelerateInterpolator());
	animator.start();
}
 
Example 19
Source File: OverflowGestureListener.java    From MaterialContentOverflow with Apache License 2.0 4 votes vote down vote up
public void slide(float position) {
    ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(overflow.get(), "translationY", position);
    objectAnimator.setInterpolator(new LinearOutSlowInInterpolator());
    objectAnimator.setDuration(1000);
    objectAnimator.start();
}
 
Example 20
Source File: CustomDelegate.java    From AndroidSweetSheet with Apache License 2.0 3 votes vote down vote up
private void alphaAnimation() {


        ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(getContentRelativeLayout(), "alpha", 0, 1);
        objectAnimator.setDuration(1200);
        objectAnimator.setInterpolator(new DecelerateInterpolator());
        objectAnimator.start();


    }