9

I am trying to create a transition animation in an Android application to change between two layouts. I've tried to search about animation transition, but only fade transition, slide transition, bounce, etc. I can't find one for wipe transition like transition at power point.

enter image description here

gram
  • 2,772
  • 20
  • 24
user3410051
  • 111
  • 2
  • 5
  • Read about AnimationSet. It will solve your problem by merging two animations. – rahultheOne Mar 14 '14 at 11:43
  • Thank you,There are websites that discuss whether the animationset about its attributes and examples of animation? Maybe i can learn to merging animation – user3410051 Mar 14 '14 at 12:14
  • Use this link in power point its call wipe in android its call scale animation http://stackoverflow.com/questions/7414065/android-scale-animation-on-view – Ammar ali Mar 14 '14 at 12:18
  • I dont think so scale animation can solve my problem. I dont want scaling old layout or new layout. Or maybe there are any technique for using scale animation to solve my problem? – user3410051 Mar 14 '14 at 13:32
  • Anyone know of transition libraries that for example can do this with an adjustable degree of blurred border in the transition instead of the sharp edge wipe ? This is stuff that have existed for ages in video editors so I guess the algorithms are well known. – Gunnar Forsgren - Mobimation Jan 06 '16 at 15:07

3 Answers3

2

in your activity execute the animation with the following:

This will do a top to bottom to top animation that you can easily manipulate to be horizontal. startActivityForResult(i,ACTIVITY_SLIDE);
overridePendingTransition(R.anim.bottom_in, R.anim.top_out);

top_out.xml, bottom_in.xml below... need to be separate files of course

<?xml version="1.0" encoding="utf-8"?>
    <set xmlns:android="http://schemas.android.com/apk/res/android"
        android:interpolator="@android:anim/linear_interpolator">
        <translate
            android:fromYDelta="100%p"
            android:toYDelta="0"
            android:duration="3000"/>
    </set>




<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@android:anim/linear_interpolator">
    <translate
        android:fromYDelta="0"
        android:toYDelta="-100%p"
        android:duration="3000"/>
</set>
user2658370
  • 259
  • 2
  • 4
1

Use ClipBound Property of view

Rect localRect = view.getVisibileRect();// or you can assign any required rectangle.

Rect rectFrom,rectTo;

Rect rectFrom = new Rect(localRect),rectTo = new Rect(localRect);

now adjust your both starting and ending rectangle according to requirement.

Animator animator = ObjectAnimator.ofObject(shape, "clipBounds", new RectEvaluator(), rectFrom, rectTo);

animator.start();
JAL
  • 41,701
  • 23
  • 172
  • 300
CodeWithVikas
  • 1,105
  • 9
  • 33
0
    <?xml version="1.0" encoding="utf-8"?>
    <set xmlns:android="http://schemas.android.com/apk/res/android">
        <translate
            android:duration="700"
            android:fromXDelta="90%"
            android:toXDelta="0" />
    </set>


<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <translate
        android:duration="700"
        android:fromXDelta="5"
        android:toXDelta="100%" />
</set>
NBM
  • 1