Example usage for com.badlogic.gdx.scenes.scene2d Actor setOrigin

List of usage examples for com.badlogic.gdx.scenes.scene2d Actor setOrigin

Introduction

In this page you can find the example usage for com.badlogic.gdx.scenes.scene2d Actor setOrigin.

Prototype

public void setOrigin(int alignment) 

Source Link

Document

Sets the origin position to the specified Align alignment .

Usage

From source file:es.eucm.ead.editor.view.listeners.VisibleListener.java

License:Open Source License

public VisibleListener(Actor actor) {
    this.actor = actor;
    if (actor instanceof Group) {
        ((Group) actor).setTransform(true);
    }/*from  www.  j  a  v a 2 s.c om*/
    if (actor instanceof Layout) {
        ((Layout) actor).pack();
    }
    actor.setOrigin(Align.center);
}

From source file:es.eucm.ead.editor.view.widgets.MultiWidget.java

License:Open Source License

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();//from www .j  a  v a  2 s. c o m
            }

            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));
            }
        }
    }
}