Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do pivotX and pivotY mean in Android animations? [closed]

These two terms occur in many places but what exactly do they mean in the context of Android animations?

like image 214
srujan maddula Avatar asked Oct 23 '14 07:10

srujan maddula


People also ask

What is Tweened animation in Android?

Tween Animation takes some parameters such as start value , end value, size , time duration , rotation angle e.t.c and perform the required animation on that object. It can be applied to any type of object. So in order to use this , android has provided us a class called Animation.

What is fillAfter in Android?

android:fillAfterWhen set to true, the animation transformation is applied after the animation is over. The default value is false. If fillEnabled is not set to true and the animation is not set on a View, fillAfter is assumed to be true. May be a boolean value, such as " true " or " false ".

What is animate in Android Studio?

Animate between activities On Android 5.0 (API level 21) and higher, you can also create animations that transition between your activities. This is based on the same transition framework described above to animate layout changes, but it allows you to create animations between layouts in separate activities.


1 Answers

The pivotX and pivotY is the central point of the animation.
So for example if you want to do Zoom In animation you can use this

<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"     android:fillAfter="true" >      <scale         xmlns:android="http://schemas.android.com/apk/res/android"         android:duration="1000"         android:fromXScale="1"         android:fromYScale="1"         android:pivotX="50%"         android:pivotY="50%"         android:toXScale="3"         android:toYScale="3" >     </scale>  </set> 

and the android:pivotX="50%" and android:pivotY="50%" will mean the zoom will be started from the center.

There is also a nice tutorial by android hive here

like image 81
Niko Adrianus Yuwono Avatar answered Oct 11 '22 12:10

Niko Adrianus Yuwono