Search in sources :

Example 1 with VisibleAction

use of com.badlogic.gdx.scenes.scene2d.actions.VisibleAction in project skin-composer by raeleus.

the class RootTable method display.

private void display(final String text) {
    SequenceAction sequenceAction = new SequenceAction();
    if (statusLabel.isVisible()) {
        statusLabel.clearActions();
        AlphaAction alphaAction = new AlphaAction();
        alphaAction.setAlpha(0.0f);
        alphaAction.setDuration(.25f);
        sequenceAction.addAction(alphaAction);
        RunnableAction runnableAction = new RunnableAction();
        runnableAction.setRunnable(() -> {
            statusLabel.setText(text);
        });
        sequenceAction.addAction(runnableAction);
        alphaAction = new AlphaAction();
        alphaAction.setAlpha(1.0f);
        alphaAction.setDuration(.25f);
        sequenceAction.addAction(alphaAction);
        DelayAction delayAction = new DelayAction();
        delayAction.setDuration(3.0f);
        sequenceAction.addAction(delayAction);
        alphaAction = new AlphaAction();
        alphaAction.setAlpha(0.0f);
        alphaAction.setDuration(1.5f);
        sequenceAction.addAction(alphaAction);
        VisibleAction visibleAction = new VisibleAction();
        visibleAction.setVisible(false);
        sequenceAction.addAction(visibleAction);
    } else {
        statusLabel.setText(text);
        statusLabel.clearActions();
        statusLabel.setVisible(true);
        AlphaAction alphaAction = new AlphaAction();
        alphaAction.setAlpha(1.0f);
        alphaAction.setDuration(.5f);
        sequenceAction.addAction(alphaAction);
        DelayAction delayAction = new DelayAction();
        delayAction.setDuration(3.0f);
        sequenceAction.addAction(delayAction);
        alphaAction = new AlphaAction();
        alphaAction.setAlpha(0.0f);
        alphaAction.setDuration(1.5f);
        sequenceAction.addAction(alphaAction);
        VisibleAction visibleAction = new VisibleAction();
        visibleAction.setVisible(false);
        sequenceAction.addAction(visibleAction);
    }
    statusLabel.addAction(sequenceAction);
}
Also used : RunnableAction(com.badlogic.gdx.scenes.scene2d.actions.RunnableAction) DelayAction(com.badlogic.gdx.scenes.scene2d.actions.DelayAction) AlphaAction(com.badlogic.gdx.scenes.scene2d.actions.AlphaAction) SequenceAction(com.badlogic.gdx.scenes.scene2d.actions.SequenceAction) VisibleAction(com.badlogic.gdx.scenes.scene2d.actions.VisibleAction)

Aggregations

AlphaAction (com.badlogic.gdx.scenes.scene2d.actions.AlphaAction)1 DelayAction (com.badlogic.gdx.scenes.scene2d.actions.DelayAction)1 RunnableAction (com.badlogic.gdx.scenes.scene2d.actions.RunnableAction)1 SequenceAction (com.badlogic.gdx.scenes.scene2d.actions.SequenceAction)1 VisibleAction (com.badlogic.gdx.scenes.scene2d.actions.VisibleAction)1