Domanda

I need to make a scale driven animated dialog.. I want to do it with bounce effect i tried with bounce interpolater

<scale xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="500"
    android:fromXScale="0"
    android:fromYScale="0"
    android:interpolator="@android:anim/bounce_interpolator"
    android:toXScale="1"
    android:toYScale="1" />

I want to modify the bounce effect make it slower/faster and size to bounce to. i didnt find anything, T tried to make it with sets

<set >
    <scale
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:duration="500"
        android:fromXScale="0"
        android:fromYScale="0"
        android:toXScale="1"
        android:toYScale="1" />
    <scale
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:duration="100"
        android:fromXScale="1"
        android:fromYScale="1"
        android:startOffset="500"
        android:toXScale=".8"
        android:toYScale=".8" />
    <scale
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:duration="100"
        android:fromXScale=".8"
        android:fromYScale=".8"
        android:startOffset="600"
        android:toXScale="1"
        android:toYScale="1" />
</set>

the whole animation acts strangely? so my question is how to fix this animation by set Or how to modify the bounce_interpolator?

È stato utile?

Soluzione

Use ipfx.org to create custom interpolators.
Take the bounce example and edit to your needs.
http://ipfx.org/?p=7ffffffe575efffe9e02fffed8f6fffe&l=2f13c5ac138b3d6ad338a5a77a8386807d6e

Than use created interpolator in your app ()

import org.ipfx.Interpolator;

...
...

final org.ipfx.Interpolator interpolator = org.ipfx.Interpolator.parseUrl(urlData);

ObjectAnimator animator = ObjectAnimator.ofFloat(...);
animator.setDuration(1000);

animator.setInterpolator(new TimeInterpolator() {
    @Override
    public float getInterpolation(float input) {
        return interpolator.calc(input);
    }
});

animator.start();
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top