Permalink
Browse files

Principio para hacer fadeIn y fadeOut a la interface

  • Loading branch information...
1 parent fce21ca commit e4c401a94aea5aab41ce6ecd21f14df5044f3823 @Luraguse Luraguse committed Feb 9, 2013
@@ -14,6 +14,9 @@
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Stage;
+import com.badlogic.gdx.scenes.scene2d.actions.Actions;
+import com.badlogic.gdx.scenes.scene2d.actions.AlphaAction;
+import com.badlogic.gdx.scenes.scene2d.actions.SequenceAction;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.XmlReader;
import com.badlogic.gdx.utils.XmlReader.Element;
@@ -461,10 +464,18 @@ public void toggleUI() {
Actor actor = actores.get(i);
if (actor.getClass().getSimpleName().contains("Boton")
|| actor.getClass().getSimpleName().contains("Barra")) {
- if (actor.isVisible())
- actor.setVisible(false);
- else
- actor.setVisible(true);
+ if (actor.isVisible()) {
+ SequenceAction sequence = new SequenceAction();
+ sequence.addAction(Actions.fadeOut(0.30f));
+ sequence.addAction(Actions.delay(0.30f));
+ sequence.addAction(Actions.hide());
+ actor.addAction(sequence);
+ } else {
+ SequenceAction sequence = new SequenceAction();
+ sequence.addAction(Actions.show());
+ sequence.addAction(Actions.fadeIn(0.30f));
+ actor.addAction(sequence);
+ }
}
}
}
@@ -476,7 +487,18 @@ public void esconderUI(boolean setVisible) {
Actor actor = actores.get(i);
if (actor.getClass().getSimpleName().contains("Boton")
|| actor.getClass().getSimpleName().contains("Barra")) {
- actor.setVisible(setVisible);
+ if (!setVisible) {
+ SequenceAction sequence = new SequenceAction();
+ sequence.addAction(Actions.fadeOut(0.30f));
+ sequence.addAction(Actions.delay(0.30f));
+ sequence.addAction(Actions.hide());
+ actor.addAction(sequence);
+ } else {
+ SequenceAction sequence = new SequenceAction();
+ sequence.addAction(Actions.show());
+ sequence.addAction(Actions.fadeIn(0.30f));
+ actor.addAction(sequence);
+ }
}
}
}
@@ -2,6 +2,8 @@
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.NinePatch;
+import com.badlogic.gdx.scenes.scene2d.actions.Actions;
+import com.badlogic.gdx.scenes.scene2d.actions.AlphaAction;
import com.badlogic.gdx.scenes.scene2d.ui.Button;
import com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable;
import com.lumpundform.escenario.EscenarioBase;

0 comments on commit e4c401a

Please sign in to comment.