How to make smooth frame animation in android?

前端 未结 2 1290
一向
一向 2021-02-10 07:48

I made a frame animation. But the transitition between images is bad looking. How can I apply a crossfade effect to it ?

When using TransitionDrawable i get

2条回答
  •  无人及你
    2021-02-10 08:15

    If you want to crossfade between two pictures, why not use an AlphaAnimation which will alter the transparency of two views and will create the effect that you require.

    Create two animations:

    res/anim/fadeout.xml

    
    
    

    res/anim/fadein.xml

    
    
    

    and then override the default transition between activities:

    startActivity( new Intent( this, SecondActivity.class ) );
    overridePendingTransition( R.anim.fadeout, R.anim.fadein );
    

    or you can apply animations to specific widgets:

    Animation animation = AnimationUtils.loadAnimation( this, R.anim.fadeout );
    image1.startAnimation( animation );
    

    I am currently in the middle of a series on animation on my blog which may give you some further information.

提交回复
热议问题