Java Code Examples for android.view.animation.AnimationSet.setInterpolator()

The following are Jave code examples for showing how to use setInterpolator() of the android.view.animation.AnimationSet class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: QMUI_Android   File: QMUIBottomSheet.java   Source Code and License Vote up 6 votes
/**
 * BottomSheet升起动画
 */
private void animateUp() {
    if (mContentView == null) {
        return;
    }
    TranslateAnimation translate = new TranslateAnimation(
            Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f,
            Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0f
    );
    AlphaAnimation alpha = new AlphaAnimation(0, 1);
    AnimationSet set = new AnimationSet(true);
    set.addAnimation(translate);
    set.addAnimation(alpha);
    set.setInterpolator(new DecelerateInterpolator());
    set.setDuration(mAnimationDuration);
    set.setFillAfter(true);
    mContentView.startAnimation(set);
}
 
Example 2
Project: Pocket-Plays-for-Twitch   File: WelcomeActivity.java   Source Code and License Vote up 6 votes
private AnimationSet startShowContinueIconAnimations() {
	Animation mScaleAnimation = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
	Animation mRotateAnimation = new RotateAnimation(
				0, 360,
				Animation.RELATIVE_TO_SELF, 0.5f,
				Animation.RELATIVE_TO_SELF, 0.5f
	);
	mRotateAnimation.setRepeatCount(0);

	AnimationSet mAnimations = new AnimationSet(true);
	mAnimations.setDuration(REVEAL_ANIMATION_DURATION);
	mAnimations.setFillAfter(true);
	mAnimations.setInterpolator(new OvershootInterpolator(1.5f));
	mAnimations.addAnimation(mScaleAnimation);
	mAnimations.addAnimation(mRotateAnimation);

	mContinueIcon.startAnimation(mAnimations);
	return mAnimations;
}
 
Example 3
Project: qmui   File: QMUIBottomSheet.java   Source Code and License Vote up 6 votes
/**
 * BottomSheet升起动画
 */
private void animateUp() {
    if (mContentView == null) {
        return;
    }
    TranslateAnimation translate = new TranslateAnimation(
            Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f,
            Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0f
    );
    AlphaAnimation alpha = new AlphaAnimation(0, 1);
    AnimationSet set = new AnimationSet(true);
    set.addAnimation(translate);
    set.addAnimation(alpha);
    set.setInterpolator(new DecelerateInterpolator());
    set.setDuration(mAnimationDuration);
    set.setFillAfter(true);
    mContentView.startAnimation(set);
}
 
Example 4
Project: Pocket-Plays-for-Twitch   File: AnimationService.java   Source Code and License Vote up 6 votes
public static AnimationSet startAlphaHideAnimation(final View VIEW) {
	final int ANIMATION_DURATION = 350;

	final Animation mHideViewAnimation = new AlphaAnimation(1f, 0f);

	AnimationSet mAnimations = new AnimationSet(true);
	mAnimations.setDuration(ANIMATION_DURATION);
	mAnimations.setInterpolator(new AccelerateDecelerateInterpolator());
	mAnimations.addAnimation(mHideViewAnimation);
	mAnimations.setFillAfter(true);

       if(VIEW != null)
	    VIEW.startAnimation(mAnimations);

	return mAnimations;
}
 
Example 5
Project: Cable-Android   File: MicrophoneRecorderView.java   Source Code and License Vote up 5 votes
public void hide(float x) {
  this.lastPositionX = x;

  float offset          = getOffset(x);
  int   widthAdjustment = getWidthAdjustment();

  AnimationSet animation = new AnimationSet(false);
  Animation scaleAnimation = new ScaleAnimation(1, 0.5f, 1, 0.5f,
                                                Animation.RELATIVE_TO_SELF, 0.5f,
                                                Animation.RELATIVE_TO_SELF, 0.5f);

  Animation translateAnimation = new TranslateAnimation(Animation.ABSOLUTE, offset + widthAdjustment,
                                                        Animation.ABSOLUTE, widthAdjustment,
                                                        Animation.RELATIVE_TO_SELF, -.25f,
                                                        Animation.RELATIVE_TO_SELF, -.25f);

  scaleAnimation.setInterpolator(new AnticipateOvershootInterpolator(1.5f));
  translateAnimation.setInterpolator(new DecelerateInterpolator());
  animation.addAnimation(scaleAnimation);
  animation.addAnimation(translateAnimation);
  animation.setDuration(ANIMATION_DURATION);
  animation.setFillBefore(true);
  animation.setFillAfter(false);
  animation.setInterpolator(new AnticipateOvershootInterpolator(1.5f));

  recordButtonFab.setVisibility(View.GONE);
  recordButtonFab.clearAnimation();
  recordButtonFab.startAnimation(animation);
}
 
