Android开发中必定会涉及到动画方面的效果,那么就会遇到一个问题,如果控制动画开始速度,与结束速度。还有其他的一些效果

我们可以在xml里面设置属性
复制代码

android:interpolator="@android:anim/accelerate_interpolator" 设置动画为加速动画(动画播放中越来越快)

android:interpolator="@android:anim/decelerate_interpolator" 设置动画为减速动画(动画播放中越来越慢)

android:interpolator="@android:anim/accelerate_decelerate_interpolator" 设置动画为先加速在减速(开始速度最快 逐渐减慢)

android:interpolator="@android:anim/anticipate_interpolator" 先反向执行一段,然后再加速反向回来(相当于我们弹簧,先反向压缩一小段,然后在加速弹出)

android:interpolator="@android:anim/anticipate_overshoot_interpolator" 同上先反向一段,然后加速反向回来,执行完毕自带回弹效果(更形象的弹簧效果)

android:interpolator="@android:anim/bounce_interpolator" 执行完毕之后会回弹跳跃几段(相当于我们高空掉下一颗皮球,到地面是会跳动几下)

android:interpolator="@android:anim/cycle_interpolator" 循环,动画循环一定次数,值的改变为一正弦函数:Math.sin(2* mCycles* Math.PI* input)

android:interpolator="@android:anim/linear_interpolator" 线性均匀改变

android:interpolator="@android:anim/overshoot_interpolator" 加速执行,结束之后回弹

复制代码

然后我们在代码中也可以设置,顺序效果同上
复制代码

animation.setInterpolator(new AccelerateInterpolator());

animation.setInterpolator(new DecelerateInterpolator());

animation.setInterpolator(new AccelerateDecelerateInterpolator());

animation.setInterpolator(new AnticipateInterpolator());

animation.setInterpolator(new AnticipateOvershootInterpolator());

animation.setInterpolator(new BounceInterpolator());

animation.setInterpolator(new CycleInterpolator(2));

animation.setInterpolator(new LinearInterpolator());

animation.setInterpolator(new OvershootInterpolator());

复制代码

动画不设置Interpolator属性即为默认值,匀速

Interpolator属性也可自定义

Android Interpolator属性 设置动画速度相关推荐

  1. android 后台代码设置动画

    1.设置旋转动画 final RotateAnimation animation =new RotateAnimation(0f,360f,Animation.RELATIVE_TO_SELF, 0. ...

  2. HTML怎么设置动画速度,animate帧速率在哪调? animate修改帧速率的技巧

    我们在使用动画软件的时候通常会用到帧速率,(每秒钟多少画)以前用的多数是12 也就是每秒十二帧,现在都是每秒30帧 或者是25帧,可以通过缩放帧跨度来管理动画速度,下面我们就来看看详细的设置图文教程. ...

  3. Android TextView 属性设置

    2019独角兽企业重金招聘Python工程师标准>>> android textview xml 属性设置 android:ems 设置TextView的宽度为N个字符的宽度. an ...

  4. Android activity属性设置大全

    activity属性设置大全 (请发邮件到 freeget.one@gmail.com  获得最新翻强软件.) android:allowTaskReparenting=["true&quo ...

  5. android设置点击间隔,巧用android:divider属性设置LinearLayout中元素之间的间隔

    如上图,要想实现3个button线性排列并且使它们的大小相同.间隔相等.而且整体填充满整个linearlayout,我们一般的做法是在每两个button之间放一个固定宽度的view,然后设置butto ...

  6. Android USB 属性设置:ADB、RNDIS、MTP等

    Android手机:三星s4 Android5.0 内核:3.4.5 手机需root,且需要安装busybox和terminal Ubuntu版本:14.04 -------------------- ...

  7. android光标属性设置,光标设置、hint设置

    1.在edittext编辑框中调用属性. android:layout_width="match_parent" android:layout_height="50dp& ...

  8. Android给View设置动画没有效果

    这两天在第三方类库中的代码,需要在原来的xml中添加自己的布局,然后播放动画,将布局写好后,include到第三方的xml布局中,然后用属性动画开始播放,结果无论怎么样都没效果,用补间动画也是没有效果 ...

  9. Android 动画的插值器 (Interpolator属性)

    Interpolator(插值器): 属性是设置动画的速度变化的 Interpolator(插值器)的使用方法: 两种方式:在XML 和Java代码中 方法有9中 都是内置的构造方法所以在java代码 ...

最新文章

  1. 卷积核输出特征图大小的计算 深度学习
  2. 【算法】DFS 刷题总结
  3. html给图片做绝对定位,有关绝对定位的全面理解
  4. django model filter_Django分表的两个方案
  5. C++的error C2668: 'pow' : ambiguous call to overloaded function错误原因及解决方法
  6. 文件服务器的未分页内存
  7. 用户手册 (V4.0 版)
  8. 【JAVA程序设计】(C00019)javaweb高校社团管理系统
  9. java单点登录SSO教程(含源码和视频教程)
  10. adb连接网易mumu模拟器
  11. matlab解方java_Java:调用window的matlab遇到的问题和解决方案
  12. 《Unsupervised Part-based Weighting Aggregation of Deep Convolutional Features for Image Retrieval》笔记
  13. 设置 IntelliJ IDEA 主题和字体的方法
  14. 微信公众号扫码授权登录思路
  15. 微信小程序开发笔记,你收藏了吗?
  16. CODEVS 1083 Cantor表
  17. 透析阿里3亿元投资的如涵:孵化张大奕,吸金但苦逼
  18. 华硕主板设置RTC自动开机
  19. IP地址划分【分类:A类 B类 C类 D类 E类】
  20. MyBatis主键回填

热门文章

  1. Paper之ICASSPIEEEAUDIOSPE:2018~2019年ICASSP国际声学、语音和信号处理会议IEEE-ACM T AUDIO SPE音频、语音和语言处理期刊最佳论文简介及其解读
  2. 【转】c# 图片压缩 (非图片大小变化)----使得显示效果差点,但是图片占用空间需要变小
  3. 点击进入我的QQ空间
  4. 微信小游戏个人开发者如何盈利
  5. Java实现 LeetCode 48 旋转图像
  6. 如何制作视频画面水平镜像播放特效
  7. 基于专家知识的决策树分类|以DEM+影像数据在ENVI操作为例
  8. RabbitMQ(6)-Spring AMQP,Spring集成RabbitMQ
  9. 49天精通Java,第12天,Java接口的作用和意义
  10. ETCD 源码学习--Watch(client)