首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏android技术

    Android--ObjectAnimator源码分析

    今天来分析下属性动画的源码,首先从ObjectAnimator的ofFloat方法出发 ObjectAnimator oa = ObjectAnimator.ofFloat(iv, "translationY ", 0f,1000f); public static ObjectAnimator ofFloat(Object target, String propertyName, float... values ) { ObjectAnimator anim = new ObjectAnimator(target, propertyName); anim.setFloatValues (values); return anim; } 发现new了一个ObjectAnimator ,把target和propertyName传入 private ObjectAnimator = null) { notifyStartListeners(); } } 我们来到ObjectAnimator的initAnimation方法

    93360发布于 2020-07-03
  • 来自专栏Android-薛之涛

    Android-Animation 总结(三(ObjectAnimator))

    上一篇我们讲了ValueAnimator,今天我们讲一下ObjectAnimator,首先我在之前讲过,它继承自ValueAnimator,ValueAnimator是我们根据值的变化进行操作,而ObjectAnimator -------ObjectAnimator-------------    代码如下: ? 大家注意看,ofFloat的参数是不固定,第一个是Object类型.. 效果: Animator-ObjectAnimator_腾讯视频 那如果我们将第一个参数改为ScaleY呢?看效果。 ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(tvObjectAnimator, "scaleY", 1f, 3f, 1f); AndroidObjectAnimator _腾讯视频 明白了吧,ObjectAnimator就是这么使用的。

    68420发布于 2018-09-12
  • 来自专栏Android常用基础

    自定义View(五)-动画- ObjectAnimator

    介绍 ObjectAnimator是派生自ValueAnimator的。所以ValueAnimator中所能使用的方法,在ObjectAnimator中都可以正常使用。 如下: ObjectAnimator animator = ObjectAnimator.ofFloat(mTextView, "alpha", 1, 0); animator.setDuration( GIF1.gif 旋转(正数为顺时针,负数反之): ObjectAnimator animator = ObjectAnimator.ofFloat(mTextView, "rotation", 利用ObjectAnimator实现了透明度动画。 ---- 其他方法 由于ObjectAnimator继承ValueAnimator所以它的方法都适合ObjectAnimator

    2.7K10发布于 2018-09-11
  • 来自专栏Android知识分享

    Android ObjectAnimator类:手把手带你自定义属性动画

    基础使用 由于是继承了ValueAnimator类,所以使用的方法十分类似:XML 设置 / Java设置 4.1 Java代码设置 ObjectAnimator animator = ObjectAnimator.ofFloat : ObjectAnimator animator = ObjectAnimator.ofFloat(mButton, "rotation", 0f, 360f); // 其实Button对象中并没有rotation ) { ObjectAnimator anim = (ObjectAnimator) handler.mDelayedAnims.get(i); 所以: ObjectAnimator 类针对的是任意对象 & 任意属性值,并不是单单针对于View对象 如果需要采用ObjectAnimator 类实现动画效果,那么需要操作的对象就必须有该属性的 所以,ObjectAnimator.ofFloat(Object object, String property, float ....values)的第二个参数传入值的作用是:让ObjectAnimator

    2K10发布于 2019-10-25
  • 来自专栏郭霖

    Android属性动画完全解析(中),ValueAnimator和ObjectAnimator的高级用法

    ObjectAnimator的高级用法 ObjectAnimator的基本用法和工作原理在上一篇文章当中都已经讲解过了,相信大家都已经掌握。 大家应该都还记得,ObjectAnimator内部的工作机制是通过寻找特定属性的get和set方法,然后通过方法不断地对值进行改变,从而实现动画效果的。 那么接下来的问题就是怎样让setColor()方法得到调用了,毫无疑问,当然是要借助ObjectAnimator类,但是在使用ObjectAnimator之前我们还要完成一个非常重要的工作,就是编写一个用于告知系统如何进行颜色过度的 anim2 = ObjectAnimator.ofObject(this, "color", new ColorEvaluator(), "#0000FF", "#FF0000" OK,位置动画和颜色动画非常融洽的结合到一起了,看上去效果还是相当不错的,这样我们就把ObjectAnimator的高级用法也掌握了。

    1.1K90发布于 2018-01-05
  • 来自专栏github@hornhuang

    Android 属性动画框架 ObjectAnimator、ValueAnimator ,这一篇就够了

    这时以 ObjectAnimator、ValueAnimator 为代表的属性动画也就应运而生了。 ---- 使用 ObjectAnimator 实现四种动画 这里我打算通过使用 ObjectAnimator 实现四大动画框架: alpha scaleX/scaleY translateX/translateY rotation 给大家讲解下 ObjectAnimator 使用 private void iniAnimation(){ // 透明度动画 ObjectAnimator.ofFloat 的父类,他两之间的区别是,ObjectAnimator 在ValueAnimator 的基础上,通过反射技术实现了动画功能,也就像我刚刚所举的例子,子要给了 ObjectAnimator 两个值(from ObjectAnimator 对象 然后 在 ObjectAnimator.ofPropertyValuesHolder() 中设置一系列的动画效果 用 setAnimation 方法将该 ObjectAnimator

    4.5K30发布于 2021-09-24
  • 来自专栏Android开发

    Android自定义view之太极图

    () { if (objectAnimator==null){ objectAnimator = ObjectAnimator.ofFloat(this, "rotation (ObjectAnimator.INFINITE); objectAnimator.setRepeatMode(ObjectAnimator.RESTART); objectAnimator.start();//动画开始 }else{ objectAnimator.resume();//动画继续开始 } ); objectAnimator.setRepeatMode(ObjectAnimator.RESTART); objectAnimator.start (){ if (objectAnimator!

    20600编辑于 2025-06-12
  • 来自专栏史上最简单的Spring Cloud教程

    android动画解析(初级)

    效果图: ObjectAnimator继承自ValueAnimator的,底层的动画实现机制也是基于ValueAnimator来完成的,因此ValueAnimator仍然是整个属性动画当中最核心的一个类 那么既然是继承关系,说明ValueAnimator中可以使用的方法在ObjectAnimator中也是可以正常使用的,它们的用法也非常类似. 1.旋转控件: ObjectAnimator animator (3000); animator.start(); 4.透明 控件 ObjectAnimator animator = ObjectAnimator.ofFloat( moveIn = ObjectAnimator.ofFloat(textView, "translationX", -500f, 0f); ObjectAnimator rotate = ObjectAnimator.ofFloat(textView, "rotation", 0f, 360f); ObjectAnimator fadeInOut

    63020编辑于 2022-11-30
  • 来自专栏Android开发

    Android动画之属性动画

    (iv_show, "scaleY", 1f, 2f, 3f, 4f); // objectAnimator=ObjectAnimator.ofFloat(iv_show //组合 ObjectAnimator objectAnimator1 = ObjectAnimator.ofFloat(iv_show, "scaleY", 1f, 2f, 1f, 2f); ObjectAnimator objectAnimator2 = ObjectAnimator.ofFloat(iv_show, "scaleX", 1f, 2f, 1f, 2f ); ObjectAnimator objectAnimator3 = ObjectAnimator.ofFloat(iv_show, "rotation", 0, 90f, 180f, ).with(objectAnimator2).with(objectAnimator3); //按照顺序播放 // animatorSet.play(objectAnimator1

    27810编辑于 2025-06-12
  • 来自专栏ppjun专栏

    Android十八章:属性动画Android属性动画(第一话)

    ObjectAnimator ObjectAnimator继承了ValueAnimator,所以ValueAnimator有的方法ObjectAnimator都有。 ObjectAnimator是操作具体的控件比如button,imageview的动画,举几个例子: 图片从x轴的-500的位置移动到100的位置 ObjectAnimator objectAnimator ; objectAnimator.start(); 透明度由1变成0再变成1的动画 ObjectAnimator objectAnimator=ObjectAnimator.ofFloat objectAnimator.setDuration(500); objectAnimator.start(); y轴上缩放3倍的动画 ObjectAnimator objectAnimator 动画监听器 ObjectAnimator objectAnimator=ObjectAnimator.ofFloat(mImageView,"scaleY",1f,3f); objectAnimator.addListener

    1.3K10发布于 2018-09-05
  • 来自专栏小陈飞砖

    android滑动的六种方式

    (this, "width", getW(), 100), ObjectAnimator.ofFloat(this, "rotationX", 0, 360 ObjectAnimator.ofFloat(this, "rotation", 0, -90), ObjectAnimator.ofFloat(this , "translationX", 0, 90), ObjectAnimator.ofFloat(this, "translationY", 0, 90) , ObjectAnimator.ofFloat(this, "scaleX", 1, 1.5F), ObjectAnimator.ofFloat (this, "scaleY", 1, 0.5F), ObjectAnimator.ofFloat(this, "alpha", 1, 0.25F, 1)

    39730编辑于 2022-06-25
  • 来自专栏tea9的博客

    android-属性动画2

    http://blog.csdn.net/yegongheng/article/details/38435553 #######ObjectAnimator ofFloat 对象 ,属性名(对象存在 (imageView,p1,p2,p3).setDuration(1000).start(); 用AnimatorSet 执行一组动画 可以设置执行顺序 ObjectAnimator oa1=ObjectAnimator.ofFloat (imageView,"rotation",0f,360f); ObjectAnimator oa2=ObjectAnimator.ofFloat(imageView,"translationX",0f ,200f); ObjectAnimator oa3=ObjectAnimator.ofFloat(imageView,"translationY",0f,200f); AnimatorSet set= objectAnimator=ObjectAnimator.ofFloat(v,"alpha",0f,1f); //全部重写 objectAnimator.addListener(new Animator.AnimatorListener

    39240编辑于 2022-07-16
  • 来自专栏android技术

    Android--属性动画基础

    objectAnimator = ObjectAnimator.ofFloat(iv, "translationX", 0f, 100f); objectAnimator.setDuration objectAnimator = ObjectAnimator.ofFloat(iv, "xiaoming", 0f, 100f); objectAnimator.setDuration animator1 = ObjectAnimator.ofFloat(iv, "translationX", 0f, 100f); ObjectAnimator animator2 = ObjectAnimator animator3 = ObjectAnimator.ofFloat(iv, "scaleX", 0f, 2f); AnimatorSet animatorSet objectAnimator = new ObjectAnimator(); objectAnimator.setDuration(2000); objectAnimator.setObjectValues

    69420发布于 2020-07-03
  • 来自专栏Android常用基础

    自定义View(六)-动画- AnimatorSet与XML设置属性动画

    ObjectAnimator tv1TranslateY = ObjectAnimator.ofFloat(mTv1, "translationY", 0, 400, 0); ObjectAnimator GIF19.gif objectAnimator(ObjectAnimator): <objectAnimator android:propertyName > 代码: ObjectAnimator objectAnimator= (ObjectAnimator) AnimatorInflater.loadAnimator(this,R.animator.objectanimator objectAnimator.setTarget(mTv1); objectAnimator.start(); 效果: ? --这里有两个objectAnimator动画,一个改变值x坐标,一个改变值y坐标;取值分别为0-400和0-300;然后在代码中加载--> 代码: ObjectAnimator objectAnimator

    1.8K20发布于 2018-09-11
  • 来自专栏微卡智享

    学习|Android属性动画的组合动画之二--AnimatorSet

    代码演示 private void AnimatorArray() { //设置动画一往X轴方向从2缩放到10 ObjectAnimator animator1=ObjectAnimator.ofFloat (tvshow, "scaleX", 2, 10); //设置动画二往Y轴方向从2缩放到10 ObjectAnimator animator2=ObjectAnimator.ofFloat animator1=ObjectAnimator.ofFloat(tvshow, "scaleX", 2, 10); //设置动画二往Y轴方向从2缩放到10 ObjectAnimator animator2=ObjectAnimator.ofFloat(tvshow, "scaleY", 2, 10); //设置动画三往X轴平移100再返回 ObjectAnimator ObjectAnimator animator4=ObjectAnimator.ofFloat(tvshow, "translationY", 0, 100, 0); AnimatorSet

    3K10发布于 2019-11-24
  • 来自专栏直播知识

    直播带货APP开发,圆形旋转动画

    Motivational-Message-On-Mobile-At-Outdoor-Event_4zBFjrjl1iiG.jpeg import android.animation.ObjectAnimator = ObjectAnimator.ofFloat(this, "rotation", 0f, 359f);//添加旋转动画,旋转中心默认为控件中点         objectAnimator.setDuration (36000);//设置动画时间         objectAnimator.setInterpolator(new LinearInterpolator());//动画时间线性渐变          objectAnimator.setRepeatCount(ObjectAnimator.INFINITE);         objectAnimator.setRepeatMode(ObjectAnimator.RESTART );     }     public void playAnim() {         if (state == STATE_STOP) {             objectAnimator.start

    92720发布于 2020-10-22
  • 来自专栏Code

    Android仿饿了么购物车功能

    //数字 ObjectAnimator ta2 = ObjectAnimator.ofFloat(myHolder.tvAmount, "translationX , "rotation", 0, 360); ObjectAnimator aa2 = ObjectAnimator.ofFloat(myHolder.tvAmount ); //纵向 ObjectAnimator oaY = ObjectAnimator.ofFloat(iv, "translationY //数字 ObjectAnimator ta2 = ObjectAnimator.ofFloat(myHolder.tvAmount, "translationX , "rotation", 0, 360); ObjectAnimator aa2 = ObjectAnimator.ofFloat(myHolder.tvAmount

    1.2K40发布于 2020-10-29
  • 来自专栏Android开发与分享

    【Android】属性动画(基本用法)

    不急,往下看~~) ObjectAnimator animator = ObjectAnimator.ofFloat(imageView, "alpha", 0f); 效果: ? ObjectAnimator animator = ObjectAnimator.ofFloat(imageView, "alpha", 1f, 0f, 1f); animator.setDuration ObjectAnimator animator = ObjectAnimator.ofFloat(imageView, "scaleX", 1f, 2f, 1f); animator.setDuration //沿x轴放大 ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(imageView, "scaleX", 1f, 2f, 1f); //沿y 轴放大 ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(imageView, "scaleY", 1f, 2f, 1f); //移动 ObjectAnimator

    1.8K80发布于 2018-05-18
  • 来自专栏青蛙要fly的专栏

    Android技能树 — 动画小结

    ObjectAnimator: ? 引用扔物线大佬里面的内容: 动画操作使用方式: 如果是自定义控件,需要添加 setter / getter 方法; 用 ObjectAnimator.ofXXX() 创建 ObjectAnimator 对象 ObjectAnimator animator = ObjectAnimator.ofFloat(view, "progress", 0, 65); // 执行动画 animator.start 但我要说明一下,它们的性能是一样的,因为 ViewPropertyAnimator 和 ObjectAnimator 的内部实现其实都是 ValueAnimator,ObjectAnimator 更是本来就是 能用 View.animator() 实现就不用 ObjectAnimator,能用 ObjectAnimator 就不用 ValueAnimator。 4. AnimationSet: ?

    99320发布于 2018-08-29
  • 来自专栏JetPack

    日常开发 | Android设置属性动画无限旋转

    两种方式实现: 方式1: ImageView img = findViewById(R.id.img_src); ObjectAnimator objectAnimator = ObjectAnimator.ofFloat (img, "rotation", 0, 359); objectAnimator.setRepeatCount(ValueAnimator.INFINITE); objectAnimator.setDuration (2000); objectAnimator.setInterpolator(new LinearInterpolator()); objectAnimator.start(); 方式2: RotateAnimation ObjectAnimator extends ValueAnimator -> ValueAnimator extends Animator 用于为目标动画提供属性支持。

    1.7K20编辑于 2022-02-09
领券