你好,游客 登录 注册 搜索
背景:
阅读新闻

Android动画分析之3D翻转效果

[日期:2013-01-20] 来源:Linux社区  作者:loongggdroid [字体:大 中 小]

其中包括了旋转的开始和结束角度,中心点、是否扭曲、和一个Camera,这里我们主要分析applyTransformation函数,其中第一个参数就是通过getTransformation函数传递的差指点,然后我们根据这个差值通过线性差值算法计算出一个中间角度degrees,Camera类是用来实现绕Y轴旋转后透视投影的,因此我们首先通过t.getMatrix()取得当前的矩阵,然后通过camera.translate来对矩阵进行平移变换操作,camera.rotateY进行旋转。这样我们就可以很轻松的实现3D旋转效果了。

下面是布局文件main.xml:

<LinearLayout xmlns:Android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/main_screen_bg"
    android:gravity="center_horizontal"
    android:orientation="vertical"
    tools:context=".MainActivity" >

    <Button
        android:id="@+id/next_btn"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="20dip"
        android:drawableTop="@drawable/qiangpiao_dropdown"
        android:text="下一个" />

    <TextView
        android:id="@+id/tv"
        android:layout_width="300dip"
        android:layout_height="300dip"
        android:layout_gravity="center"
        android:background="@drawable/call_show_frame_safe"
        android:gravity="center"
        android:textColor="#ffffff"
        android:textSize="15sp" />

</LinearLayout>

linux
相关资讯       Android 3D  Android动画效果  Android翻转效果 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款