示例#1
0
  private void startAnimation() {
    oldAction.flipHorizontally();
    currentAction.flipHorizontally();

    transformActions();

    animatedAction.setLineSegments(currentAction.getLineSegments());
    final ObjectAnimator animator =
        ObjectAnimator.ofFloat(ActionView.this, "animationProgress", 0f, 1f);
    animator.setInterpolator(BakedBezierInterpolator.getInstance());
    animator.setDuration(animationDuration).start();
  }
示例#2
0
  private void setAction(Action action, boolean animate, int rotation) {
    if (action == null) {
      return;
    }

    this.rotation = rotation;
    if (currentAction == null) {
      currentAction = action;
      currentAction.flipHorizontally();
      animationProgress = 1f;
      UiHelper.postInvalidateOnAnimation(this);
      return;
    }

    if (currentAction.getClass().equals(action.getClass())) {
      return;
    }

    oldAction = currentAction;
    currentAction = action;

    if (animate) {
      animationProgress = 0f;
      if (ready) {
        startAnimation();
      } else {
        animateWhenReady = true;
      }
    } else {
      animationProgress = 1f;
      UiHelper.postInvalidateOnAnimation(this);
    }
  }