在具有深度感知的 z 轴上旋转的视图之间转换的动画 [英] animation to transition between views with rotation on z-axis with depth perception

查看:29
本文介绍了在具有深度感知的 z 轴上旋转的视图之间转换的动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个动画以在两个视图之间转换,这两个视图都是 ExpandableListViews.我想要的外观如下图所示.

I'm trying to create an animation to transition between two views, both of which are ExpandableListViews. The look I want is described in the image below.

我尝试使用shrink_to_middle 和grow_from_middle 作为我的ViewAnimator 的出/入动画 - 它很接近,但不太正确 - 与我当前的缩小/增长,随着动画的发生,左右边缘视图具有相同的高度,这不会为动画提供任何深度.

I tried using a shrink_to_middle and grow_from_middle as the out/in animations of my ViewAnimator - and it's close, but not quite right - with my current shrink/grow, as the animation is taking place, both the right and left edges of the views are the same height, which does not provide any depth to the animation.

我不确定如何最好地解释我想要什么,这就是我绘制图像的原因,但无论如何……我想对动画进行 3-d 外观,其中视图在z 轴.假设我们使用简单的shrink_to_middle 和grow_from_middle 动画作为起点(它不提供3-d 外观.)为了提供3-d 外观,out 动画的右边缘会随着视图缩小到中间;随着视图从中间增长,动画中的左边缘会逐渐变大.

I'm not sure how best to explain what I want, which is why I drew the image, but here goes anyways... I want to have a 3-d look to the animation where the view is rotated on the z-axis. Assuming we use a simple shrink_to_middle and grow_from_middle animation as the starting point (which does not provide a 3-d look.) To provide the 3-d look, the out animation would have the right edge get progressively smaller as the view shrinks to the middle; the in animation would have the left edge get progressively larger as the view grows from the middle.

图像 1 到 4 将是输出动画(对于视图 #1),图像 5-8 将是动画(对于视图 #2)

Images 1 through 4 would be the out animation (for view #1) and images 5-8 would be the in animation (for view #2)

提前致谢.

编辑:仅供参考,这是我目前从中间动画 xml 文件缩小到中间和增长的内容

Edit: FYI, Here are my current shrink to middle and grow from middle animation xml files

shrink_to_middle.xml

shrink_to_middle.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <scale android:interpolator="@android:anim/linear_interpolator"
        android:fromXScale="1.0" android:toXScale="0.0" android:fromYScale="1.0"
        android:toYScale="1.0" android:fillAfter="false" android:duration="500" />
    <translate android:fromXDelta="0" android:toXDelta="50%"
        android:duration="500" />
</set>

grow_from_middle.xml

grow_from_middle.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <scale android:interpolator="@android:anim/linear_interpolator"
        android:fromXScale="0.0" android:toXScale="1.0" android:fromYScale="1.0"
        android:toYScale="1.0" android:fillAfter="false" android:startOffset="200"
        android:duration="500" />
    <translate android:fromXDelta="50%" android:toXDelta="0"
        android:startOffset="200" android:duration="500" />
</set>

推荐答案

Rotate3dAnimation 就是答案.它位于示例 SDK 文件夹中.我正在使用 0 到 -90 的动画和 90 到 0 的动画,效果很好.

Rotate3dAnimation is the answer. It is in the samples SDK folder. I'm using out animation of 0 to -90 and in animation of 90 to 0 and it works great.

这篇关于在具有深度感知的 z 轴上旋转的视图之间转换的动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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