本文实例讲述了Android编程实现RotateAnimation设置中心点旋转动画效果。分享给大家供大家参考,具体如下: 在xml设置: <?..."360.0" / // 设置动画结束时的旋转角度 在代码中设置,主要是x,y的坐标为中心点: public void rotateAnim() { Animation anim =new RotateAnimation
先简单写出各个标签对应的类,方便大家理解: scale —— ScaleAnimation alpha —— AlphaAnimation rotate —— RotateAnimation translate...RotateAnimation类对应Rotate标签,SDK文档地址:《RotateAnimation》 Rotate标签所具有的XML属性有: android:fromDegrees 开始旋转的角度位置...(Context context, AttributeSet attrs) 从本地XML文档加载动画,同样,基本不用 RotateAnimation(float fromDegrees, float...toDegrees) RotateAnimation(float fromDegrees, float toDegrees, float pivotX, float pivotY) RotateAnimation...fromDegrees, float toDegrees, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue) RotateAnimation
【Android动画九章】-RotateAnimation(旋转动画)和ScaleAnimation(尺寸动画) public abstract class Animation extends Object...java.lang.Object ↳ Android.view.animation.Animation Known Direct Subclasses AlphaAnimation, AnimationSet, RotateAnimation..., ScaleAnimation, TranslateAnimation 同AlphaAnimation和TranslateAnimation一样,RotateAnimation和ScaleAnimation...RotateAnimation 常用构造方法: RotateAnimation(float fromDegrees, float toDegrees, int pivotXType, float pivotXValue
,0.5f); //设置动画的时间长度 rotateAnimation.setDuration(2000); //设置重复的类型 rotateAnimation.setRepeatMode(Animation.REVERSE...); //设置重复的次数 rotateAnimation.setRepeatCount(2); //设置是否停留在最终状态 rotateAnimation.setFillAfter(false); //...,0.5f); rotateAnimation.setDuration(2000); rotateAnimation.setRepeatMode(Animation.REVERSE); rotateAnimation.setRepeatCount...(2); rotateAnimation.setFillAfter(false); //添加旋转动画 animationSet.addAnimation(rotateAnimation); ScaleAnimation...); rotateAnimation.setRepeatCount(2); rotateAnimation.setFillAfter(false); //
RotateAnimation实现转动动画: package com.jikexueyuan.rotateanimation; import android.app.Activity; import android.os.Bundle...; public class MainActivity extends Activity { private RotateAnimation ra; @Override...; public class MainActivity extends Activity { private RotateAnimation ra; @Override...rotateanimation.setInterpolator(new LinearInterpolator()); rotateanimation.setRepeatCount(ObjectAnimator.INFINITE...} public void stop(){ rotateanimation.end(); statics = STOP; } }
度,顺时针转;构造函数:开始度数,结束度数,圆心x(宽度一半),圆心y(高度) 调用RotateAnimation对象的setDuration()方法,设置执行时间,参数:毫秒 调用RotateAnimation...rotateAnimation=new RotateAnimation(0, 180, view.getWidth()/2, view.getHeight()); rotateAnimation.setDuration...(1000); rotateAnimation.setFillAfter(true); rotateAnimation.setStartOffset(times);...static void startAnimIn(RelativeLayout view) { RotateAnimation rotateAnimation=new RotateAnimation...(180, 360, view.getWidth()/2, view.getHeight()); rotateAnimation.setDuration(1000); rotateAnimation.setFillAfter
EditorGUILayout.EndFadeGroup(); //RotateAnimation...var rotateAnimation = animation.rotateAnimation;...rotateAnimation.isCustom, () => { rotateAnimation.isCustom = false; EditorUtility.SetDirty(Target); }...var rotateAnimation = animation.rotateAnimation;...rotateAnimation.isCustom, () => { rotateAnimation.isCustom = false; EditorUtility.SetDirty(Target); }
android.os.Bundle; import android.view.MotionEvent; import android.view.View; import android.view.animation.RotateAnimation...rotateAnimation = new RotateAnimation(0, -degrees, 450, 450); // rotateAnimation.setDuration(5000);...// rotateAnimation.setFillAfter(true); // customCircleView.startAnimation(rotateAnimation); // }...rotateAnimation = new RotateAnimation(0, -degrees, 250, 250); rotateAnimation.setDuration(5000);...rotateAnimation.setFillAfter(true); customTurntableView.startAnimation(rotateAnimation); }
rotateAnimation = new RotateAnimation( startDegree, startDegree + increaseDegree, RotateAnimation.RELATIVE_TO_SELF..., 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); //将最后的角度赋值给startDegree作为下次转圈的初始角度 startDegree += increaseDegree...; //计算动画播放总时间 long time = (lap + angle / 360) * ONE_WHEEL_TIME; //设置动画播放时间 rotateAnimation.setDuration...(time); //设置动画播放完后,停留在最后一帧画面上 rotateAnimation.setFillAfter(true); //设置动画的加速行为,是先加速后减速 rotateAnimation.setInterpolator...(al); //开始播放动画 pointIv.startAnimation(rotateAnimation); } }); } private void setupViews(){ lightIv =
Animation rotateAnimation = null ; int isAnimationState = -1; int time1,time2 = 0; private int...= new RotateAnimation((time1),0,Animation.ABSOLUTE,9,Animation.ABSOLUTE,10); rotateAnimation.setDuration...= new RotateAnimation(animAngle,0,Animation.ABSOLUTE,9,Animation.ABSOLUTE,10); rotateAnimation.setDuration...(0); isAnimationState = 3; break; } rotateAnimation.setFillAfter(...true); findViewById(R.id.album_hand).startAnimation(rotateAnimation); }
new AlphaAnimation(1.0f, 0.1f); alphaAnimation.setDuration(3000); RotateAnimation...rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF..., 0.5f); rotateAnimation.setDuration(3000); animationSet.addAnimation...(alphaAnimation); animationSet.addAnimation(rotateAnimation); imageView.startAnimation
动画可以按先后顺序执行 支持背景色的修改 Animator 的子类 AnimationSet的使用 微卡智享 一般来我说我们在App中常用的都是一些视图动画:包括透明动画(AlphaAnimation)、旋转动画(RotateAnimation...//透明度从0至1 AlphaAnimation alphaAnimation = new AlphaAnimation(0, 1); //旋转两圈 RotateAnimation...rotateAnimation=new RotateAnimation(0, 720, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF...Animation.REVERSE); animationSet.addAnimation(alphaAnimation); animationSet.addAnimation(rotateAnimation
); rotateAnimation.setFillAfter(true); rotateAnimation.setInterpolator(new DecelerateInterpolator());...container.startAnimation(rotateAnimation); } }); } private void initCloseAnim() { closeAnimation = new...= new Rotate3dAnimation(90, 0, centerX, centerY, depthZ, false); rotateAnimation.setDuration(duration...); rotateAnimation.setFillAfter(true); rotateAnimation.setInterpolator(new DecelerateInterpolator());...container.startAnimation(rotateAnimation); } }); } } Demo下载 以上就是本文的全部内容,希望对大家的学习有所帮助。
集合动画AnimationSet 补间动画有四大类:透明度动画AlphaAnimation、旋转动画RotateAnimation、缩放动画ScaleAnimation、平移动画TranslateAnimation...0.5f); rotateAnimation.setDuration(3000); rotateAnimation.setFillAfter(true); } @Override public...0.5f); rotateAnimation2.setDuration(3000); rotateAnimation2.setFillAfter(true); if (animation.equals...0.5f); rotateAnimation.setDuration(3000); rotateAnimation.setFillAfter(true); } @Override public...0.5f); rotateAnimation2.setDuration(3000); rotateAnimation2.setFillAfter(true); if (animation.equals
private ProgressBar lvHeaderProgressBar; // 定义头部下拉刷新的布局的高度 private int headerContentHeight; private RotateAnimation...animation; private RotateAnimation reverseAnimation; private int startY; private int state; private...(0, -180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); animation.setInterpolator...LinearInterpolator()); animation.setDuration(250); animation.setFillAfter(true); reverseAnimation = new RotateAnimation...(-180, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); reverseAnimation.setInterpolator
package com.itcast.youkumenu; import android.view.View; import android.view.animation.RotateAnimation...ra = new RotateAnimation(180, 360, view.getWidth() / 2, view.getHeight()); ra.setDuration(500...ra = new RotateAnimation(0, 180, view.getWidth() / 2, view.getHeight()); ra.setDuration(500)...ra = new RotateAnimation(0, 180, view.getWidth() / 2, view.getHeight()); ra.setDuration(500)...ra = new RotateAnimation(0, 180, view.getWidth() / 2, view.getHeight()); ra.setDuration(500)
iView.startAnimation(ta); } 位移动画有两种构造方法,具体还需自己尝试尝试 d:旋转动画 public void RotateAnimation...(View v) { //旋转开始角度和结束角度 //ra = new RotateAnimation(0, -15); //ra = new RotateAnimation...(20, 360, iView.getWidth()/2, iView.getHeight()/2); ra = new RotateAnimation(0, 90, Animation.RELATIVE_TO_SELF
rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f,...Animation.RELATIVE_TO_SELF, 0.5f); //1.2 设置时长 rotateAnimation.setDuration(500); //...rotateAnimation.setRepeatCount(1); // rotateAnimation.setRepeatMode(Animation.REVERSE);...//1.3 保持动画结束 rotateAnimation.setFillAfter(true); //2....动画集合 animationSet = new AnimationSet(true); animationSet.addAnimation(rotateAnimation
android.support.v7.app.AppCompatActivity; import android.view.animation.Animation; import android.view.animation.RotateAnimation...== Sensor.TYPE_ORIENTATION) { // 获取绕Z轴转过的角度 float degree = event.values[0]; // 创建旋转动画(反向转过degree度) RotateAnimation...ra = new RotateAnimation(currentDegree, -degree, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF...// 创建旋转动画(反向转过degree度) RotateAnimation ra = new RotateAnimation(currentDegree, -degree, Animation.RELATIVE_TO_SELF
Animation(动画)有两种分类:补间动画(Tween)和帧动画(Frame) 补间动画主要有以下几种: 旋转(RotateAnimation) 平移(TranslateAnimation) 拉伸...rotateAnimation = new RotateAnimation(0, 180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF..., 0.5f); rotateAnimation.setDuration(5000); // 循环播放,参数循环的次数,会在setDuration的时间中循环完,循环为0~180,0~-180算一次 CycleInterpolator...(rotateAnimation); /** * 动画集合 */ // 方法一: Animation set = AnimationUtils.loadAnimation(this, R.anim.set...所以动画都执行同一个变速器即set设置的变速器,false执行各自的变速器 AnimationSet set2 = new AnimationSet(false); set2.addAnimation(rotateAnimation
领取专属 10元无门槛券
手把手带您无忧上云