/** Adds an action to the root of the stage. * @see Group#addAction(Action) */ public void addAction (Action action) { root.addAction(action); }
/** Adds an action to the root of the stage. * @see Group#addAction(Action) */ public void addAction (Action action) { root.addAction(action); }
@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)))); }
/** Adds an action to the root of the stage. * @see Group#addAction(Action) */ public void addAction (Action action) { root.addAction(action); }
public void start(String id) { idList.add(id); sprite.clearActions(); sprite.addAction(Actions.fadeIn(.3f)); }
public void act() { //更新资源 updated = Res.act(); if(sprite.getActions().size == 0){ if(updated && idList.isEmpty() && sprite.getColor().a == 1f) sprite.addAction(Actions.fadeOut(.3f)); if((!updated || !idList.isEmpty()) && sprite.getColor().a == 0) sprite.addAction(Actions.fadeIn(.3f)); } String currentFPS = Gdx.graphics.getFramesPerSecond() + ""; boolean showFPS = Game.setting.showFPS; fps.text(showFPS ? currentFPS : ""); fpsShadow.text(showFPS ? currentFPS : ""); }
@Override public void onDragFinished() { eventDispatcher.postEvent(new FileDragDropEvent(FileDragDropEvent.Action.STOP_DRAGGING)); overlayRoot.clearActions(); overlayRoot.addAction(Actions.sequence( Actions.fadeOut(0.35f), Actions.visible(false) )); }
@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) ) )); }
public void skip() { if(skiping) return; skiping = true; seManager.stop(); Image mask = UI.base(); mask.query().fillParent().color(Color.BLACK).fadeOut().action(Actions.sequence(Actions.fadeIn(.5f), Actions.run(() -> { //所有stages已经播放完毕 if(currentStage + 1 == stages.size()){ Views.addView(TitleView.class); remove(); return; } skiping = false; group.clear(); group.addAction(stages.get(++currentStage)); mask.addAction(Actions.sequence(Actions.fadeOut(.5f), Actions.removeActor())); }))).to(stage); }
group.addAction(Actions.delay(.7f, Actions.run(() -> { GdxQuery point = Res.sync(Path.IMAGE_LOGO + "p_1.png").query().to(group).zIndex(2).position(Game.STAGE_WIDTH / 2, Game.STAGE_HEIGHT / 2); ))); seManager.play(Path.MUSIC_SE + "se_1.mp3"); group.addAction(Actions.delay(1.5f, Actions.run(() -> { for(int i = 0; i < pointsCount; i ++){ boolean left = MathUtils.randomBoolean(), top = MathUtils.randomBoolean(); group.addAction(Actions.delay(2f, Actions.run(() -> { seManager.play(Path.MUSIC_SE + "logo.mp3"); }))); group.addAction(Actions.delay(4.8f, Actions.run(() -> point.action(Actions.scaleTo(1, 1, .3f, Interpolation.bounceOut))))); group.addAction(Actions.delay(5.4f, Actions.run(() -> { point.action(Actions.sequence(Actions.moveBy(-77, 0, .5f, Interpolation.pow2Out), Actions.delay(.7f), Actions.fadeOut(.3f))); group.addAction(Actions.delay(.7f, Actions.run(() -> { group.addAction(Actions.delay(1.6f, Actions.run(() -> { Res.sync(Path.IMAGE_LOGO + "bottom.png").query().nearest().fadeOut().position(Game.STAGE_WIDTH / 2, -100).center(true).action(Actions.fadeIn(.5f)).action(Actions.moveBy(0, 150, .5f, Interpolation.pow2Out)).to(group); }))); group.addAction(Actions.delay(.3f, Actions.run(() -> { Res.sync(Path.IMAGE_LOGO + "circle.png").query().color("d9bc64").position(Game.STAGE_WIDTH / 2 - 77, Game.STAGE_HEIGHT / 2).center(true).scale(0).action(Actions.scaleTo(30, 30, .8f, Interpolation.pow4In)).to(group).zIndex(1); Res.sync(Path.IMAGE_LOGO + "circle.png").query().color("22ac38").position(Game.STAGE_WIDTH / 2 - 77, Game.STAGE_HEIGHT / 2).center(true).scale(0).action(Actions.delay(.4f, Actions.scaleTo(30, 30, .8f, Interpolation.pow4In))).to(group).zIndex(2); Res.get(Path.IMAGE_LOGO + "bg2.png").query().size(Game.STAGE_WIDTH, Game.STAGE_HEIGHT).fadeOut().fadeIn(.5f).to(group); Res.get(Path.IMAGE_LOGO + "hv.png").query().position(400, 50).fadeOut().action(Actions.delay(.5f, Actions.fadeIn(.5f))).to(group);
engineLabelRotated.addActor(engineLabel); float engineLabelH = enginePowerH - enginePlus.getHeight() - engineMinus.getHeight() - 2; engineLabelRotated.addAction(Actions.rotateBy(-90)); engineLabelRotated.addAction(Actions.moveBy(-5, (((engineLabelH - enginePlus.getHeight()) - engineLabel.getWidth()) / 2f + engineLabel.getWidth()))); engineLabelRotated.setHeight(engineLabelH);