本节讲解RotateAnimation 动画,
RotateAnimation (float fromDegrees, float toDegrees, int pivotXType, float pivotXValue, int pivotYType, float 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坐标的伸缩值。
详细出处参考:http://www.jb51.net/article/32341.htm
参数解释:
Animation.RELATIVE_TO_SELF, 0.5f------相对自己,0.5;设置了图片的旋转点,即为中心点;
package com.example.animitation_rotate; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.View; import android.view.animation.Animation; import android.view.animation.RotateAnimation; import android.widget.Button; import android.widget.ImageView; public class MainActivity extends Activity { private ImageView image; private Button start; private Button end; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); image = (ImageView) findViewById(R.id.image_view); start = (Button) findViewById(R.id.start); end = (Button) findViewById(R.id.end); /** 设置旋转动画 */ final RotateAnimation animation = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animation.setDuration(5000);// 设置动画持续时间 /** 常用方法 */ // animation.setRepeatCount(int repeatCount);//设置重复次数 // animation.setFillAfter(boolean);//动画执行完后是否停留在执行完的状态 // animation.setStartOffset(long startOffset);//执行前的等待时间 start.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { image.setAnimation(animation); /** 开始动画 */ image.startAnimation(animation); } }); end.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { /** 结束动画 */ image.clearAnimation(); } }); } }
程序包:
相关推荐
本文实例讲述了Android编程实现RotateAnimation设置中心点旋转动画效果。分享给大家供大家参考,具体如下: 在xml设置: <?xml version=1.0 encoding=utf-8?> <rotate xmlns:android=...
本节讲解旋转动画效果RotateAnimation方法的应用,有需要的朋友可以参考下
Android 平台提供了两类动画,一类是 Tween 动画,即通过对场景里的对象不断做图像变换(平移、缩放、旋转)产生动画效果;第二类是 Frame 动画,即顺序播放事先做好的图像,跟电影类似。本文分析 Tween动画的rotate...
介绍Android动画AnimationSet,RotateAnimation等基本用法。
android动画 AlphaAnimation(透明度动画效果 );RotateAnimation(旋转动画效果);ScaleAnimation(缩放动画效果 ); TranslateAnimation(位移动画效果 )
介绍Android动画AnimationSet,RotateAnimation等基本用法。
Android旋转动画,利用RotateAnimation旋转Layout,达到隐藏显示菜单的效果
点击动画AnimationDrawable、无限转动RotateAnimation
android动画基础 XML中 alpha 渐变透明度动画效果 scale 渐变尺寸伸缩动画效果 translate 画面转换位置移动动画效果 rotate 画面转移旋转动画效果 JavaCode中 AlphaAnimation 渐变透明度动画效果 ScaleAnimation ...
旋转Rotate动画(RotateAnimation),支持设置轴点 3.缩放Scale动画(ScaleAnimation),支持多值,,支持设置轴点 4.全屏滑动Slide动画(SlideAnimation),支持上下左右四个方向移入与移出 5.自身控件范围内滑动...
本文实例讲述了Android动画之渐变动画(Tween Animation)。分享给大家供大家参考,具体如下: Android 平台提供了两类动画。 一类是Tween动画,就是对场景里的对象不断的进行图像变化来产生动画效果(旋转、平移、...
本文目录补间动画概述和分类各类补间动画实现xml实现补间动画透明度动画-AlphaAnimation缩放动画-ScaleAnimation位移动画-TranslateAnimation旋转动画-RotateAnimation动画组合-AnimationSet代码实现补间动画透明度...
Android各种动画效果ScaleAnimation,AlphaAnimation,TranslateAnimation,RotateAnimation(文章结尾有代码)
android中提供了4中动画: AlphaAnimation 透明度动画效果 ScaleAnimation 缩放动画效果 TranslateAnimation 位移动画效果 RotateAnimation 旋转动画效果 本节讲解ScaleAnimation 动画, ScaleAnimation(float fromX...
AlphaAnimation 渐变透明度动画效果 ScaleAnimation 渐变尺寸伸缩动画效果 TranslateAnimation 画面转换位置移动动画效果 RotateAnimation 画面转移旋转动画效果
包含AlphaAnimation渐变效果 TranslateAnimation:位移渐变 ScaleAnimation:缩放渐变... RotateAnimation:旋转渐变 AnimationSet:组合渐变 frameAnimation:帧动画的xml和代码实现方式,非常适合新手朋友参考。
动画类型 Android的animation由四种类型组成 XML中 alpha 渐变透明度动画效果 scale 渐变尺寸伸缩动画效果 ...RotateAnimation ...Android动画模式 Animation主要有两种动画模式: 一种是tweened