Refine search
private Animation inFromRightAnimation() { Animation inFromRight = new TranslateAnimation( Animation.RELATIVE_TO_PARENT, +1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f); inFromRight.setDuration(500); inFromRight.setInterpolator(new LinearInterpolator()); return inFromRight; }
private Animation outToLeftAnimation() { Animation outToLeft = new TranslateAnimation( Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, -1.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f); outToLeft.setDuration(500); outToLeft.setInterpolator(new LinearInterpolator()); return outToLeft; } }
Animation fadeIn = new AlphaAnimation(0, 1); fadeIn.setInterpolator(new DecelerateInterpolator()); //add this fadeIn.setDuration(1000); Animation fadeOut = new AlphaAnimation(1, 0); fadeOut.setInterpolator(new AccelerateInterpolator()); //and this fadeOut.setStartOffset(1000); fadeOut.setDuration(1000); AnimationSet animation = new AnimationSet(false); //change to false animation.addAnimation(fadeIn); animation.addAnimation(fadeOut); this.setAnimation(animation);
private void fadeOutAndHideImage(final ImageView img) { Animation fadeOut = new AlphaAnimation(1, 0); fadeOut.setInterpolator(new AccelerateInterpolator()); fadeOut.setDuration(1000); fadeOut.setAnimationListener(new AnimationListener() { public void onAnimationEnd(Animation animation) { img.setVisibility(View.GONE); } public void onAnimationRepeat(Animation animation) {} public void onAnimationStart(Animation animation) {} }); img.startAnimation(fadeOut); }
@Override public int onFinish(@NonNull RefreshLayout layout, boolean success) { final View thisView = this; thisView.clearAnimation(); if (success) { thisView.startAnimation(new Animation() {{ super.setDuration(100); super.setInterpolator(new AccelerateInterpolator()); } @Override protected void applyTransformation(float interpolatedTime, Transformation t) { if (interpolatedTime == 1) { isRefreshing = false; } mFinishTransformation = interpolatedTime; thisView.invalidate(); } }); return 200; } else { isRefreshing = false; return 0; } }
@Override public int onFinish(@NonNull RefreshLayout layout, boolean success) { mIsInLoading = false; mAniController.stop(); if (success && mEnableFadeAnimation) { final View thisView = this; thisView.startAnimation(new Animation() {{ super.setDuration(250); super.setInterpolator(new AccelerateInterpolator()); } @Override protected void applyTransformation(float interpolatedTime, Transformation t) { final View thisView = StoreHouseHeader.this; mProgress = (1 - interpolatedTime); thisView.invalidate(); if (interpolatedTime == 1) { for (int i = 0; i < mItemList.size(); i++) { mItemList.get(i).resetPosition(mHorizontalRandomness); } } } }); return 250; } else { for (int i = 0; i < mItemList.size(); i++) { mItemList.get(i).resetPosition(mHorizontalRandomness); } } return 0; }
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f); inFromRight.setDuration(500); inFromRight.setInterpolator(new AccelerateInterpolator()); return inFromRight; Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f); outtoLeft.setDuration(500); outtoLeft.setInterpolator(new AccelerateInterpolator()); return outtoLeft; Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f); inFromLeft.setDuration(500); inFromLeft.setInterpolator(new AccelerateInterpolator()); return inFromLeft; Animation.RELATIVE_TO_PARENT, 0.0f); outtoRight.setDuration(500); outtoRight.setInterpolator(new AccelerateInterpolator()); return outtoRight;
animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, +1.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f); animation.setInterpolator(new DecelerateInterpolator()); break; case SLIDE_OUT_TO_RIGHT: animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, +1.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f); animation.setInterpolator(new AccelerateInterpolator()); break; case SLIDE_IN_FROM_LEFT: animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f); animation.setInterpolator(new DecelerateInterpolator()); break; case SLIDE_OUT_TO_LEFT: animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f); animation.setInterpolator(new AccelerateInterpolator()); break; case SLIDE_IN_FROM_BOTTOM: animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, +1.0f, Animation.RELATIVE_TO_SELF, 0.0f); animation.setInterpolator(new DecelerateInterpolator()); break; case SLIDE_IN_FROM_TOP: animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f); animation.setInterpolator(new DecelerateInterpolator()); break;
private void setupAnimations() { mAnimation = new Animation() { @Override public void applyTransformation(float interpolatedTime, Transformation t) { setRotate(interpolatedTime); } }; mAnimation.setRepeatCount(Animation.INFINITE); mAnimation.setRepeatMode(Animation.RESTART); mAnimation.setInterpolator(LINEAR_INTERPOLATOR); mAnimation.setDuration(ANIMATION_DURATION); }
private void initAnimation() { mRotateAnimation = new RotateAnimation(0, -180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR); mRotateAnimation.setDuration(ANIMATION_DURATION); mRotateAnimation.setFillAfter(true); mResetRotateAnimation = new RotateAnimation(-180, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); mResetRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR); mResetRotateAnimation.setDuration(ANIMATION_DURATION); mResetRotateAnimation.setFillAfter(true); }
public void onCreate(Bundle savedInstanceState) { final Animation animation = new AlphaAnimation(1, 0); // Change alpha from fully visible to invisible animation.setDuration(500); // duration - half a second animation.setInterpolator(new LinearInterpolator()); // do not alter animation rate animation.setRepeatCount(Animation.INFINITE); // Repeat animation infinitely animation.setRepeatMode(Animation.REVERSE); // Reverse animation at the end so the button will fade back in final Button btn = (Button) findViewById(R.id.your_btn); btn.startAnimation(animation); btn.setOnClickListener(new OnClickListener() { @Override public void onClick(final View view) { view.clearAnimation(); } }); }
@Override public void dismiss() { if(!isShowing() || mDismissPending) return; if(mContentView != null){ mAnimation = new SlideAnimation(mContentView.getTop(), mContainer.getMeasuredHeight()); mAnimation.setDuration(mOutDuration); mAnimation.setInterpolator(mOutInterpolator); mAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { mDismissPending = true; } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { mDismissPending = false; mAnimation = null; mHandler.post(mDismissAction); } }); mContentView.startAnimation(mAnimation); } else mHandler.post(mDismissAction); }
fadeIn.setInterpolator(new DecelerateInterpolator()); // add this fadeIn.setDuration(fadeInDuration); fadeOut.setInterpolator(new AccelerateInterpolator()); // and this fadeOut.setStartOffset(fadeInDuration + timeBetween); fadeOut.setDuration(fadeOutDuration);
private void animateOffsetToCorrectPosition(int from, AnimationListener listener) { mFrom = from; mAnimateToCorrectPosition.reset(); mAnimateToCorrectPosition.setDuration(ANIMATE_TO_TRIGGER_DURATION); mAnimateToCorrectPosition.setInterpolator(mDecelerateInterpolator); if (listener != null) { mCircleView.setAnimationListener(listener); } mCircleView.clearAnimation(); mCircleView.startAnimation(mAnimateToCorrectPosition); }
private void animateOffsetToCorrectPosition(int from, AnimationListener listener) { mFrom = from; mAnimateToCorrectPosition.reset(); mAnimateToCorrectPosition.setDuration(ANIMATE_TO_TRIGGER_DURATION); mAnimateToCorrectPosition.setInterpolator(mDecelerateInterpolator); if (listener != null) { mHeadViewContainer.setAnimationListener(listener); } mHeadViewContainer.clearAnimation(); mHeadViewContainer.startAnimation(mAnimateToCorrectPosition); }
if (start != end) { mAnimation = new SlideAnimation(start, end); mAnimation.setDuration(mInDuration); mAnimation.setInterpolator(mInInterpolator); mAnimation.setAnimationListener(new Animation.AnimationListener() { @Override
animation.setInterpolator(easeInOutQuart); animation.setDuration(computeDurationFromHeight(view)); view.startAnimation(animation); a.setInterpolator(easeInOutQuart); a.setDuration(durationMillis);
private void animateOffsetToStartPosition(int from, AnimationListener listener) { if (mScale) { // Scale the item back down startScaleDownReturnToStartAnimation(from, listener); } else { mFrom = from; mAnimateToStartPosition.reset(); mAnimateToStartPosition.setDuration(ANIMATE_TO_START_DURATION); mAnimateToStartPosition.setInterpolator(mDecelerateInterpolator); if (listener != null) { mCircleView.setAnimationListener(listener); } mCircleView.clearAnimation(); mCircleView.startAnimation(mAnimateToStartPosition); } }
mAnimation.setRepeatCount(Animation.INFINITE); mAnimation.setRepeatMode(Animation.REVERSE); mAnimation.setInterpolator(ACCELERATE_DECELERATE_INTERPOLATOR); mAnimation.setDuration(ANIMATION_DURATION);
if(preset == null){ anim = new AlphaAnimation(0, 1); anim.setInterpolator(new DecelerateInterpolator()); anim.setDuration(FADE_DUR); }else{