What do pivotX and pivotY mean in Android animations?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26523380/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 11:42:14  来源:igfitidea点击:

What do pivotX and pivotY mean in Android animations?

androidandroid-animation

提问by srujan maddula

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

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

回答by Niko Adrianus Yuwono

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

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.

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

There is also a nice tutorial by android hive here