Cómo hacer una animación de crecer/reducir

I'm trying to make an image view to grow and reduce only on the x axis, yes, I want to deformate it. It is actually the shadow of a bouncing ball. I'm trying to achive it with the scale animation, but it translate. Anyone that can help? Here's the code of the animation that I'm using.

shadow.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_decelerate_interpolator" >
<scale
    android:duration="10000"
    android:fromXScale="1.1"
    android:fromYScale="1.0"    
    android:toXScale="0.1"
    android:toYScale="1.0" />

<alpha
    android:duration="10000"
    android:fromAlpha="1.0"
    android:toAlpha="0.0" />

</set>

preguntado el 08 de febrero de 14 a las 17:02

1 Respuestas

I tested your code out and here is what i found:

The code that you have provided initially scales the object in X axis to 1.1 directly(i.e without any animation).

Next, the object is scaled down in X axis to 0.1 while the alpha goes down. The scaling takes place about the upper left corner of the object(i.e the pivot is set to default).

If you want the scaling to happen about any other point,you can specify that as

     android:pivotX="x%"
     android:pivotY="y%"

Respondido 08 Feb 14, 18:02

android:pivotX="50%" android:pivotY="50%" This was the only thing that I missed, now it works fine. Thanks - Alejandro Cumpa

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.