Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8948775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:04:56+00:00 2026-06-15T13:04:56+00:00

I have two animation with different duration like below: Anim 1: TranslateAnimation trans1 =

  • 0

I have two animation with different duration like below:
Anim 1:

    TranslateAnimation trans1 = new TranslateAnimation(0, 0, 0, 500);  
    trans1.setStartOffset(0);  
    trans1.setDuration(5000);  
    trans1.setFillAfter(true);  

Anim 2:

    TranslateAnimation trans2 = new TranslateAnimation(0, -100, -200, -200);  
    trans2.setDuration(200);  
    trans2.setRepeatCount(25);  
    trans2.setFillAfter(true);  

As you see these animation have different durations. I would like to animate Anim2 (duration 200) in loop 25 times during one time Anim1 (duration 5000) animation from Y: 0 to 500.

I’ve tried to do with AnimationSet and addAnimation but it doesn’t want to work.
Could You give me some tips how can I solve this problem?

My code:

AnimationSet rootSet = new AnimationSet(true);   
rootSet.setInterpolator(new AccelerateInterpolator());  
rootSet.setRepeatMode(Animation.INFINITE);  
rootSet.setRepeatCount(200);  
rootSet.setDuration(5000);  
rootSet.setFillAfter(true);  

    TranslateAnimation trans1 = new TranslateAnimation(0, 0, 0, 500);  
    trans1.setStartOffset(0);  
    trans1.setDuration(5000);  
    trans1.setFillAfter(true);  

rootSet.addAnimation(trans1);


AnimationSet rootSet2 = new AnimationSet(true);  
rootSet2.setInterpolator(new AccelerateInterpolator());  
rootSet2.setRepeatMode(Animation.INFINITE);  
rootSet2.setRepeatCount(200);  
rootSet2.setDuration(200);  

    TranslateAnimation trans2 = new TranslateAnimation(0, -100, -200, -200);  
    trans2.setDuration(200);
    trans2.setRepeatCount(25);
    trans2.setFillAfter(true);

rootSet2.addAnimation(trans2);  

rootSet.addAnimation(rootSet2);  

iv.startAnimation(rootSet);  

EDIT:
When I play only trans2 animation it repeats 25 times as I wanted (in horizontal way).
And additionally I would like this animation to animate (whole horizontal animation not only imageview) in vertical way (trans1).

I hope that this description will be clearer.

When I added these two animations in one AnimationSet the first animation doesnt work at all and imageview (not animationn) is translated linear to -200,500.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T13:04:57+00:00Added an answer on June 15, 2026 at 1:04 pm

    Now I see what you want to do. You probably are better of doing multiple animations – one for each “line”. Add an AnimationListener to know when the previous Animation ends (onAnimationEnd callback), jump down one line and go from right to left again.

    They all basically are the same, just the fromYDelta and toYDelta values would change for each Animation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to Animate two Different layouts. Example I already have the animation the
I have a small problem with UINavigationController animation between two view. My application build
I have two different versions of a javascript file: one works fine, the other
i m a beginner... i have added two different jQuery... one is pop up
Everybody.. How to set animation on button click ? I have two buttons, both
I have two different windows, one will to display streams on a image and
I have two animations for two layers, layer1 and layer2, each has different path.
I have two jquery animations running in two different elements. Both are triggered at
I have a sub navigation which is placed in two different places on different
I have a simple animation where I'm expanding a new view from the center

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.