【发布时间】:2017-02-15 08:02:27
【问题描述】:
我正在开发一个动画,它必须显示一个视图以更快的速度逐渐增加其大小。我想达到和你看到汽车来时一样的效果。远的时候,来的动作慢,但车辆越近,车子的速度越快。
当使用 ScaleX 和 ObjectAnimator 时,你有一些插值的可能性:
AccelerateDeccelerateInterpolator (default) -> very slow when the animation is close to finish...
AccelerateInterpolator -> Also slowing when the ScaleX is too much huge.
LinearInterpolator -> Even more slower when the ScaleX is too much huge.
FastOutSlowInInterpolator -> Still slow at the end.
ScaleX动画如何获得随时间增加比例尺速度的效果?
我的示例代码:
scaleX = ObjectAnimator.ofFloat(view, "scaleX", 0.1f, 20f);
scaleX.setDuration(10000);
scaleX.setInterpolator(new AccelerateInterpolator());
scaleX.start();
谢谢
【问题讨论】:
标签: android android-animation scale interpolation objectanimator