AnimationSet plays in reverse order

I use AnimationSet to do a lot of translation translations. In this example, I want to move the ImageView from 0 to 700 (off screen) and -700 to 0 (the view is moved to the far right and re-entered from the far left). I am using this code:

    AnimationSet set = new AnimationSet(true);
    set.setInterpolator(new AccelerateDecelerateInterpolator());
    set.setFillEnabled(true);
    if(traject!=null){
        TranslateAnimation tmpAnim = null;
        set.setDuration(duration);
        int d = traject.size()!=0 ? duration/traject.size() : duration;

        for(int i =0; i<traject.size();i++){
            tmpAnim = new TranslateAnimation( traject.get(i).getStartX(),
                                            traject.get(i).getEndX(),
                                            traject.get(i).getStartY(),
                                            traject.get(i).getEndY() );
            tmpAnim.setDuration(d);
            tmpAnim.setFillAfter(true);
            tmpAnim.setStartOffset(d*i);
            set.addAnimation(tmpAnim);
        }
    }

      

  • traject is an arraylist holding each of the start and end points of the TranslateAnimation.

But in my test case the animation goes from -700 to 700. I tried to switch the order of TranslateAnimations using setStartTime () instead of setStartOffset (), skipping the call to setStartOffset (), the result is the same. Do you have an idea what I'm missing?

+3
android animation android-animation


source to share


No one has answered this question yet

Check out similar questions:

703
How can I avoid reverse engineering my APK file?
2
Android View position not updating after transforming ObjectAnimator
2
TranslateAnimation on ImageView (Android)
2
change location of clickable image with animation - android
0
Android Animation: How to set layout coordinates of ImageView in translated ImagiveView after translation
0
Android: make imageView clickable on animation
0
How to avoid flickering in Android broadcast animation?
0
How to set the offset of an ImageView between animation and its repetition in TranslateAnimation
0
How to save the new position after the animation ends?
0
Android AnimationSet Sequence behaves differently depending on who I add first



All Articles
Loading...
X
Show
Funny
Dev
Pics