【问题标题】:Is there a way to eliminate Interpolation on an Animation?有没有办法消除动画插值?
【发布时间】:2014-03-07 20:57:05
【问题描述】:

我确定我遗漏了一些明显的东西,但我无法让我的 ViewFlipper 从一个布局平滑地动画到下一个布局。

我的愿望是让动画以恒定的速度移动。不要加速或减速。总体期望的效果是让鳍状肢永久动画,没有明显的卡顿或打嗝,这样两个(或更多)布局就可以继续移动,就像在一个环形卷轴上一样。

但是,当我不设置插值时,它默认为 *一些默认的内置插值,最终会减慢到 0。

当我*设置插值时,似乎没有数字可以传递给我平滑的动画结果。 0 完全停止动画,而 1 执行(看似)默认设置。

我忽略了什么?

这是我正在传递的动画方法(作为我自定义 Animation 的一部分到 ViewFlipper

public Animation inFromRightAnimation(int duration) {
    Animation inFromRight = new TranslateAnimation(
    Animation.RELATIVE_TO_PARENT,  +1.0f, Animation.RELATIVE_TO_PARENT,  0.0f,
    Animation.RELATIVE_TO_PARENT,  0.0f, Animation.RELATIVE_TO_PARENT,   0.0f
    );
    inFromRight.setDuration(duration);
    AccelerateInterpolator ai = new AccelerateInterpolator();//tried 0 and 1.0f as params without success

    inFromRight.setInterpolator(ai); //
    return inFromRight;
}

【问题讨论】:

    标签: android animation interpolation viewflipper


    【解决方案1】:

    尝试使用LinearInterpolator 而不是AccelerateInterpolatorLinearInterpolator 确保您的视图将以恒定的速度移动,而没有任何加速或减速。

    【讨论】:

    • 我*知道这会很简单:)
    猜你喜欢
    • 1970-01-01
    • 2020-01-19
    • 2020-06-07
    • 2019-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-15
    • 1970-01-01
    相关资源
    最近更新 更多