Example 6
Project: Cable-Android   File: AttachmentTypeSelector.java   Source Code and License Vote up 5 votes
private void animateButtonIn(View button, int delay) {
  AnimationSet animation = new AnimationSet(true);
  Animation scale = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f,
                                       Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.0f);

  animation.addAnimation(scale);
  animation.setInterpolator(new OvershootInterpolator(1));
  animation.setDuration(ANIMATION_DURATION);
  animation.setStartOffset(delay);
  button.startAnimation(animation);
}
 
Example 7
Project: UiLib   File: RayMenu.java   Source Code and License Vote up 5 votes
private static Animation createItemDisapperAnimation(final long duration, final boolean isClicked) {
	AnimationSet animationSet = new AnimationSet(true);
	animationSet.addAnimation(new ScaleAnimation(1.0f, isClicked ? 2.0f : 0.0f, 1.0f, isClicked ? 2.0f : 0.0f,
			Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f));
	animationSet.addAnimation(new AlphaAnimation(1.0f, 0.0f));

	animationSet.setDuration(duration);
	animationSet.setInterpolator(new DecelerateInterpolator());
	animationSet.setFillAfter(true);

	return animationSet;
}
 
Example 8
Project: AnimatedPullToRefresh-master   File: AnimationHelper.java   Source Code and License Vote up 5 votes
private void addTextFadeAnimations(AnimationSet set) {
    AlphaAnimation mFadeInAnim = new AlphaAnimation(1, FADE_MOUNT);
    mFadeInAnim.setDuration(CHARACTER_ANIM_DURATION);
    set.addAnimation(mFadeInAnim);
    AlphaAnimation mFadeOutAnim = new AlphaAnimation(FADE_MOUNT, 1);
    mFadeOutAnim.setDuration(CHARACTER_ANIM_DURATION);
    mFadeOutAnim.setStartOffset(CHARACTER_ANIM_DURATION + 20);
    mFadeOutAnim.setFillAfter(true);
    set.addAnimation(mFadeOutAnim);
    set.setInterpolator(interpolator);
}
 
Example 9
Project: AnimatedPullToRefresh-master   File: AnimationHelper.java   Source Code and License Vote up 5 votes
private void addLoopFadeAnimations(long duration, AnimationSet set) {
    AlphaAnimation mFadeInAnim = new AlphaAnimation(1, FADE_MOUNT);
    mFadeInAnim.setDuration(duration);
    set.addAnimation(mFadeInAnim);
    AlphaAnimation mFadeOutAnim = new AlphaAnimation(FADE_MOUNT, 1);
    mFadeOutAnim.setDuration(duration);
    mFadeOutAnim.setStartOffset(duration + 50);
    set.addAnimation(mFadeOutAnim);
    set.setInterpolator(interpolator);
}
 
Example 10
Project: Hitalk   File: MessageMenuPopup.java   Source Code and License Vote up 5 votes
@Override
protected Animation getShowAnimation() {
    AnimationSet set=new AnimationSet(true);
    set.setInterpolator(new DecelerateInterpolator());
    set.addAnimation(getScaleAnimation(0,1,0,1,Animation.RELATIVE_TO_SELF,1,Animation.RELATIVE_TO_SELF,0));
    set.addAnimation(getDefaultAlphaAnimation());
    return set;
}
 
