Reputation: 15740
AnimatorSet set = new AnimatorSet();
set.playTogether(
ObjectAnimator.ofFloat(mCard, "scaleX", 1f, 0f),
ObjectAnimator.ofFloat(mCard, "scaleY", 1f, 0f),
ObjectAnimator.ofFloat(mBackground, "alpha", 1f, 0f)
);
set.setDuration(2000l);
set.setInterpolator(new AccelerateDecelerateInterpolator()); //this isn't working
set.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
//Stuff here
}
});
set.start();
This seems pretty straightforward to me, I've used interpolators in the past and have not had trouble. However, with this AnimatorSet, if I comment out the setInterpolator
line the animation looks exactly the same. As you can see I slowed it down so I could make sure I wasn't just not noticing the effect, but it definitely isn't happening.
What am I doing wrong here?
Upvotes: 1
Views: 792
Reputation: 10550
I believe the default animation is AccelerateDecelerateInterpolator
. Looking at the Android sourcecode for Animate
, the constructor does this:
public Animation() {
ensureInterpolator();
}
protected void ensureInterpolator() {
if (mInterpolator == null) {
mInterpolator = new AccelerateDecelerateInterpolator();
}
}
Try using a different interpolator to make sure it's working.
Upvotes: 2