Hi, I need a bit of help understanding the animation repeat behavior.

In the following code, the intention is for the first animation to
run, then the second, then this sequence to repeat indefinitely.
Instead, both animations run once and then it stops. What am I doing
wrong?

        AnimationSet rootSet = new AnimationSet(true);
        rootSet.setInterpolator(new AccelerateInterpolator());


                       ScaleAnimation scale = new ScaleAnimation(
                               1, 1, 1, -1, // From x, to x, from y, to y
                               ScaleAnimation.RELATIVE_TO_SELF, 0.5f,
                               ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
                               scale.setDuration(1600);
                               scale.setFillAfter(true);

                        ScaleAnimation scale2 = new ScaleAnimation(
                                       1, 1, -1, 1, // From x, to x, from y, to
y
                                       ScaleAnimation.RELATIVE_TO_SELF, 0.5f,
                                       ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
                                        scale.setStartOffset(1600);
                                       scale.setDuration(1600);
                                       scale.setFillAfter(true);

                       AnimationSet childSet = new AnimationSet(true);
                       childSet.addAnimation(scale);
                       childSet.addAnimation(scale2);
                       childSet.setStartOffset(0);
                       childSet.setRepeatCount(Animation.INFINITE);
                       childSet.setRepeatMode(Animation.RESTART);
                      // childSet.addAnimation(rotate);

                       rootSet.addAnimation(childSet);


        ImageView b = (ImageView)findViewById(R.id.viewtoanimate);

        b.startAnimation(rootSet);

Thanks in advance, I know it's something obvious.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to