Exemplo n.º 1
0
  public void setSelectedWidget(int index) {
    if (widgets.size > index) {
      Actor newBar = widgets.get(index);

      if (newBar != toShow) {
        Color color = colors.get(index);
        setColor(color == null ? style.color : color);

        for (Actor widget : widgets) {
          widget.clearActions();
        }

        Actor current = getActor();
        if (current != null) {
          current.setTouchable(Touchable.disabled);
        } else {
          current = toShow;
        }

        toShow = newBar;

        Actor toHide = current;
        toHide.setOrigin(Align.center);

        if (toShow.getScaleY() == 1) {
          toShow.setScaleY(0);
          toShow.setOriginY(toHide.getOriginY());
          toShow.getColor().a = 0;
        }

        float timeHide = ANIM_TIME * Math.abs(toHide.getScaleY());

        Action actionShow = Actions.run(actionAddActor);
        Action actionHide =
            Actions.parallel(
                Actions.scaleTo(1, 0, timeHide, Interpolation.sineOut), Actions.fadeOut(timeHide));

        if (newBar == current) {
          toHide.addAction(actionShow);
        } else {
          toHide.addAction(Actions.sequence(actionHide, actionShow));
        }
      }
    }
  }
Exemplo n.º 2
0
 /** Adds the specified scale to the current scale. */
 public void scale(float scaleX, float scaleY) {
   setScaleX(this.scaleX + scaleX);
   setScaleY(this.scaleY + scaleY);
 }
Exemplo n.º 3
0
 /** Adds the specified scale to the current scale. */
 public void scale(float scale) {
   setScaleX(scaleX + scale);
   setScaleY(scaleY + scale);
 }
Exemplo n.º 4
0
 /** Sets the scalex and scaley. */
 public void setScale(float scaleX, float scaleY) {
   setScaleX(scaleX);
   setScaleY(scaleY);
 }