Example 11
Project: Hitalk   File: AddressMenuPopup.java   Source Code and License Vote up 5 votes
@Override
protected Animation getShowAnimation() {
    AnimationSet set=new AnimationSet(true);
    set.setInterpolator(new DecelerateInterpolator());
    set.addAnimation(getScaleAnimation(0,1,0,1,Animation.RELATIVE_TO_SELF,1,Animation.RELATIVE_TO_SELF,0));
    set.addAnimation(getDefaultAlphaAnimation());
    return set;
}
 
Example 12
Project: Bigbang   File: ArcMenu.java   Source Code and License Vote up 5 votes
private static Animation createItemDisapperAnimation(final long duration, final boolean isClicked) {
    AnimationSet animationSet = new AnimationSet(true);
    animationSet.addAnimation(new ScaleAnimation(1.0f, isClicked ? 2.0f : 0.0f, 1.0f, isClicked ? 2.0f : 0.0f,
            Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f));
    animationSet.addAnimation(new AlphaAnimation(1.0f, 0.0f));

    animationSet.setDuration(duration);
    animationSet.setInterpolator(new DecelerateInterpolator());
    animationSet.setFillAfter(true);

    return animationSet;
}
 
Example 13
Project: stateLayout   File: FadeScaleViewAnimProvider.java   Source Code and License Vote up 5 votes
public Animation showAnimation() {
    AnimationSet set = new AnimationSet(true);
    Animation alphaAnimation = new AlphaAnimation(0.0f, 1.0f);
    Animation scaleAnimation = new ScaleAnimation(0.1f, 1f, 0.1f, 1f, Animation.RELATIVE_TO_SELF,
            0.5f, Animation.RELATIVE_TO_SELF, 0.5f);

    set.setDuration(200);
    set.setInterpolator(new DecelerateInterpolator());
    set.addAnimation(alphaAnimation);
    set.addAnimation(scaleAnimation);
    return set;
}
 
Example 14
Project: stateLayout   File: FadeScaleViewAnimProvider.java   Source Code and License Vote up 5 votes
@Override
public Animation hideAnimation() {
    AnimationSet set = new AnimationSet(true);
    Animation alphaAnimation = new AlphaAnimation(1.0f, 0.0f);
    Animation scaleAnimation = new ScaleAnimation(1.0f, 0.1f, 1.0f, 0.1f, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);

    set.setDuration(200);
    set.setInterpolator(new DecelerateInterpolator());
    set.addAnimation(alphaAnimation);
    set.addAnimation(scaleAnimation);
    return set;
}
 
Example 15
Project: Pocket-Plays-for-Twitch   File: AnimationService.java   Source Code and License Vote up 5 votes
public static AnimationSet startAlphaHideAnimation(final int DELAY, final View VIEW, boolean includeTransition) {
	final int ANIMATION_DURATION = 300;
	if(VIEW == null)
		return null;

	final Animation mAlphaAnimation = new AlphaAnimation(1f, 0f);
	mAlphaAnimation.setDuration(ANIMATION_DURATION);
	mAlphaAnimation.setFillAfter(true);

	final AnimationSet mHideAnimations = new AnimationSet(true);
	mHideAnimations.setInterpolator(new AccelerateDecelerateInterpolator());
	mHideAnimations.setFillAfter(true);
	mHideAnimations.addAnimation(mAlphaAnimation);

	if (includeTransition) {
		final Animation mTransitionAnimation = new TranslateAnimation(0, 0, 0, VIEW.getHeight()/2);
		mTransitionAnimation.setDuration(ANIMATION_DURATION);
		mTransitionAnimation.setFillAfter(false);

		mHideAnimations.addAnimation(mTransitionAnimation);
	}

	new Handler().postDelayed(new Runnable() {
		@Override
		public void run() {
			if(VIEW != null)
				VIEW.startAnimation(mHideAnimations);
		}
	}, DELAY);

	return mHideAnimations;
}
 
