Android animation to compress and gradually reduce viewing

I can make a fade away. But not compression. I want him to look like he went far far.

I need an animation like the one used at www.screamintothevoid.com

+4
source share
2 answers

This should work the way you want it.

animation.xml in / res / anim

 <set xmlns:android="http://schemas.android.com/apk/res/android">
        <scale xmlns:android="http://schemas.android.com/apk/res/android"
            android:fromXScale="1"
            android:toXScale="0"
            android:fromYScale="1"
            android:toYScale="0"
            android:duration="5000"
            android:pivotX="50%"
            android:pivotY="50%" >
        </scale>

        <alpha
            android:fromAlpha="1"
            android:toAlpha="0"
            android:duration="5000" >
        </alpha>
    </set>

to call this animation:

TextView textView = (TextView) findViewById(R.id.text_view);
Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.animation);
textView.startAnimation(animation);
+5
source

To reduce the image, change its scale values, for example:

TextView textToShrink = (TextView) findViewById(R.id.text_to_shrink);
textToShrink.animate().scaleX(0.3f).scaleY(0.3f).setDuration(600).start();
+3
source

Source: https://habr.com/ru/post/1610575/


All Articles