use of com.dk.animation.effect.BaseItemAnimator in project RecyclerViewAnimator by dkmeteor.
the class StandUpIn method startAnimation.
@Override
public void startAnimation(final ViewHolder holder, long duration, final BaseItemAnimator animator) {
System.out.println("startAnimation");
float x = (holder.itemView.getWidth() - holder.itemView.getPaddingLeft() - holder.itemView.getPaddingRight()) / 2 + holder.itemView.getPaddingLeft();
float y = holder.itemView.getHeight() - holder.itemView.getPaddingBottom();
AnimatorSet set = new AnimatorSet();
set.playTogether(ObjectAnimator.ofFloat(holder.itemView, "pivotX", x, x, x, x, x), ObjectAnimator.ofFloat(holder.itemView, "pivotY", y, y, y, y, y), ObjectAnimator.ofFloat(holder.itemView, "rotationX", 90, 55, -30, 15, -15, 0));
set.addListener(new AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
// TODO Auto-generated method stub
}
@Override
public void onAnimationRepeat(Animator animation) {
// TODO Auto-generated method stub
}
@Override
public void onAnimationEnd(Animator animation) {
animator.dispatchAddFinished(holder);
animator.mAddAnimations.remove(holder);
animator.dispatchFinishedWhenDone();
}
@Override
public void onAnimationCancel(Animator animation) {
// TODO Auto-generated method stub
}
});
set.setStartDelay(mDelay * mDelayCount);
set.setDuration(animator.getAddDuration());
set.start();
animator.mAddAnimations.add(holder);
}
use of com.dk.animation.effect.BaseItemAnimator in project RecyclerViewAnimator by dkmeteor.
the class DropOut method startAnimation.
@Override
public void startAnimation(final ViewHolder holder, long duration, final BaseItemAnimator animator) {
ViewCompat.animate(holder.itemView).cancel();
AnimatorSet set = new AnimatorSet();
int abs = Math.random() > 0.5 ? -1 : 1;
ObjectAnimator objectAnimatorAnimatorR = ObjectAnimator.ofFloat(holder.itemView, "rotation", abs * 30, abs * 90);
ObjectAnimator objectAnimatorAnimatorT = ObjectAnimator.ofFloat(holder.itemView, "translationY", 0, ViewUtils.getScreenHeight());
set.addListener(new AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
animator.dispatchAddFinished(holder);
animator.mAddAnimations.remove(holder);
animator.dispatchFinishedWhenDone();
}
@Override
public void onAnimationCancel(Animator animation) {
}
});
set.playTogether(objectAnimatorAnimatorR, objectAnimatorAnimatorT);
set.setStartDelay(mDelay * mDelayCount);
set.setDuration(animator.getAddDuration());
set.start();
animator.mAddAnimations.add(holder);
}
use of com.dk.animation.effect.BaseItemAnimator in project RecyclerViewAnimator by dkmeteor.
the class FlipHorizonIn method startAnimation.
@Override
public void startAnimation(final ViewHolder holder, long duration, final BaseItemAnimator animator) {
ViewCompat.animate(holder.itemView).cancel();
AnimatorSet set = new AnimatorSet();
set.playTogether(ObjectAnimator.ofFloat(holder.itemView, "rotationY", 90, -15, 15, 0), ObjectAnimator.ofFloat(holder.itemView, "alpha", 0.25f, 0.5f, 0.75f, 1));
set.addListener(new AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
// TODO Auto-generated method stub
}
@Override
public void onAnimationRepeat(Animator animation) {
// TODO Auto-generated method stub
}
@Override
public void onAnimationEnd(Animator animation) {
animator.dispatchAddFinished(holder);
animator.mAddAnimations.remove(holder);
animator.dispatchFinishedWhenDone();
}
@Override
public void onAnimationCancel(Animator animation) {
// TODO Auto-generated method stub
}
});
set.setStartDelay(mDelay * mDelayCount);
set.setDuration(animator.getAddDuration());
set.start();
animator.mAddAnimations.add(holder);
}
use of com.dk.animation.effect.BaseItemAnimator in project RecyclerViewAnimator by dkmeteor.
the class HingeOut method startAnimation.
@Override
public void startAnimation(final ViewHolder holder, long duration, final BaseItemAnimator animator) {
ViewCompat.animate(holder.itemView).cancel();
AnimatorSet set = new AnimatorSet();
View target = holder.itemView;
int abs = Math.random() > 0.5 ? -1 : 1;
float x, y;
if (abs > 0) {
x = target.getPaddingLeft();
y = target.getPaddingTop();
} else {
x = target.getWidth();
y = target.getPaddingTop();
}
set.setDuration(animator.getRemoveDuration());
set.addListener(new AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
animator.dispatchAddFinished(holder);
animator.mAddAnimations.remove(holder);
animator.dispatchFinishedWhenDone();
}
@Override
public void onAnimationCancel(Animator animation) {
}
});
set.playTogether(ObjectAnimator.ofFloat(target, "rotation", 0, abs * 80, abs * 60, abs * 80, abs * 60, abs * 60), ObjectAnimator.ofFloat(target, "translationY", 0, 0, 0, 0, 0, 700), ObjectAnimator.ofFloat(target, "alpha", 1, 1, 1, 1, 1, 0), ObjectAnimator.ofFloat(target, "pivotX", x, x, x, x, x, x), ObjectAnimator.ofFloat(target, "pivotY", y, y, y, y, y, y));
set.setStartDelay(mDelay * mDelayCount);
set.setDuration(animator.getAddDuration());
set.start();
animator.mAddAnimations.add(holder);
}
use of com.dk.animation.effect.BaseItemAnimator in project RecyclerViewAnimator by dkmeteor.
the class FlipVertialIn method startAnimation.
@Override
public void startAnimation(final ViewHolder holder, long duration, final BaseItemAnimator animator) {
ViewCompat.animate(holder.itemView).cancel();
AnimatorSet set = new AnimatorSet();
set.playTogether(ObjectAnimator.ofFloat(holder.itemView, "rotationX", 90, -15, 15, 0), ObjectAnimator.ofFloat(holder.itemView, "alpha", 0.25f, 0.5f, 0.75f, 1));
set.addListener(new AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
// TODO Auto-generated method stub
}
@Override
public void onAnimationRepeat(Animator animation) {
// TODO Auto-generated method stub
}
@Override
public void onAnimationEnd(Animator animation) {
animator.dispatchAddFinished(holder);
animator.mAddAnimations.remove(holder);
animator.dispatchFinishedWhenDone();
}
@Override
public void onAnimationCancel(Animator animation) {
// TODO Auto-generated method stub
}
});
set.setStartDelay(mDelay * mDelayCount);
set.setDuration(animator.getAddDuration());
set.start();
animator.mAddAnimations.add(holder);
}
Aggregations