protected void onHide (Actor selectBoxList) { selectBoxList.getColor().a = 1; selectBoxList.addAction(sequence(fadeOut(0.15f, Interpolation.fade), removeActor())); }
/** Centers the dialog in the stage and calls {@link #show(Stage, Action)} with a {@link Actions#fadeIn(float, Interpolation)} * action. */ public Dialog show (Stage stage) { show(stage, sequence(Actions.alpha(0), Actions.fadeIn(0.4f, Interpolation.fade))); setPosition(Math.round((stage.getWidth() - getWidth()) / 2), Math.round((stage.getHeight() - getHeight()) / 2)); return this; }
/** Called when tooltip is hidden. Default implementation sets actions to animate hiding and to remove the actor from the stage * when the actions are complete. A subclass must at least remove the actor. */ protected void hideAction (Tooltip tooltip) { tooltip.container .addAction(sequence(parallel(alpha(0.2f, 0.2f, fade), scaleTo(0.05f, 0.05f, 0.2f, Interpolation.fade)), removeActor())); }
myactor.addAction(rotateBy(90f, 1f, swing)); break; Gdx.app.log(TAG, "MoveTo Action"); myactor.clearActions(); myactor.addAction(moveTo(myactor.getX() + 0.3f, myactor.getY() + 0.3f, 1f)); break; Gdx.app.log(TAG, "FadeOut Action"); myactor.clearActions(); myactor.addAction(fadeOut(2f)); break; Gdx.app.log(TAG, "FadeIn Action"); myactor.clearActions(); myactor.addAction(fadeIn(2f)); break; Gdx.app.log(TAG, "Color Action"); myactor.clearActions(); myactor.addAction(color(Color.RED, 2f)); break; Gdx.app.log(TAG, "Scale Action"); myactor.clearActions(); myactor.addAction(scaleTo(2f, 2f, 2f)); break; Gdx.app.log(TAG, "Size Action");
final Action[] sequence = new Action[nbActions]; if (0 < delay) sequence[index++] = Actions.delay(delay); final TextCellFactory.Glyph glyph = glyph(shown, startColor, startX, startY); sequence[index++] = Actions.parallel( new TemporalAction(duration) { @Override Actions.moveTo(worldX(endX), worldY(endY), duration)); if(postRunnable != null) sequence[index++] = Actions.run(postRunnable); sequence[index] = Actions.run(new Runnable() { @Override public void run() { glyph.addAction(Actions.sequence(sequence));
/** * Scale effect, Back To Normal, Fade Out (SC, BTN, FO) * */ public static void create_SC_BTN_FO(Actor actor, float scaleRatioX, float scaleRatioY, float duration, float delayBeforeFadeOut, final Group group, final boolean removeActor) { if (actor != null) { actor.addAction(Actions.sequence( Actions.scaleTo(scaleRatioX, scaleRatioY, duration), Actions.scaleTo(1, 1, duration), Actions.delay(delayBeforeFadeOut), Actions.fadeOut(duration), new Action() { @Override public boolean act(float delta) { if (removeActor) { removeActor(group, actor); return false; } else { return true; } } })); } }
@Override public void create () { stage = new Stage(); Action complexAction = forever(sequence(parallel(rotateBy(180, 2), scaleTo(1.4f, 1.4f, 2), alpha(0.7f, 2)), parallel(rotateBy(180, 2), scaleTo(1.0f, 1.0f, 2), alpha(1.0f, 2)))); texture = new Texture(Gdx.files.internal("data/badlogic.jpg"), false); texture.setFilter(TextureFilter.Linear, TextureFilter.Linear); final Image img1 = new Image(new TextureRegion(texture)); img1.setSize(100, 100); img1.setOrigin(50, 50); img1.setPosition(50, 50); final Image img2 = new Image(new TextureRegion(texture)); img2.setSize(50, 50); img2.setOrigin(50, 50); img2.setPosition(150, 150); stage.addActor(img1); stage.addActor(img2); img1.addAction(complexAction); // img2.action(complexAction.copy()); }
@Override public void create () { texture = new Texture(Gdx.files.internal("data/badlogicsmall.jpg")); stage = new Stage(); for (int i = 0; i < 100; i++) { Image img = new Image(new TextureRegion(texture)); img.setX((float)Math.random() * 480); img.setY((float)Math.random() * 320); img.getColor().a = (float)Math.random() * 0.5f + 0.5f; stage.addActor(img); } stage.getRoot().addAction(forever(sequence(fadeOut(3), fadeIn(3)))); }
@Override public void onDragStarted(int screenX, int screenY) { eventDispatcher.postEvent(new FileDragDropEvent(FileDragDropEvent.Action.START_DRAGGING)); overlayRoot.clearActions(); overlayRoot.addAction(Actions.sequence( Actions.scaleTo(1.5f, 1.5f), Actions.visible(true), Actions.parallel( Actions.fadeIn(0.5f, Interpolation.pow5Out), Actions.scaleTo(1f, 1f, 0.5f, Interpolation.pow5Out) ) )); }
/** Called when tooltip is shown. Default implementation sets actions to animate showing. */ protected void showAction (Tooltip tooltip) { float actionTime = animations ? (time > 0 ? 0.5f : 0.15f) : 0.1f; tooltip.container.setTransform(true); tooltip.container.getColor().a = 0.2f; tooltip.container.setScale(0.05f); tooltip.container.addAction(parallel(fadeIn(actionTime, fade), scaleTo(1, 1, actionTime, Interpolation.fade))); }
@Override public void run() { final ColorChangeImage gi = textFactory.makeGlyphImage(glyph, scc.gradient(startColor, endColor, (int) (dur * 40)), dur * 1.1f, doubleWidth); gi.setPosition(adjustX(startX, doubleWidth), adjustY(startY)); gi.setRotation(startRotation); autoActors.add(gi); sequence[0] = Actions.parallel( Actions.moveTo(adjustX(endX, doubleWidth), adjustY(endY), dur), Actions.rotateTo(endRotation, dur)); sequence[1] = Actions.run(new Runnable() { @Override public void run() { recallActor(gi, false); } }); gi.addAction(Actions.sequence(sequence)); } })));
@Override public void show() { viewport = new FitViewport(640, 480); stage = new Stage(viewport, batch); font = new BitmapFont(Gdx.files.internal("fonts/foo.fnt")); Label.LabelStyle labelStyle = new Label.LabelStyle(font, Color.WHITE); Label gameOverLabel = new Label("Game Over", labelStyle); gameOverLabel.setPosition((640 - gameOverLabel.getWidth()) / 2, 226f); GameManager.getInstance().playMusic("GameOver.ogg", false); stage.addActor(gameOverLabel); stage.addAction(Actions.sequence( Actions.delay(1f), Actions.fadeOut(2f), Actions.run(new Runnable() { @Override public void run() { game.setScreen(new MainMenuScreen(game)); } }))); }
/** Removes the dialog from the stage, restoring the previous keyboard and scroll focus, and adds the specified action to the * dialog. * @param action If null, the dialog is removed immediately. Otherwise, the dialog is removed when the action completes. The * dialog will not respond to touch down events during the action. */ public void hide (Action action) { Stage stage = getStage(); if (stage != null) { removeListener(focusListener); if (previousKeyboardFocus != null && previousKeyboardFocus.getStage() == null) previousKeyboardFocus = null; Actor actor = stage.getKeyboardFocus(); if (actor == null || actor.isDescendantOf(this)) stage.setKeyboardFocus(previousKeyboardFocus); if (previousScrollFocus != null && previousScrollFocus.getStage() == null) previousScrollFocus = null; actor = stage.getScrollFocus(); if (actor == null || actor.isDescendantOf(this)) stage.setScrollFocus(previousScrollFocus); } if (action != null) { addCaptureListener(ignoreTouchDown); addAction(sequence(action, Actions.removeListener(ignoreTouchDown, true), Actions.removeActor())); } else remove(); }
/** * Hides the dialog. Called automatically when a button is clicked. The default implementation fades out the dialog over 400 * milliseconds and then removes it from the stage. */ public void hide () { hide(sequence(Actions.fadeOut(FADE_TIME, Interpolation.fade), Actions.removeListener(ignoreTouchDown, true), Actions.removeActor())); }
public void animateHighlight() { if (highlightAction != null) { imgHighlight.removeAction(highlightAction); highlightAction = null; } imgHighlight.addAction(highlightAction = Actions.sequence( Actions.alpha(1f), Actions.visible(true), Actions.fadeOut(5f, Interpolation.pow3Out), Actions.visible(false) )); }
/** @param hidingAction will be attached to the mimic actor. */ protected void addMimicHidingAction (final Action hidingAction, final float delay) { mimic.addAction(Actions.sequence(hidingAction, Actions.removeActor())); mimic.getActor().addAction(Actions.delay(delay, Actions.visible(true))); }
/** * Fade In (FI) * */ public static void create_FI(Actor actor, float duration, float delay, final Group group, final boolean removeActor) { if (actor != null) { actor.addAction(Actions.sequence(Actions.delay(delay), Actions.fadeIn(duration), new Action() { @Override public boolean act(float delta) { if (removeActor) { removeActor(group, actor); return false; } else { return true; } } })); } }
@Override public void event (String event) { System.out.println("Event: " + event); labelEvent.restart("{FASTER}{COLOR=GRAY}Event:{WAIT=0.1}{COLOR=LIME} " + event); labelEvent.clearActions(); // @off labelEvent.addAction( sequence( visible(true), alpha(0), alpha(1, 0.25f, Interpolation.pow2In), delay(0.5f), alpha(0, 2f, Interpolation.pow2) ) ); // @on }