Example 16
Project: FLFloatingButton   File: ArcMenu.java   Source Code and License Vote up 5 votes
private static Animation createItemDisapperAnimation(final long duration, final boolean isClicked) {
    AnimationSet animationSet = new AnimationSet(true);
    animationSet.addAnimation(new ScaleAnimation(1.0f, isClicked ? 2.0f : 0.0f, 1.0f, isClicked ? 2.0f : 0.0f,
            Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f));
    animationSet.addAnimation(new AlphaAnimation(1.0f, 0.0f));

    animationSet.setDuration(duration);
    animationSet.setInterpolator(new DecelerateInterpolator());
    animationSet.setFillAfter(true);

    return animationSet;
}
 
Example 17
Project: SlidingPanel   File: SlidingPanelAnimator.java   Source Code and License Vote up 4 votes
/**
 * Sets interpolator to AnimationSet object.
 *
 * @param interpolator - string value, responsible for setting concrete interpolator to AnimationSet object.
 * @return AnimationSet object with applied interpolator.
 */
private AnimationSet setInterpolator(String interpolator) {
    AnimationSet animationSet = new AnimationSet(true);

    switch (interpolator) {
        case "decelerate":
            animationSet.setInterpolator(new DecelerateInterpolator(1.0f));
            break;

        case "accelerate":
            animationSet.setInterpolator(new AccelerateInterpolator(1.0f));
            break;

        case "accelerateDecelerate":
            animationSet.setInterpolator(new AccelerateDecelerateInterpolator());
            break;

        case "anticipate":
            animationSet.setInterpolator(new AnticipateInterpolator(1.0f));
            break;

        case "anticipateOvershoot":
            animationSet.setInterpolator(new AnticipateOvershootInterpolator(1.0f));
            break;

        case "bounce":
            animationSet.setInterpolator(new BounceInterpolator());
            break;

        case "cycle":
            animationSet.setInterpolator(new CycleInterpolator(1.0f));
            break;

        case "overshoot":
            animationSet.setInterpolator(new OvershootInterpolator(1.0f));
            break;

        default:
            animationSet.setInterpolator(new LinearInterpolator());
            break;
    }

    return animationSet;
}
 
Example 18
Project: PeSanKita-android   File: AttachmentTypeSelector.java   Source Code and License Vote up 4 votes
private void animateButtonIn(View button, int delay) {
  AnimationSet animation = new AnimationSet(true);
  Animation scale = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f,
                                       Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.0f);

  animation.addAnimation(scale);
  animation.setInterpolator(new OvershootInterpolator(1));
  animation.setDuration(ANIMATION_DURATION);
  animation.setStartOffset(delay);
  button.startAnimation(animation);
}
 
Example 19
Project: AnimatedPullToRefresh-master   File: AnimationHelper.java   Source Code and License Vote up 4 votes
private void addTextZoomAnimations(AnimationSet set) {
    ScaleAnimation mScaleAnim = new ScaleAnimation(1, SCALE_AMOUNT, 1f, SCALE_AMOUNT, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    mScaleAnim.setDuration(CHARACTER_ANIM_DURATION);
    set.addAnimation(mScaleAnim);
    ScaleAnimation mScaleDownAnim = new ScaleAnimation(1, SCALE_AMOUNT, 1f, SCALE_AMOUNT, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    mScaleDownAnim.setDuration(CHARACTER_ANIM_DURATION);
    mScaleDownAnim.setStartOffset(CHARACTER_ANIM_DURATION + 20);
    mScaleDownAnim.setFillAfter(true);
    set.addAnimation(mScaleDownAnim);
    set.setInterpolator(interpolator);
}
 
Example 20
Project: AnimatedPullToRefresh-master   File: AnimationHelper.java   Source Code and License Vote up 4 votes
private void addLoopScaleAnimations(long duration, AnimationSet set) {
    ScaleAnimation mScaleAnim = new ScaleAnimation(1, SCALE_AMOUNT, 1f, SCALE_AMOUNT, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    mScaleAnim.setDuration(duration);
    set.addAnimation(mScaleAnim);
    ScaleAnimation mScaleDownAnim = new ScaleAnimation(SCALE_AMOUNT, 1, SCALE_AMOUNT, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    mScaleDownAnim.setDuration(duration);
    mScaleDownAnim.setStartOffset(duration + 50);
    set.addAnimation(mScaleDownAnim);
    set.setInterpolator(interpolator);
}