private void setAnimation(View viewToAnimate, int position) { { ViewHelper.setAlpha(viewToAnimate, .0f); com.nineoldandroids.view.ViewPropertyAnimator.animate(viewToAnimate).alpha(1).setDuration(250).start(); lastPosition = position; } }
private void slideUp(int startDelay){ mReAttached = false; ViewPropertyAnimator.animate(mView).setStartDelay(startDelay).alpha(0f) .translationY(-mView.getHeight() + mTranslationY) .setInterpolator(new AccelerateInterpolator()) .setDuration(300) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if(!mReAttached){ cleanup(); } } }) .start(); mVisible = false; } }
private void showInternal(){ mView.show(); ViewHelper.setTranslationX(mView, (mParentView.getWidth() - mView.getWidth()) / 2); ViewHelper.setAlpha(mView, 0f); ViewHelper.setTranslationY(mView, -mView.getHeight() + mTranslationY); //mView.setVisibility(View.VISIBLE); ViewPropertyAnimator.animate(mView).alpha(1f).translationY(25 + mTranslationY) .setInterpolator(new DecelerateInterpolator()) .setListener(null) .setDuration(300).setStartDelay(0).start(); mVisible = true; }
public void dismissCard(final View downView, final int position) { float viewWidth = downView.getMeasuredWidth(); ++mDismissAnimationRefCount; animate(downView) .translationX(viewWidth) .alpha(0) .setDuration(mAnimationTime) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { performDismiss(downView, position); } }); }
/** * Slide out a view to the right or left of the list. After the animation has finished, the * view will be dismissed by calling {@link #performDismiss(android.view.View, android.view.View, int)}. * * @param view The view, that should be slided out. * @param childView The whole view of the list item. * @param position The item position of the item. * @param toRightSide Whether it should slide out to the right side. */ private void slideOutView(final View view, final View childView, final int position, boolean toRightSide) { // Only start new animation, if this view isn't already animated (too fast swiping bug) synchronized(mAnimationLock) { if(mAnimatedViews.contains(view)) { return; } ++mDismissAnimationRefCount; mAnimatedViews.add(view); } ViewPropertyAnimator.animate(view) .translationX(toRightSide ? mViewWidth : -mViewWidth) .alpha(0) .setDuration(mAnimationTime) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { performDismiss(view, childView, position); } }); }
.alpha(alpha) .setDuration(animationTime) .setListener(new AnimatorListenerAdapter() {
public void onClickAnimar(View view) { animate(img).xBy(200).yBy(200).rotation(180).alpha(0.5F).setDuration(2000); } }
.alpha(1) .setDuration(mAnimationTime) .setListener(null);