AngelSara
AngelSara

Reputation: 161

Android Animation: change speed

I have implemented an animation in Android. This is the xml:

<?xml version="1.0" encoding="utf-8"?>
<set
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@android:anim/linear_interpolator"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillAfter="true">

    <translate
        android:fromXDelta="-4%p"
        android:toXDelta="4%p"
        android:repeatCount="2"
        android:repeatMode="reverse"
        android:duration="1000" />
</set>

But the speed of moving is a little slow. How can I increase speed?
I have tried also the accelerate_interpolator but it's too slow......

Thanks

PS: The movement that I want to do is like a cut of a knife. So I want to move it ahead and behind some times.

Upvotes: 1

Views: 1816

Answers (1)

santosh kumar
santosh kumar

Reputation: 2962

Decrease the duration you have result in front of you.

<?xml version="1.0" encoding="utf-8"?>
<set
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@android:anim/linear_interpolator"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillAfter="true">

    <translate
        android:fromXDelta="-4%p"
        android:toXDelta="4%p"
        android:repeatCount="2"
        android:repeatMode="reverse"
        android:duration="10" />
</set>

Upvotes: 2

Related Questions