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

The following examples show how to use com.nineoldandroids.animation.AnimatorSet#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: ResideMenu.java    From Libraries-for-Android-Developers with MIT License 6 votes vote down vote up
/**
 * a helper method to build scale down animation;
 *
 * @param target
 * @param targetScaleX
 * @param targetScaleY
 * @return
 */
private AnimatorSet buildScaleDownAnimation(View target,float targetScaleX,float targetScaleY){

    // set the pivotX and pivotY to scale;
    int pivotX = (int) (getScreenWidth()  * 1.5);
    int pivotY = (int) (getScreenHeight() * 0.5);

    ViewHelper.setPivotX(target, pivotX);
    ViewHelper.setPivotY(target, pivotY);
    AnimatorSet scaleDown = new AnimatorSet();
    scaleDown.playTogether(
            ObjectAnimator.ofFloat(target, "scaleX", targetScaleX),
            ObjectAnimator.ofFloat(target, "scaleY", targetScaleY)
    );

    scaleDown.setInterpolator(AnimationUtils.loadInterpolator(activity,
            android.R.anim.decelerate_interpolator));
    scaleDown.setDuration(250);
    return scaleDown;
}
 
Example 2
Source File: ResideMenu.java    From Libraries-for-Android-Developers with MIT License 6 votes vote down vote up
/**
 *
 * @param menuItem
 * @param menu_index the position of the menu;
 * @return
 */
private void showMenuItem(ResideMenuItem menuItem,int menu_index){

    layout_menu.addView(menuItem);
    ViewHelper.setAlpha(menuItem, 0);
    AnimatorSet scaleUp = new AnimatorSet();
    scaleUp.playTogether(
            ObjectAnimator.ofFloat(menuItem, "translationX", -100.f, 0.0f),
            ObjectAnimator.ofFloat(menuItem, "alpha", 0.0f, 1.0f)
    );

    scaleUp.setInterpolator(AnimationUtils.loadInterpolator(activity,
            android.R.anim.anticipate_overshoot_interpolator));
    // with animation;
    scaleUp.setStartDelay(50 * menu_index);
    scaleUp.setDuration(400).start();
}
 
Example 3
Source File: SimpleAnimation.java    From Android-PullToNextLayout with Apache License 2.0 6 votes vote down vote up
public Animator getPullDownAnimIn(View view) {

        ObjectAnimator in = ObjectAnimator.ofFloat(view, "translationY", -view.getMeasuredHeight(), 0);

        ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 0.6f, 1);
        ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 0.6f, 1);

        AnimatorSet set = new AnimatorSet();
        set.setInterpolator(new DecelerateInterpolator());
        in.setDuration(ANIMATION_DURATION);
        scaleY.setDuration(ANIMATION_DURATION);
        scaleX.setDuration(ANIMATION_DURATION);
        set.setDuration(ANIMATION_DURATION);
        set.playTogether(scaleY, scaleX, in);


        return set;
    }
 
Example 4
Source File: SimpleAnimation.java    From Android-PullToNextLayout with Apache License 2.0 6 votes vote down vote up
private Animator getPullUpAnimIn(View view) {

        ObjectAnimator in =   ObjectAnimator.ofFloat(view, "translationY", view.getMeasuredHeight(), 0);
//        ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "rotationX", 20, 0);
        ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 0.6f, 1);
        ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 0.6f, 1f);
        AnimatorSet set = new AnimatorSet();
        set.setInterpolator(new DecelerateInterpolator());
        in.setDuration(ANIMATION_DURATION);
        scaleY.setDuration(ANIMATION_DURATION);
        scaleX.setDuration(ANIMATION_DURATION);
        set.setDuration(ANIMATION_DURATION);
        set.playTogether(scaleY, scaleX, in);


        return set;
    }
 
Example 5
Source File: ResideMenu.java    From AndroidResideMenu with MIT License 6 votes vote down vote up
/**
 * A helper method to build scale down animation;
 *
 * @param target
 * @param targetScaleX
 * @param targetScaleY
 * @return
 */
private AnimatorSet buildScaleDownAnimation(View target, float targetScaleX, float targetScaleY) {

    AnimatorSet scaleDown = new AnimatorSet();
    scaleDown.playTogether(
            ObjectAnimator.ofFloat(target, "scaleX", targetScaleX),
            ObjectAnimator.ofFloat(target, "scaleY", targetScaleY)
    );

    if (mUse3D) {
        int angle = scaleDirection == DIRECTION_LEFT ? -ROTATE_Y_ANGLE : ROTATE_Y_ANGLE;
        scaleDown.playTogether(ObjectAnimator.ofFloat(target, "rotationY", angle));
    }

    scaleDown.setInterpolator(AnimationUtils.loadInterpolator(activity,
            android.R.anim.decelerate_interpolator));
    scaleDown.setDuration(250);
    return scaleDown;
}
 
