枢纽X和枢轴Y在Android动画中是什么意思? [英] What do pivotX and pivotY mean in Android animations?

查看:65
本文介绍了枢纽X和枢轴Y在Android动画中是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这两个术语在很多地方都存在,但是在Android动画的上下文中它们到底是什么意思?

解决方案

pivotX和ivotY是动画的中心点.
因此,例如,如果您要进行放大动画,则可以使用此

<?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>

以及android:pivotX="50%"android:pivotY="50%"表示缩放将从中央开始.

android hive还有一个很好的教程,此处

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

解决方案

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

这篇关于枢纽X和枢轴Y在Android动画中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