use of android.view.animation.AccelerateInterpolator in project UltimateAndroid by cymcsg.
the class FilckerAnimationListView method animatePreLayout.
/**
* Animate items that are deleted entirely and items that move out of
* bounds.
*/
private void animatePreLayout(final float durationUnit, final Animator.AnimatorListener listener) {
final AnimatorSet animatorSet = new AnimatorSet();
final int firstVisiblePosition = getFirstVisiblePosition();
final int childCount = getChildCount();
for (final Iterator<Entry<Long, Float>> iter = yMap.entrySet().iterator(); iter.hasNext(); ) {
final Entry<Long, Float> entry = iter.next();
final long id = entry.getKey();
final int oldPos = positionMap.get(id);
final View child = getChildAt(oldPos - firstVisiblePosition);
final int newPos = getPositionForId(id);
// fade out items that disappear
if (newPos == -1) {
final ObjectAnimator anim = animateAlpha(child, false);
animatorSet.play(anim);
iter.remove();
positionMap.remove(id);
continue;
}
// translate items that move out of bounds
if (newPos < firstVisiblePosition || newPos > firstVisiblePosition + childCount) {
final float offset;
if (newPos < firstVisiblePosition) {
offset = -getHeight();
} else {
offset = getHeight();
}
final AnimatorProxy proxy = AnimatorProxy.wrap(child);
final ObjectAnimator anim = ObjectAnimator.ofFloat(proxy, "translationY", 0f, offset);
final int finalDuration = getDuration(0, getHeight() / 2, durationUnit);
anim.setInterpolator(new AccelerateInterpolator());
anim.setDuration((long) (finalDuration * animationDurationFactor));
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(final Animator animation) {
child.post(new Runnable() {
@Override
public void run() {
proxy.setTranslationY(0f);
}
});
}
});
animatorSet.play(anim);
iter.remove();
positionMap.remove(id);
continue;
}
}
if (!animatorSet.getChildAnimations().isEmpty()) {
animatorSet.addListener(listener);
animatorSet.start();
} else {
listener.onAnimationEnd(animatorSet);
}
}
use of android.view.animation.AccelerateInterpolator in project Swipecards by Diolor.
the class FlingCardListener method onSelected.
public void onSelected(final boolean isLeft, float exitY, long duration) {
isAnimationRunning = true;
float exitX;
if (isLeft) {
exitX = -objectW - getRotationWidthOffset();
} else {
exitX = parentWidth + getRotationWidthOffset();
}
this.frame.animate().setDuration(duration).setInterpolator(new AccelerateInterpolator()).x(exitX).y(exitY).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (isLeft) {
mFlingListener.onCardExited();
mFlingListener.leftExit(dataObject);
} else {
mFlingListener.onCardExited();
mFlingListener.rightExit(dataObject);
}
isAnimationRunning = false;
}
}).rotation(getExitRotation(isLeft));
}
use of android.view.animation.AccelerateInterpolator in project Android-Bootstrap by Bearded-Hen.
the class BootstrapAlert method setupAnimations.
private void setupAnimations() {
fadeInAnimation = new AlphaAnimation(0.0f, 1.0f);
fadeInAnimation.setDuration(300);
fadeInAnimation.setInterpolator(new AccelerateInterpolator());
fadeInAnimation.setAnimationListener(this);
fadeOutAnimation = new AlphaAnimation(1.0f, 0.0f);
fadeOutAnimation.setDuration(300);
fadeOutAnimation.setInterpolator(new AccelerateInterpolator());
fadeOutAnimation.setAnimationListener(this);
}
use of android.view.animation.AccelerateInterpolator in project TransitionHelper by ImmortalZ.
the class ColorShowMethod method translate.
@Override
public void translate(InfoBean bean, RenderView parent, View child) {
if (startColor != 0) {
startColor = parent.getResources().getColor(startColor);
} else {
startColor = parent.getResources().getColor(R.color.showmethod_start_color);
}
if (endColor != 0) {
endColor = parent.getResources().getColor(endColor);
} else {
endColor = parent.getResources().getColor(R.color.showmethod_end_color);
}
parent.setPaintColor(endColor);
ObjectAnimator colorAnimator = ObjectAnimator.ofInt(parent, "backgroundColor", startColor, endColor);
colorAnimator.setEvaluator(new ArgbEvaluator());
set.playTogether(ObjectAnimator.ofFloat(child, "translationX", 0, -bean.translationX), ObjectAnimator.ofFloat(child, "translationY", 0, -bean.translationY), ObjectAnimator.ofFloat(child, "scaleX", 1 / bean.scalling), ObjectAnimator.ofFloat(child, "scaleY", 1 / bean.scalling), colorAnimator);
set.setInterpolator(new AccelerateInterpolator());
set.setDuration(duration).start();
}
use of android.view.animation.AccelerateInterpolator in project TransitionHelper by ImmortalZ.
the class InflateShowMethod method translate.
@Override
public void translate(InfoBean bean, RenderView parent, View child) {
set.playTogether(ObjectAnimator.ofFloat(child, "translationX", 0, -bean.translationX), ObjectAnimator.ofFloat(child, "translationY", 0, -bean.translationY), ObjectAnimator.ofFloat(child, "scaleX", 1, 1 / bean.scalling), ObjectAnimator.ofFloat(child, "scaleY", 1, 1 / bean.scalling));
set.setInterpolator(new AccelerateInterpolator());
set.setDuration(duration).start();
}
Aggregations