Example 6
Source File: DynamicFormActivity.java    From Android-Anim-Playground with MIT License 6 votes vote down vote up
private void slideInToTop(View editContainer, View movableView)
{
    View v = findViewById(R.id.edit_mode_container);

    //put edit at the bottom
    Log.d(TAG, "container view height :" + String.valueOf(v.getHeight()));

    ObjectAnimator anim = ObjectAnimator.ofFloat(v, "translationY", mMainContainer.getHeight());
    anim.setDuration(0);
    anim.start();

    v.setVisibility(View.VISIBLE);

    AnimatorSet set = new AnimatorSet();
    set.playTogether(
            ObjectAnimator.ofFloat(v, "translationY", editContainer.getTop()+movableView.getHeight()+modeContainerMargin),
            ObjectAnimator.ofFloat(v, "alpha", 0, 1)
    );
    set.setDuration(ANIMATION_DURATION);
    set.setInterpolator(ANIMATION_INTERPOLATOR);
    set.start();

}
 
Example 7
Source File: FragmentAnimationActivity.java    From Android-Anim-Playground with MIT License 6 votes vote down vote up
private void slideInToTop(View editContainer, View movableView, View v)
{
    Log.d(TAG, "container view height :" + String.valueOf(v.getHeight()));

    ObjectAnimator anim = ObjectAnimator.ofFloat(v, "translationY", mMainContainer.getHeight());
    anim.setDuration(0);
    anim.start();

    v.setVisibility(View.VISIBLE);

    AnimatorSet set = new AnimatorSet();
    set.playTogether(
            ObjectAnimator.ofFloat(v, "translationY", editContainer.getTop()+movableView.getHeight()),
            ObjectAnimator.ofFloat(v, "alpha", 0, 1)
    );
    set.setDuration(ANIMATION_DURATION);
    set.setInterpolator(ANIMATION_INTERPOLATOR);
    set.start();
}
 
Example 8
Source File: ResideMenu.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * a helper method to build scale down animation;
 * 
 * @param target
 * @param targetScaleX
 * @param targetScaleY
 * @return
 */
private AnimatorSet buildScaleDownAnimation(View target,
		float targetScaleX, float targetScaleY) {
	AnimatorSet scaleDown = new AnimatorSet();
	scaleDown.playTogether(
			ObjectAnimator.ofFloat(target, "scaleX", targetScaleX),
			ObjectAnimator.ofFloat(target, "scaleY", targetScaleY));

	scaleDown.setInterpolator(AnimationUtils.loadInterpolator(activity,
			android.R.anim.decelerate_interpolator));
	scaleDown.setDuration(130); // 250
	return scaleDown;
}
 
Example 9
Source File: DynamicFormActivity.java    From Android-Anim-Playground with MIT License 5 votes vote down vote up
private void slideInToBottom(View editContainer)
{
    View v = findViewById(R.id.edit_mode_container);

    AnimatorSet set = new AnimatorSet();
    set.playTogether(
            ObjectAnimator.ofFloat(v, "translationY", mMainContainer.getHeight()),
            ObjectAnimator.ofFloat(v, "alpha", 1, 0)
    );
    set.setDuration(ANIMATION_DURATION);
    set.setInterpolator(ANIMATION_INTERPOLATOR);
    set.start();
}
 
Example 10
Source File: FragmentAnimationActivity.java    From Android-Anim-Playground with MIT License 5 votes vote down vote up
private void slideInToBottom(View editContainer, View v)
{
    AnimatorSet set = new AnimatorSet();
    set.playTogether(
            ObjectAnimator.ofFloat(v, "translationY", mMainContainer.getHeight()),
            ObjectAnimator.ofFloat(v, "alpha", 1, 0)
    );
    set.setDuration(ANIMATION_DURATION);
    set.setInterpolator(ANIMATION_INTERPOLATOR);
    set.start();

}
 
Example 11
Source File: ResideMenu.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
/**
 * a helper method to build scale down animation;
 *
 * @param target
 * @param targetScaleX
 * @param targetScaleY
 * @return
 */
private AnimatorSet buildScaleDownAnimation(View target,float targetScaleX,float targetScaleY){

    AnimatorSet scaleDown = new AnimatorSet();
    scaleDown.playTogether(
            ObjectAnimator.ofFloat(target, "scaleX", targetScaleX),
            ObjectAnimator.ofFloat(target, "scaleY", targetScaleY)
    );

    scaleDown.setInterpolator(AnimationUtils.loadInterpolator(activity,
            android.R.anim.decelerate_interpolator));
    scaleDown.setDuration(250);
    return scaleDown;
}
 
Example 12
Source File: ResideMenu.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * a helper method to build scale down animation;
 *
 * @param target
 * @param targetScaleX
 * @param targetScaleY
 * @return
 */
private AnimatorSet buildScaleDownAnimation(View target,float targetScaleX,float targetScaleY){

    AnimatorSet scaleDown = new AnimatorSet();
    scaleDown.playTogether(
            ObjectAnimator.ofFloat(target, "scaleX", targetScaleX),
            ObjectAnimator.ofFloat(target, "scaleY", targetScaleY)
    );

    scaleDown.setInterpolator(AnimationUtils.loadInterpolator(activity,
            android.R.anim.decelerate_interpolator));
    scaleDown.setDuration(250);
    return scaleDown;
}
 
