List of usage examples for com.badlogic.gdx.scenes.scene2d.actions RunnableAction setRunnable
public void setRunnable(Runnable runnable)
From source file:com.ray3k.skincomposer.dialog.DialogLoading.java
License:Open Source License
@Override public Dialog show(Stage stage) { Dialog dialog = super.show(stage); RunnableAction runnableAction = new RunnableAction(); runnableAction.setRunnable(() -> { if (runnable != null) { runnable.run();/*from www. j a v a 2s . c om*/ } hide(); }); Action action = new SequenceAction(new DelayAction(.5f), runnableAction); addAction(action); return dialog; }
From source file:com.ray3k.skincomposer.RootTable.java
License:Open Source License
private void display(final String text) { SequenceAction sequenceAction = new SequenceAction(); if (statusLabel.isVisible()) { statusLabel.clearActions();/*from w w w .j a va2 s . c o m*/ 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); }
From source file:de.longri.cachebox3.gui.animations.actor_animations.GestureHelpAnimation.java
License:Open Source License
public GestureHelpAnimation(final Vector2 start, final Vector2 end) { // create finger actor final Image finger = new Image(CB.getSprite("finger")); final Image fingerClick = new Image(CB.getSprite("finger_click")); //set start and end to finger of hand float fingerY = finger.getHeight() * 0.7f; float fingerX = finger.getWidth() * 0.2f; start.y -= fingerY;/*from w ww . j av a 2 s. c om*/ start.x += fingerX; end.y -= fingerY; end.x += fingerX; finger.addAction(Actions.moveTo(start.x, start.y)); fingerClick.addAction(Actions.moveTo(start.x, start.y)); this.addAction(new AddActorAction(finger)); this.addAction(Actions.delay(0.7f)); this.addAction(Actions.removeActor(finger)); this.addAction(new AddActorAction(fingerClick)); RunnableAction runnableAction = new RunnableAction(); runnableAction.setRunnable(new Runnable() { @Override public void run() { RunnableAction runnableAction = new RunnableAction(); runnableAction.setRunnable(new Runnable() { @Override public void run() { fingerClick.addAction(Actions.sequence(Actions.delay(0.7f), Actions.removeActor())); } }); Action action = Actions.sequence(Actions.moveTo(end.x, end.y, 1.0f, Interpolation.pow2), runnableAction); fingerClick.addAction(action); finger.addAction(Actions.moveTo(end.x, end.y)); } }); this.addAction(runnableAction); }