- 浏览: 137636 次
- 性别:
文章分类
- 全部博客 (226)
- Android (181)
- C# (8)
- BOOTSTRAP (1)
- ASP.NET MVC4 (1)
- 设计模式 (1)
- VB.NET (1)
- WPF (0)
- PLC (0)
- 电气图纸 (0)
- 数据库 (5)
- Java (5)
- Window phone (0)
- 仪器仪表 (0)
- 变频器 (0)
- 低压电器 (0)
- 物联网 (0)
- Photoshop (1)
- SVN (1)
- 单片机 (5)
- IT (1)
- Android_IOS风格 (0)
- Android_广告栏展示 (0)
- Android_动画 (1)
- Android_Adapter (0)
- Android_ListView (1)
- Android_File (2)
- Android_表单提交 (0)
- Android_WebView (1)
- PHP (2)
- Android_Excel (1)
- Android_drawable (1)
- Android_theme (2)
- Android_phonegap (2)
- Android_AndroidManifest (1)
- ThinkPHP (0)
- Jquery (1)
- Android_ContentProvider (1)
最新评论
RotateAnimation旋转坐标系为以旋转点为坐标系(0,0)点。x轴为0度,顺时针方向旋转一定的角度。
1.RotateAnimation(fromDegrees, toDegrees)
[默认以View左上角顶点为旋转点]。
X轴顺时针转动到fromDegrees为旋转的起始点,
X轴顺时针转动到toDegrees为旋转的起始点。
如fromDegrees=0,toDegrees=90;为左上角顶点为旋转点。0度为起始点,90度为终点。进行旋转,旋转了90度
如fromDegrees=60,toDegrees=90;为左上角顶点为旋转点。60度为起始点,90度为终点。进行旋转,旋转了90-60=30度
2.RotateAnimation(float fromDegrees, float toDegrees, float pivotX, float pivotY)
(pivotX,pivotY)为旋转点。pivotX为距离左侧的偏移量,pivotY为距离顶部的偏移量。即为相对于View左上角(0,0)的坐标点。
如View width=100px,height=100px
RotateAnimation(0,10,100,100);则以右下角顶点为旋转点,从原始位置顺时针旋转10度
RotateAnimation(0,90,50,50);则以View的中心点为旋转点,旋转90度
3.RotateAnimation(fromDegrees, toDegrees, pivotXType, pivotXValue, pivotYType, pivotYValue)
参数说明:
float fromDegrees:旋转的开始角度。
float toDegrees:旋转的结束角度。
int pivotXType:X轴的伸缩模式,可以取值为ABSOLUTE、RELATIVE_TO_SELF、RELATIVE_TO_PARENT。
float pivotXValue:X坐标的伸缩值。 (即动画横坐标的旋转 中心)
int pivotYType:Y轴的伸缩模式,可以取值为ABSOLUTE、RELATIVE_TO_SELF、RELATIVE_TO_PARENT。
float pivotYValue:Y坐标的伸缩值。 (即动画纵坐标的旋转 中心)
如RotateAnimation(0, 90, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); 按中心点旋转90度
效果和2例中的RotateAnimation(0,90,50,50);则以View的中心点为旋转点,旋转90度 。效果一样
*****************************************************************************
1.RotateAnimation(fromDegrees, toDegrees)
[默认以View左上角顶点为旋转点]。
X轴顺时针转动到fromDegrees为旋转的起始点,
X轴顺时针转动到toDegrees为旋转的起始点。
如fromDegrees=0,toDegrees=90;为左上角顶点为旋转点。0度为起始点,90度为终点。进行旋转,旋转了90度
如fromDegrees=60,toDegrees=90;为左上角顶点为旋转点。60度为起始点,90度为终点。进行旋转,旋转了90-60=30度
2.RotateAnimation(float fromDegrees, float toDegrees, float pivotX, float pivotY)
(pivotX,pivotY)为旋转点。pivotX为距离左侧的偏移量,pivotY为距离顶部的偏移量。即为相对于View左上角(0,0)的坐标点。
如View width=100px,height=100px
RotateAnimation(0,10,100,100);则以右下角顶点为旋转点,从原始位置顺时针旋转10度
RotateAnimation(0,90,50,50);则以View的中心点为旋转点,旋转90度
3.RotateAnimation(fromDegrees, toDegrees, pivotXType, pivotXValue, pivotYType, pivotYValue)
参数说明:
float fromDegrees:旋转的开始角度。
float toDegrees:旋转的结束角度。
int pivotXType:X轴的伸缩模式,可以取值为ABSOLUTE、RELATIVE_TO_SELF、RELATIVE_TO_PARENT。
float pivotXValue:X坐标的伸缩值。 (即动画横坐标的旋转 中心)
int pivotYType:Y轴的伸缩模式,可以取值为ABSOLUTE、RELATIVE_TO_SELF、RELATIVE_TO_PARENT。
float pivotYValue:Y坐标的伸缩值。 (即动画纵坐标的旋转 中心)
如RotateAnimation(0, 90, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); 按中心点旋转90度
效果和2例中的RotateAnimation(0,90,50,50);则以View的中心点为旋转点,旋转90度 。效果一样
*****************************************************************************
public class MainActivity extends Activity { ImageView image; Button start; Button cancel; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); image = (ImageView) findViewById(R.id.main_img); start = (Button) findViewById(R.id.main_start); cancel = (Button) findViewById(R.id.main_cancel); /** 设置旋转动画 / final RotateAnimation animation =new RotateAnimation(0f,360f,Animation.RELATIVE_TO_SELF, 0.5f,Animation.RELATIVE_TO_SELF,0.5f); animation.setDuration(3000);//设置动画持续时间 /* 常用方法 / //animation.setRepeatCount(int repeatCount);//设置重复次数 //animation.setFillAfter(boolean);//动画执行完后是否停留在执行完的状态 //animation.setStartOffset(long startOffset);//执行前的等待时间 start.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { image.setAnimation(animation); /* 开始动画 / animation.startNow(); } }); cancel.setOnClickListener(new OnClickListener() { public void onClick(View v) { /* 结束动画 */ animation.cancel(); } }); } }
发表评论
-
LayoutInflater
2014-12-22 21:43 511在实际开发中LayoutInflater这个类还是非常有用的, ... -
ContentProvider之读写短消息
2014-12-08 11:08 565http://blog.csdn.net/liuhe ... -
android之启用默认浏览器
2014-11-03 12:36 479一、启动android默认浏览器 Intent inten ... -
eclipse下看android support v4源码
2014-09-18 22:24 600http://cfy10.blog.51cto.com/707 ... -
Android学习 (七)synchronized
2014-09-17 10:16 581http://hi.baidu.com/fenghuang12 ... -
ScheduledExecutorService定时周期执行指定的任务
2014-09-17 09:57 636http://blog.csdn.net/tsyj810883 ... -
android rotate
2014-09-16 15:21 1172rotate:fromDegrees:其实角度。toDegr ... -
Android获取Manifest中<meta-data>元素的值
2014-09-12 15:39 641在AndroidManifest.xml中,<meta- ... -
PopupWindow
2014-09-12 11:09 8471-初始化 PopupWindow mPop = new P ... -
Android的事件分发onInterceptTouchEvent与onTouchEvent、OnClickListener、OnLongClick
2014-09-11 11:05 869onInterceptTouchEvent()是ViewGro ... -
scrollTo、scrollBy、getScrollX、getScrollY这4个方法的含义,Scroller的简单用法
2014-09-11 10:43 1513scrollTo、scrollBy都是 对 ... -
VelocityTracker
2014-09-11 10:14 650android.view.VelocityTracker主要用 ... -
Android之SurfaceHolder
2014-09-09 16:05 568SurfaceHolder,可以把它当成surface的控制器 ... -
android performClick使用
2014-09-09 13:53 1111performClick 是使用代码主动去调用控件的点击事件( ... -
slidingmenu使用说明
2014-09-07 10:17 584左侧、右侧和两边 在BaseActivity中将Slid ... -
Android之SlidingMenu属性详解
2014-09-07 09:52 623SlidingMenu 常用属性介绍: menu.setMod ... -
Android IOS风格侧边栏效果
2014-08-27 13:45 318http://download.csdn.net/detail ... -
android 代码设置、打开wifi热点及热点的连接
2014-08-26 10:30 1005见博客文章 http://blog.csdn.net/luob ... -
Android 之两点触摸技术
2014-08-26 09:58 711package mobile.android.multi.to ... -
Android动画之translate(位移动画)
2014-08-25 15:53 445http://www.cnblogs.com/bavariam ...
相关推荐
实现简单的 Android rotateAnimation实例源码。
本文实例讲述了Android编程实现RotateAnimation设置中心点旋转动画效果。分享给大家供大家参考,具体如下: 在xml设置: <?xml version=1.0 encoding=utf-8?> <rotate xmlns:android=...
NULL 博文链接:https://kakukemeit.iteye.com/blog/1790139
本节讲解旋转动画效果RotateAnimation方法的应用,有需要的朋友可以参考下
主要介绍Android中如何使用rotate实现图片不停旋转的效果。Android 平台提供了两类动画,一类是 Tween 动画,即通过对场景里的对象不断做图像变换(平移、缩放、旋转)产生动画效果;第二类是 Frame 动画,即顺序播放...
在Andriod开发中,Animation是用来给控件... 根据我们需要的动态效果创建一个Animation类,主要有4个这样的类,分别为AlphaAnimation,ScaleAnimation,RotateAnimation,TranslateAnimation,分别对应着一种动画效果。
点击动画AnimationDrawable、无限转动RotateAnimation
介绍Android动画AnimationSet,RotateAnimation等基本用法。
Android旋转动画,利用RotateAnimation旋转Layout,达到隐藏显示菜单的效果
android图片旋转、淡入淡出、缩放效果、移动效果示例,先来看下截图的运行效果,单击对应的按钮,即可看到效果,淡入淡出之类的,图片旋转之类的。 图片旋转的代码如下: rotateAnimation.setDuration(5000); ...
Android 掌上校园根据学校学生的一些需求 开发具有提下功能 使用 旋转—RotateAnimation 缩放--ScaleAnimation 渐变—AlphaAnimation等 进行Splash动画效果设计 2、SlidingMenu(侧边栏效果) 首先,引入SlidingMenu的...
Android各种动画效果ScaleAnimation,AlphaAnimation,TranslateAnimation,RotateAnimation(文章结尾有代码)
介绍Android动画AnimationSet,RotateAnimation等基本用法。
关于旋转动画用XML与Java Code两种方式实现的demo
RotateAnimation animation = new RotateAnimation(fromDegrees, initDegress + toDegrees, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animation.setDuration(1);// 设置动画执行...
android动画 AlphaAnimation(透明度动画效果 );RotateAnimation(旋转动画效果);ScaleAnimation(缩放动画效果 ); TranslateAnimation(位移动画效果 )
Android 一个很酷的加载loading效果,自定义LeafLoadingView实现,LeafLoadingView继承view, 本例子主要由以下几点构成 (1):RotateAnimation实现叶子旋转 (2):叶子飘动 (3):当前进度绘制当前进度条
本源码中包含三个时钟代码:更改系统时钟__Runable实现;更改系统时钟__TimerTask实现;自定义动画时钟__RotateAnimation实现