Example 13
Source File: MaterialCompoundButton.java    From MaterialRadioGroup with Apache License 2.0 5 votes vote down vote up
private void start() {
    if(canAnimate()){
        clearAnimation();
    }
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.play(ObjectAnimator.ofFloat(this, "scaleX", 1.0f));
    animatorSet.play(ObjectAnimator.ofFloat(this, "scaleY", 1.0f));
    animatorSet.setInterpolator(new OvershootInterpolator());
    animatorSet.setDuration(getDuration());
    animatorSet.start();
}
 
Example 14
Source File: ResideMenu.java    From light-novel-library_Wenku8_Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * a helper method to build scale down animation;
 * 
 * @param target
 * @param targetScaleX
 * @param targetScaleY
 * @return
 */
private AnimatorSet buildScaleDownAnimation(View target,
		float targetScaleX, float targetScaleY) {
	AnimatorSet scaleDown = new AnimatorSet();
	scaleDown.playTogether(
			ObjectAnimator.ofFloat(target, "scaleX", targetScaleX),
			ObjectAnimator.ofFloat(target, "scaleY", targetScaleY));

	scaleDown.setInterpolator(AnimationUtils.loadInterpolator(activity,
			android.R.anim.decelerate_interpolator));
	scaleDown.setDuration(130); // 250
	return scaleDown;
}
 
Example 15
Source File: SimpleAnimation.java    From Android-PullToNextLayout with Apache License 2.0 5 votes vote down vote up
@Override
public Animator getDeleteItemAnim(View showView, View dismissView) {

    Animator out = getDeleteItemDisMissAnimation(dismissView);

    Animator in =getDeleteItemShowAnimation(showView);
    AnimatorSet set = new AnimatorSet();
    set.setDuration(ANIMATION_DURATION);
    set.setInterpolator(new DecelerateInterpolator());
    set.playTogether(out, in);
    return set;
}
 
Example 16
Source File: SimpleAnimation.java    From Android-PullToNextLayout with Apache License 2.0 5 votes vote down vote up
public Animator getDeleteItemShowAnimation(View view) {
    ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 0.7f, 1);
    ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 0.7f, 1);
    AnimatorSet set = new AnimatorSet();
    set.setInterpolator(new DecelerateInterpolator());
    scaleY.setDuration(ANIMATION_DURATION);
    scaleX.setDuration(ANIMATION_DURATION);
    set.setDuration(ANIMATION_DURATION);
    set.playTogether(scaleY, scaleX);
    return set;
}
 
Example 17
Source File: SimpleAnimation.java    From Android-PullToNextLayout with Apache License 2.0 5 votes vote down vote up
public Animator getPullUpAnim(View showView, View dismissView) {

        Animator out = getPullUpAnimOut(dismissView);

        Animator in =getPullUpAnimIn(showView);
        AnimatorSet set = new AnimatorSet();
        set.setDuration(ANIMATION_DURATION);
        set.setInterpolator(new DecelerateInterpolator());
        set.playTogether(out, in);

        return set;
    }
 
Example 18
Source File: SimpleAnimation.java    From Android-PullToNextLayout with Apache License 2.0 5 votes vote down vote up
public Animator getPullDownAnim(View showView, View dismissView) {
    Animator out = getPullDownAnimOut(dismissView);
    Animator in = getPullDownAnimIn(showView);
    AnimatorSet set = new AnimatorSet();
    set.setInterpolator(new DecelerateInterpolator());
    set.setDuration(ANIMATION_DURATION);
    set.playTogether(out, in);
    return set;
}
 
Example 19
Source File: ResideMenu.java    From GifAssistant with Apache License 2.0 5 votes vote down vote up
/**
 * a helper method to build scale down animation;
 *
 * @param target
 * @param targetScaleX
 * @param targetScaleY
 * @return
 */
private AnimatorSet buildScaleDownAnimation(View target,float targetScaleX,float targetScaleY){

    AnimatorSet scaleDown = new AnimatorSet();
    scaleDown.playTogether(
            ObjectAnimator.ofFloat(target, "scaleX", targetScaleX),
            ObjectAnimator.ofFloat(target, "scaleY", targetScaleY)
    );

    scaleDown.setInterpolator(AnimationUtils.loadInterpolator(activity,
            android.R.anim.decelerate_interpolator));
    scaleDown.setDuration(250);
    return scaleDown;
}
 
Example 20
Source File: MaterialCompoundButton.java    From MaterialRadioGroup with Apache License 2.0 5 votes vote down vote up
private void end() {
    if(canAnimate()){
        clearAnimation();
    }
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.play(ObjectAnimator.ofFloat(this, "scaleX", 0.85f));
    animatorSet.play(ObjectAnimator.ofFloat(this, "scaleY", 0.85f));
    animatorSet.setInterpolator(new OvershootInterpolator());
    animatorSet.setDuration(getDuration());
    animatorSet.start();
}