android - 如何设置 PropertyAnimation 的帧速率?

标签 android android-animation

Android documentation说你可以设置刷新率:

Frame refresh delay: You can specify how often to refresh frames of your animation. The default is set to refresh every 10 ms, but the speed in which your application can refresh frames is ultimately dependent on how busy the system is overall and how fast the system can service the underlying timer.

但是,它并没有告诉您如何操作。到处找遍了,在ObjectAnimator、PropertyAnimator、Animator中都没有这个方法。

编辑:我目前使用的是每 5 帧仅响应一次的动画更新程序 -

colorFade.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
       int interpolator = 0;

       @Override
       public void onAnimationUpdate(ValueAnimator animation) {
           if ((interpolator++) % 5 == 0)
                invalidate(mHandlerBounds);
        }
  });

最佳答案

正如@pskink 所说,使用:

public static void setFrameDelay(long frameDelay)

属于 ValueAnimator类(class)。你可以在文档中看到这个:

The amount of time, in milliseconds, between each frame of the animation. This is a requested time that the animation will attempt to honor, but the actual delay between frames may be different, depending on system load and capabilities. This is a static function because the same delay will be applied to all animations, since they are all run off of a single timing loop. The frame delay may be ignored when the animation system uses an external timing source, such as the display refresh rate (vsync), to govern animations.

关于android - 如何设置 PropertyAnimation 的帧速率?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32054980/

相关文章:

android - 自定义加载器,如 Android 中的 Instagram

Android ScrollView 在旋转动画中丢失剪辑

android - 如何在android中为 map 填充设置动画

android - 检索项目 : No resource found that matches the given names 的父项时出错

android - visual studio 2015 中的 cordova 构建错误

android - Gradle maven 发布插件配置引用了动态创建的 gradle 任务

Android - 什么替代了 NineOldAndroids 动画库?

android - 用手指移动任何 RelativeLayout(不改变布局参数)

java - Android 加速计每次返回相同的值

java - android以编程方式从字符串更改背景图像