Reputation: 739
I am creating an animation where I have 3 images that will animate across the screen. When the middle image reaches the middle of the screen it fades in.
Everything is working fine except that only when the first image hits the middle it is fading in, When the second and third image hit the middle they are not fading in.
Every image has its own View. and the fade in method is executed on all the same Views.
Please see below code. Let me know if you need any more info.
Here is the process that simulations the slides moving across the screen. moveThree is the fade in animation. moveOne and moveTwo are translations for the image on the screen.
public static int secondProcess(AnimationListener activity, View apa1,View apa2, View apa3,int animationmove)
{
Log.d("2", "SECOND PROCESS");
moveOne(activity, apa2);
moveTwo(activity,apa1);
animationmove = 3;
return animationmove;
}
public static int thirdProcess(AnimationListener activity, View apa1,View apa2,View apa3, int animationmove)
{
Log.d("3", "THIRD PROCESS");
moveThree(activity,apa1);
animationmove = 4;
return animationmove;
}
public static int fourthProcess(AnimationListener activity, View apa1, View apa2,View apa3,int animationmove)
{
Log.d("4", "FOURTH PROCESS");
moveOne(activity, apa3);
moveTwo(activity, apa2);
moveFour(activity,apa1);
animationmove = 5;
return animationmove;
}
public static int fifthProcess(AnimationListener activity, View apa1,View apa2,View apa3, int animationmove)
{
Log.d("5", "FIFTH PROCESS");
moveThree(activity,apa2);//IN THE SECOND VIEW HERE THE IMAGE IS NOT FADING
animationmove = 6;
return animationmove;
}
moveThree Method:
private static void moveThree(AnimationListener activity, View apa)
{
Log.v("MOVETHREE", "Started move3");
AnimationSet picMov3 = new AnimationSet(true);
picMov3.setAnimationListener(activity);
AlphaAnimation fadein = new AlphaAnimation((float) 0.3, 1);
fadein.setFillAfter(true);
fadein.setDuration(duration);
picMov3.addAnimation(fadein);
TranslateAnimation trans1 = new TranslateAnimation(-500, -500, 0, 0);
trans1.setDuration(duration);
picMov3.setFillAfter(true);
picMov3.setInterpolator(interpolator);
picMov3.addAnimation(trans1);
apa.startAnimation(picMov3);
}
Upvotes: 0
Views: 188
Reputation: 104178
You only call moveThree for the first View. You also need to call if for the other Views:
moveThree(activity,apa1);
moveThree(activity,apa2);
moveThree(activity,apa3);
Upvotes: 1