Ejemplo n.º 1
0
  /** resets actor positions after eg. panning */
  private void resetPositions() {
    // reset positions
    Actor actor = getChildren().get(currentElement);
    actor.addAction(
        Actions.parallel(
            Actions.moveTo(0, 0, animationDuration, Interpolation.pow2In),
            Actions.fadeIn(animationDuration)));

    if (currentOffsetX <= 0 && (cycle || hasNextElement())) {
      final Actor next = setupNextElement();
      next.addAction(
          Actions.sequence(
              Actions.parallel(
                  Actions.moveTo(animationXOffset, 0, animationDuration, Interpolation.pow2In),
                  Actions.fadeOut(animationDuration)),
              Actions.visible(false)));
    } else if ((cycle || hasLastElement())) {
      final Actor next = setupLastElement();
      next.addAction(
          Actions.sequence(
              Actions.parallel(
                  Actions.moveTo(-animationXOffset, 0, animationDuration, Interpolation.pow2In),
                  Actions.fadeOut(animationDuration)),
              Actions.visible(false)));
    }
  }
Ejemplo n.º 2
0
  /** cycles to the last element */
  public void last() {
    if (cycle || hasLastElement()) {
      final int nextElement = (currentElement - 1 + getChildren().size) % getChildren().size;
      final Actor next = setupLastElement();
      next.addAction(
          Actions.parallel(
              Actions.moveTo(0, 0, animationDuration, Interpolation.pow2In),
              Actions.fadeIn(animationDuration)));

      final Actor old = getChildren().get(currentElement);
      old.clearActions();
      old.addAction(
          Actions.sequence(
              Actions.parallel(
                  Actions.moveTo(animationXOffset, 0, animationDuration, Interpolation.pow2In),
                  Actions.fadeOut(animationDuration)),
              Actions.visible(false)));

      currentElement = nextElement;

      fireElementChanged();
    } else {
      checkBeforeFirst();
    }
  }
Ejemplo n.º 3
0
 public void swipeOut(boolean direction) {
   final Actor old = getChildren().get(currentElement);
   old.clearActions();
   if (direction) {
     old.addAction(
         Actions.sequence(
             Actions.parallel(
                 Actions.moveTo(animationXOffset, 0, animationDuration, Interpolation.pow2In),
                 Actions.fadeOut(animationDuration)),
             Actions.visible(false)));
   } else {
     old.addAction(
         Actions.sequence(
             Actions.parallel(
                 Actions.moveTo(-animationXOffset, 0, animationDuration, Interpolation.pow2In),
                 Actions.fadeOut(animationDuration)),
             Actions.visible(false)));
   }
 }