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

百般思念 提交于 2019-12-20 15:45:14

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/26523380/what-do-pivotx-and-pivoty-mean-in-android-animations

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!