K3NN3TH
K3NN3TH

Reputation: 1496

Animator equivilant to of applyTransformation in new Animation

I have some code that is using new Animation() it has a method applyTransformation that allows you to create a custom animation.

I've created a new Animator() but can not figure where to put the custom animation.

How do I create a custom animation using Animator?

Upvotes: 1

Views: 261

Answers (1)

AssemblyX
AssemblyX

Reputation: 1851

Try something like this:

    ValueAnimator anim = ValueAnimator.ofInt(0,100);
    anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        public void onAnimationUpdate(ValueAnimator animation) {
           Integer value = (Integer) animation.getAnimatedValue();
           Log.v(TAG, String.valueOf(value));
        }
    });
    anim.setDuration(500);
    anim.start();

Upvotes: 1

Related Questions