@Test @NeedGL public void shouldParseSpriteView() throws Exception { CocoStudioUIEditor editor = new CocoStudioUIEditor( Gdx.files.internal("animation/MainScene.json"), null, null, null, null); Group group = editor.createGroup(); Image image = group.findActor("st_2"); Array<Action> actions = image.getActions(); assertThat(actions.size, is(1)); RepeatAction repeatAction = (RepeatAction) actions.get(0); ParallelAction parallelAction = (ParallelAction) repeatAction.getAction(); assertThat(parallelAction.getActions().size, is(3)); assertThat(parallelAction.getActions(), (Matcher) everyItem(instanceOf(SequenceAction.class))); SequenceAction moveAction = (SequenceAction) parallelAction.getActions().get(0); SequenceAction scaleAction = (SequenceAction) parallelAction.getActions().get(1); assertThat(moveAction.getActions().size, is(4)); assertThat(moveAction.getActions(), (Matcher) everyItem(instanceOf(MoveToAction.class))); assertThat(scaleAction.getActions().size, is(4)); assertThat(scaleAction.getActions(), (Matcher) everyItem(instanceOf(ScaleToAction.class))); }
private void addBackgroundExtension() { Image stobottom = new Image(new TextureRegion(manager.getAssetsExtension().getTexture(NameFiles.imageArrowBottom))); stobottom.setSize(Gdx.graphics.getWidth() * 0.1f, Gdx.graphics.getWidth() * 0.22f); stobottom.setPosition(Gdx.graphics.getWidth() / 2 - stobottom.getWidth() / 2, Gdx.graphics.getHeight() * 0.74f); Image selectroomtext = new Image(new TextureRegion(manager.getAssetsExtension().getTexture(NameFiles.txtSelectExtension))); selectroomtext.setSize(Gdx.graphics.getWidth() * 0.44f, Gdx.graphics.getHeight() * 0.12f); selectroomtext.setPosition(Gdx.graphics.getWidth() / 2 - selectroomtext.getWidth() / 2, Gdx.graphics.getHeight() * 0.815f); RepeatAction repeatActioan = new RepeatAction(); MoveToAction fadedown = new MoveToAction(); fadedown.setPosition(Gdx.graphics.getWidth() / 2 - stobottom.getWidth() / 2, Gdx.graphics.getHeight() * 0.71f); fadedown.setDuration(0.5f); MoveToAction fadeup = new MoveToAction(); fadeup.setPosition(Gdx.graphics.getWidth() / 2 - stobottom.getWidth() / 2, Gdx.graphics.getHeight() * 0.74f); fadeup.setDuration(1f); repeatActioan.setAction(new SequenceAction(fadedown, fadeup)); repeatActioan.setCount(RepeatAction.FOREVER); stobottom.addAction(repeatActioan); groupBtn = new Group(); groupBtn.addActor(stobottom); groupBtn.addActor(selectroomtext); }
private void move3(Group gr, float procent, float time) { MoveToAction move = new MoveToAction(); move.setDuration(time); if(time==0) { move.setPosition(0, -procent * distanceReference); }else { if(Math.abs(procent)<=0.5) { move.setPosition(0, 0); }else if(procent>0.5){ move.setPosition(p2.x,p2.y); }else{ move.setPosition(p4.x,p4.y); } } gr.addAction(move); }
@Override public void show() { title.setPosition(game.SCREEN_WIDTH / 2 - title.getWidth() / 2, 800); //helpTip.setPosition(400-helpTip.getWidth()/2, 30); MoveToAction actionMove = Actions.action(MoveToAction.class); actionMove.setPosition(game.SCREEN_WIDTH / 2 - title.getWidth() / 2, 380); actionMove.setDuration(1); actionMove.setInterpolation(Interpolation.elasticOut); title.addAction(actionMove); if (!music.isPlaying()) { music = Assets.getManager().get("snd/menu_music.mp3", Music.class); music.play(); } showMenu(true); }
private void showMenu(boolean flag) { MoveToAction actionMove1 = Actions.action(MoveToAction.class);//out actionMove1.setPosition(game.SCREEN_WIDTH / 2, -200); actionMove1.setDuration(1); actionMove1.setInterpolation(Interpolation.swingIn); MoveToAction actionMove2 = Actions.action(MoveToAction.class);//in actionMove2.setPosition(game.SCREEN_WIDTH / 2, 190); actionMove2.setDuration(1f); actionMove2.setInterpolation(Interpolation.swing); if (flag) { table.addAction(actionMove2); options.addAction(actionMove1); } else { options.addAction(actionMove2); table.addAction(actionMove1); } menuShown = flag; exitShown = false; }
private void showExit(boolean flag) { MoveToAction actionMove1 = Actions.action(MoveToAction.class);//out actionMove1.setPosition(game.SCREEN_WIDTH / 2, -200); actionMove1.setDuration(1); actionMove1.setInterpolation(Interpolation.swingIn); MoveToAction actionMove2 = Actions.action(MoveToAction.class);//in actionMove2.setPosition(game.SCREEN_WIDTH / 2, 190); actionMove2.setDuration(1f); actionMove2.setInterpolation(Interpolation.swing); if (flag) { exit.addAction(actionMove2); table.addAction(actionMove1); } else { table.addAction(actionMove2); exit.addAction(actionMove1); } exitShown = flag; }
private void play() { AlphaAction alphaAction = new AlphaAction(); alphaAction.setAlpha(0); alphaAction.setDuration(0.5f); play.addAction(alphaAction); play.setTouchable(Touchable.disabled); MoveToAction moveToAction = new MoveToAction(); moveToAction.setPosition(gameTitle.getX(), HEIGHT * 12 / 13 - gameTitle.getHeight()); moveToAction.setDuration(2); gameTitle.addAction(moveToAction); Timer.instance().clear(); gameTitle.setText("L'Odyssée des Maths"); currentState = State.TRANSITION; }
private void translateup(Group[] arrayGroup) { ScaleToAction scaleToAction = new ScaleToAction(); scaleToAction.setScale(1, 1); scaleToAction.setDuration(0.4f); MoveToAction moveToAction = new MoveToAction(); moveToAction.setPosition(0, 0); moveToAction.setDuration(0.4f); arrayGroup[1].toFront(); arrayGroup[1].addAction(moveToAction); arrayGroup[1].addAction(scaleToAction); ScaleToAction scaleToAction1 = new ScaleToAction(); scaleToAction1.setScale(0.8f, 0.8f); scaleToAction1.setDuration(0.4f); MoveToAction moveToAction1 = new MoveToAction(); moveToAction1.setPosition(Gdx.graphics.getWidth() * 0.1f, Gdx.graphics.getHeight() * 0.28f); moveToAction1.setDuration(0.4f); arrayGroup[0].addAction(scaleToAction1); arrayGroup[0].addAction(moveToAction1); MoveToAction moveToAction2 = new MoveToAction(); moveToAction2.setPosition(Gdx.graphics.getWidth() * 0.1f, -Gdx.graphics.getHeight() * 0.1f); moveToAction2.setDuration(0.4f); arrayGroup[2].addAction(moveToAction2); MoveToAction moveToAction3 = new MoveToAction(); moveToAction3.setPosition(Gdx.graphics.getWidth() * 0.1f, 0); moveToAction3.setDuration(0.4f); arrayGroup[3].addAction(moveToAction3); }
private void translatebottom(Group[] group) { ScaleToAction scaleToAction = new ScaleToAction(); scaleToAction.setScale(1, 1); scaleToAction.setDuration(0.4f); MoveToAction moveToAction = new MoveToAction(); moveToAction.setPosition(0, 0); moveToAction.setDuration(0.4f); group[3].toFront(); group[3].addAction(moveToAction); group[3].addAction(scaleToAction); ScaleToAction scaleToAction1 = new ScaleToAction(); scaleToAction1.setScale(0.8f, 0.8f); scaleToAction1.setDuration(0.4f); MoveToAction moveToAction1 = new MoveToAction(); moveToAction1.setPosition(Gdx.graphics.getWidth() * 0.1f, -Gdx.graphics.getHeight() * 0.1f); moveToAction1.setDuration(0.4f); group[0].addAction(moveToAction1); group[0].addAction(scaleToAction1); MoveToAction moveToAction2 = new MoveToAction(); moveToAction2.setPosition(Gdx.graphics.getWidth() * 0.1f, Gdx.graphics.getHeight() * 0.28f); moveToAction2.setDuration(0.4f); group[2].addAction(moveToAction2); MoveToAction moveToAction3 = new MoveToAction(); moveToAction3.setPosition(Gdx.graphics.getWidth() * 0.1f, 0); moveToAction3.setDuration(0.4f); group[1].addAction(moveToAction3); }
public Group createPuls(float x, float y){ grPuls = new Group(); Texture txt = managerAssets.getAssetsTutorial().getTexture(NameFiles.circlePulsTutorial); Image image = new Image(new TextureRegion(txt)); Vector2 crop = Scaling.fit.apply(txt.getWidth(),txt.getHeight(),WIDTH,HEIGHT); image.setSize(crop.x * 0.135f, crop.y * 0.135f); image.setPosition(x, y); grPuls.addActor(image); txt = managerAssets.getAssetsTutorial().getTexture(NameFiles.PulsCircleScalable); Image puls = new Image(new TextureRegion(txt)); crop = Scaling.fit.apply(txt.getWidth(),txt.getHeight(),WIDTH,HEIGHT); puls.setPosition(image.getRight() - image.getWidth() / 2, image.getTop() - image.getHeight() / 2); puls.setSize(1, 1); MoveToAction move = new MoveToAction(); move.setDuration(1); move.setPosition(image.getRight() - image.getWidth() / 2 - crop.x*0.085f, image.getTop() - image.getHeight() / 2 - crop.y*0.085f); MoveToAction mo = new MoveToAction(); mo.setDuration(0); mo.setPosition(image.getRight() - image.getWidth() / 2, image.getTop() - image.getHeight() / 2); ScaleToAction scale = new ScaleToAction(); scale.setScale(WIDTH*0.17f); scale.setDuration(1); ScaleToAction sc = new ScaleToAction(); sc.setDuration(0); sc.setScale(0); RepeatAction repeat = new RepeatAction(); repeat.setCount(RepeatAction.FOREVER); repeat.setAction(new SequenceAction(scale, sc)); puls.addAction(repeat); RepeatAction r = new RepeatAction(); r.setCount(RepeatAction.FOREVER); r.setAction(new SequenceAction(move, mo)); puls.addAction(r); grPuls.addActor(puls); return grPuls; }
public void FadeIn(){ gr.clearActions(); MoveToAction in = new MoveToAction(); in.setPosition(0.0f, 0.0f); in.setDuration(2f); gr.addAction(in); }
private void move0(Group gr, float procent, float time) { MoveToAction move = new MoveToAction(); move.setDuration(time); ScaleToAction scale = new ScaleToAction(); scale.setDuration(time); if(time == 0) { gr.clearActions(); gr.clearActions(); if (procent < 0) { scale.setScale(0.5f + (Math.abs(procent) * 0.3f)); move.setPosition(p0.x + procent * d01.x, p0.y + (1 - (procent * d01.y))); addfirst(); }else{ scale.setScale(0.5f); move.setPosition(p0.x,p0.y); } }else{ if(Math.abs(procent)<=0.5){ scale.setScale(0.5f); move.setPosition(p0.x,p0.y); }else if(procent < -0.5) { scale.setScale(0.8f); move.setPosition(p1.x, p1.y); addfirst(); }else{ scale.setScale(0.5f); move.setPosition(p0.x,p0.y); } } gr.addAction(scale); gr.addAction(move); }
private void move1(Group gr, float procent, float time) { MoveToAction move = new MoveToAction(); move.setDuration(time); ScaleToAction scale = new ScaleToAction(); scale.setDuration(time); if(time == 0) { gr.clearActions(); gr.clearActions(); if (procent > 0) { scale.setScale(0.8f - (Math.abs(procent) * 0.3f)); move.setPosition(p1.x + (procent * d01.x), p1.y + (1 - (procent * d01.y))); } else { scale.setScale(0.8f + (Math.abs(procent) * 0.2f)); move.setPosition(p1.x + (procent * d12.x), p1.y + (1 - (procent * d12.y))); } }else{ if(Math.abs(procent)<=0.5){ scale.setScale(0.8f); move.setPosition(p1.x,p1.y); }else if(procent > 0.5){ scale.setScale(0.5f); move.setPosition(p0.x, p0.y); }else{ scale.setScale(1); move.setPosition(p2.x,p2.y); } } gr.addAction(scale); gr.addAction(move); }
private void move2(Group gr, float procent, float time) { MoveToAction move = new MoveToAction(); move.setDuration(time); ScaleToAction scale = new ScaleToAction(); scale.setDuration(time); if(time == 0) { if (procent > 0) { scale.setScale(1 - (Math.abs(procent) * 0.2f)); move.setPosition(p2.x + procent * d12.x, p2.y + (1 - (procent * d12.y))); } else { scale.setScale(1); move.setPosition(0, p2.y - procent * distanceReference); } }else{ if(Math.abs(procent)<=0.5){ scale.setScale(1); move.setPosition(p2.x,p2.y); }else if(procent>0.5){ scale.setScale(0.8f); move.setPosition(p1.x,p1.y); }else{ scale.setScale(1); move.setPosition(0,0); } } gr.addAction(scale); gr.addAction(move); }
private void move4(Group gr, float procent, float time) { MoveToAction move = new MoveToAction(); move.setDuration(time); ScaleToAction scale = new ScaleToAction(); scale.setDuration(time); if (time ==0) { if (procent > 0) { scale.setScale(1); move.setPosition(0, p4.y - procent * distanceReference); } else { scale.setScale(1 - (Math.abs(procent) * 0.2f)); move.setPosition(p4.x - procent * d45.x, p4.y + (1 - (procent * d45.y))); } }else{ if(Math.abs(procent)<=0.5){ scale.setScale(1); move.setPosition(p4.x,p4.y); }else if(procent>=0.5){ scale.setScale(1); move.setPosition(0,0); }else{ scale.setScale(0.8f); move.setPosition(p5.x,p5.y); } } gr.addAction(scale); gr.addAction(move); }
private void move5(Group gr, float procent, float time) { MoveToAction move = new MoveToAction(); move.setDuration(time); ScaleToAction scale = new ScaleToAction(); scale.setDuration(time); if(time == 0) { gr.clearActions(); gr.clearActions(); if (procent > 0) { scale.setScale(0.8f + (Math.abs(procent) * 0.2f)); move.setPosition(p5.x - (procent * d45.x), p5.y + (1 - (procent * d45.y))); } else { scale.setScale(0.8f - (Math.abs(procent) * 0.3f)); move.setPosition(p5.x - (procent * d56.x),p5.y + (1-(procent*d56.y))); } }else{ if(Math.abs(procent)<=0.5){ scale.setScale(0.8f); move.setPosition(p5.x,p5.y); }else if(procent > 0.5){ scale.setScale(1); move.setPosition(p4.x, p4.y); }else{ scale.setScale(0.5f); move.setPosition(p6.x,p6.y); } } gr.addAction(scale); gr.addAction(move); }
private void move6(Group gr, float procent, float time) { MoveToAction move = new MoveToAction(); move.setDuration(time); ScaleToAction scale = new ScaleToAction(); scale.setDuration(time); if(time == 0) { gr.clearActions(); gr.clearActions(); if (procent > 0) { scale.setScale(0.5f + (Math.abs(procent) * 0.3f)); move.setPosition(p6.x - procent * d56.x, p6.y + (1 - (procent * d56.y))); addlast(); }else{ scale.setScale(0.5f); move.setPosition(p6.x,p6.y); } }else{ if(Math.abs(procent)<=0.5){ scale.setScale(0.5f); move.setPosition(p6.x,p6.y); }else if(procent > 0.5) { scale.setScale(0.8f); move.setPosition(p5.x, p5.y); addlast(); }else{ scale.setScale(0.5f); move.setPosition(p6.x,p6.y); } } gr.addAction(scale); gr.addAction(move); }
private void addlast() { if(arrayAttachers.length>7) { arrayAttachers[7].setVisible(true); arrayAttachers[7].toBack(); MoveToAction move = new MoveToAction(); move.setDuration(0); move.setPosition(p6.x, p6.y); arrayAttachers[7].addAction(move); ScaleToAction scale = new ScaleToAction(); scale.setDuration(0); scale.setScale(0.5f); arrayAttachers[7].addAction(scale); } }
private void addfirst() { if(arrayAttachers.length>7) { arrayAttachers[arrayAttachers.length - 1].setVisible(true); arrayAttachers[arrayAttachers.length - 1].toBack(); MoveToAction move = new MoveToAction(); move.setDuration(0); move.setPosition(p0.x, p0.y); arrayAttachers[arrayAttachers.length - 1].addAction(move); ScaleToAction scale = new ScaleToAction(); scale.setDuration(0); scale.setScale(0.5f); arrayAttachers[arrayAttachers.length - 1].addAction(scale); } }
public ScreenLoading(GameManager game) { gameManager = game; assets = ManagerAssets.getInstance(); MoveToAction mred = new MoveToAction(); mred.setPosition(Width , -Height); mred.setDuration(2f); MoveToAction mred1 = new MoveToAction(); mred1.setPosition(-Width , Height); mred1.setDuration(0); translatered = new RepeatAction(); translatered.setCount(RepeatAction.FOREVER); translatered.setAction(new SequenceAction(new DelayAction(0.0f), mred,mred1, new DelayAction(4.0f))); MoveToAction mgreen = new MoveToAction(); mgreen.setPosition(Width , -Height ); mgreen.setDuration(2f); MoveToAction mgreen1 = new MoveToAction(); mgreen1.setPosition(-Width , Height); mgreen1.setDuration(0); translategreen = new RepeatAction(); translategreen.setCount(RepeatAction.FOREVER); translategreen.setAction(new SequenceAction(new DelayAction(2.0f), mgreen,mgreen1, new DelayAction(4.0f))); MoveToAction mblue = new MoveToAction(); mblue.setPosition(Width , -Height); mblue.setDuration(2f); MoveToAction mblue1 = new MoveToAction(); mblue1.setPosition(-Width , Height); mblue1.setDuration(0); translateblue = new RepeatAction(); translateblue.setCount(RepeatAction.FOREVER); translateblue.setAction(new SequenceAction(new DelayAction(4.0f), mblue,mblue1,new DelayAction(4.0f))); }
private void addlast() { if(arrayDefenders.length>7) { arrayDefenders[7].setVisible(true); arrayDefenders[7].toBack(); MoveToAction move = new MoveToAction(); move.setDuration(0); move.setPosition(p6.x, p6.y); arrayDefenders[7].addAction(move); ScaleToAction scale = new ScaleToAction(); scale.setDuration(0); scale.setScale(0.5f); arrayDefenders[7].addAction(scale); } }
private void addfirst() { if(arrayDefenders.length>7) { arrayDefenders[arrayDefenders.length - 1].setVisible(true); arrayDefenders[arrayDefenders.length - 1].toBack(); MoveToAction move = new MoveToAction(); move.setDuration(0); move.setPosition(p0.x, p0.y); arrayDefenders[arrayDefenders.length - 1].addAction(move); ScaleToAction scale = new ScaleToAction(); scale.setDuration(0); scale.setScale(0.5f); arrayDefenders[arrayDefenders.length - 1].addAction(scale); } }
public Action getDrawAnimation(){ MoveToAction action = new MoveToAction(); action.setPosition(deckXPositions[logic.getDraw()], cardCenterY); action.setDuration(1); action.setInterpolation(Interpolation.exp5); return action; }
public Action getRemoveAnimation(){ MoveToAction action = new MoveToAction(); action.setPosition(removeXPositions[logic.getCurrentHighestPlayer()], removeYPositions[logic.getCurrentHighestPlayer()]); action.setDuration(1); action.setInterpolation(Interpolation.exp5); return action; }
public void rocketEngineAnimation(){ MoveToAction action = Actions.action(MoveToAction.class); action.setPosition(game.rocket.getX(), 60); action.setInterpolation(Interpolation.swingIn); action.setDuration(0.8f); game.rocket.addAction(action); }
public void rocketCrashAnimation() { MoveToAction action = Actions.action(MoveToAction.class); action.setPosition(420, 0); action.setDuration(1f); game.rocket.addAction(action); RotateToAction action2 = Actions.action(RotateToAction.class); action2.setRotation(-180f); action2.setDuration(1f); game.rocket.addAction(action2); }
public void rocketPlatformOnAnimation(){ MoveToAction action = Actions.action(MoveToAction.class); action.setPosition(-100, 100); action.setDuration(1f); game.platform.addAction(action); AlphaAction action6 = Actions.action(AlphaAction.class); // action6.setRotation(90f); action6.setColor(Color.CLEAR); action6.setDuration(1f); game.platform.addAction(action6); }
/** * Action move to. * * @param x the x * @param y the y * @param duration the duration */ public void actionMoveTo(float x, float y, float duration) { // Move to a specific position by time MoveToAction action = new MoveToAction(); action.setPosition(x, y); if (duration > 0) { action.setDuration(duration); } addAction(action); }
public void showMessage(String text, float time, final GameState gameState) { Gdx.app.debug(Constants.LOG, "Show Message !"); if (message == null) { message = new Label(text, game.getResourcesManager().getStyles().skin, "header", Color.ORANGE); container = new Stack(); container.add(message); container.setPosition(Gdx.graphics.getWidth() / 2- container.getWidth() / 2, Gdx.graphics.getHeight() + container.getHeight()); container.setVisible(false); stage.addActor(container); } else if (!container.isVisible()) { message.setText(text); container.pack(); MoveToAction action = Actions.action(MoveToAction.class); action.setPosition(Gdx.graphics.getWidth() / 2 - container.getWidth() / 2, Gdx.graphics.getHeight() / 2 - container.getHeight() / 2); action.setDuration(time); action.setInterpolation(Interpolation.bounceIn); container.addAction(Actions.sequence(action, Actions.delay(1f), Actions.run(new Runnable() { public void run() { Gdx.app.log(Constants.LOG, "Show Message Actions complete!"); DreamsGame.setGameState(gameState); container.setVisible(false); } }) )); container.setVisible(true); } }
public void Fadeout(){ MoveToAction out = new MoveToAction(); out.setPosition(0.0f, Gdx.graphics.getHeight() * 0.1f); out.setDuration(2f); gr.addAction(new SequenceAction(new DelayAction(7f), out)); }
private MoveToAction addMove(float x,float y){ MoveToAction move = new MoveToAction(); move.setPosition(x, y); move.setDuration(0.5f); return move; }
private void moveupDescribe(float x){ MoveToAction move = new MoveToAction(); move.setPosition(0, Gdx.graphics.getHeight() * x); move.setDuration(0.5f); groupDescribeEnklave.addAction(move); }
private void moveDownDescribe(){ MoveToAction move = new MoveToAction(); move.setPosition(0,0); move.setDuration(0.5f); groupDescribeEnklave.addAction(move); }