Android Curve Motion

时间:2018-01-22 05:36:15

标签: android animation material-design bezier curve

我无法纠正在曲线上移动的工具。在材料设计指南中说,所有动作必须是向下,但使用' ArcMotion '如果元素开始位置在左下角并且结束位置在右上方位置,则向下方向。但是反向动画(右上角的起始位置和左下角的结束位置)曲线具有向上的方向。我通过使用不同的插值器找到了解决方案,例如< fast_out_slow_in'和' fast_out_linear_in',但我认为这不是最佳解决方案。请帮帮我!

Enter/return animation direction

============================更新=============== =============

现在我有两个例子。

首先 - 在视图中移动对象:

    Interpolator slowIn = AnimationUtils.loadInterpolator(this, android.R.interpolator.linear_out_slow_in);
    Interpolator fastOut = AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_linear_in);

    moveX = -view.getWidth();
    transitionY = player.getHeight() / 2;


    ObjectAnimator animationX = ObjectAnimator.ofFloat(view, View.X, moveX);
    animationX.setDuration(duration);
    animationX.setInterpolator(fastOut);

    ObjectAnimator animationY = ObjectAnimator.ofFloat(view, View.TRANSLATION_Y, transitionY);
    animationY.setDuration(duration);
    animationY.setInterpolator(slowIn);

为了“回归动画”,以及“进入动画”这段代码的和平代码'我们只是交换插补器。 第二 - 共享元素转换:

    <transitionSet xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="400">
          <changeBounds/>
          <changeClipBounds/>
          <changeImageTransform/>
          <changeTransform/>

          <arcMotion android:minimumHorizontalAngle="50" android:minimumVerticalAngle="50"/>
</transitionSet>

在这个例子中,我无法控制曲线方向。我不能像下面的例子那样做(交换插补器)。

0 个答案:

没有答案
相关问题