Example usage for com.badlogic.gdx.scenes.scene2d Actor addAction

List of usage examples for com.badlogic.gdx.scenes.scene2d Actor addAction

Introduction

In this page you can find the example usage for com.badlogic.gdx.scenes.scene2d Actor addAction.

Prototype

public void addAction(Action action) 

Source Link

Usage

From source file:com.bagon.matchteam.mtx.scene2d.effects.EffectCreator.java

License:Apache License

/**
 * Scale effect (SC)//from   w w  w .ja v a  2s  .  c  o  m
 * */
public static void create_SC(Actor actor, float scaleRatioX, float scaleRatioY, float duration,
        final Group group, final boolean removeActor) {
    if (actor != null) {
        actor.addAction(Actions.sequence(Actions.scaleTo(scaleRatioX, scaleRatioY, duration), new Action() {
            @Override
            public boolean act(float delta) {
                if (removeActor) {
                    removeActor(group, actor);
                    return false;
                } else {
                    return true;
                }
            }
        }));
    }
}

From source file:com.bagon.matchteam.mtx.scene2d.effects.EffectCreator.java

License:Apache License

/**
 * Fade Out (FO)/* w  ww.j a  v  a 2s .c o m*/
 * */
public static void create_FO(Actor actor, float duration, float delay, final Group group,
        final boolean removeActor) {
    if (actor != null) {
        actor.addAction(Actions.sequence(Actions.delay(delay), Actions.fadeOut(duration), new Action() {
            @Override
            public boolean act(float delta) {
                if (removeActor) {
                    removeActor(group, actor);
                    return false;
                } else {
                    return true;
                }
            }
        }));
    }
}

From source file:com.bagon.matchteam.mtx.scene2d.effects.EffectCreator.java

License:Apache License

/**
 * Fade In (FI)//from w  w w  .  j  a v  a  2 s .co m
 * */
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;
                }
            }
        }));
    }
}

From source file:com.bagon.matchteam.mtx.scene2d.effects.EffectCreator.java

License:Apache License

/**
 * Move to a position/*from w  w w.  j a  v  a 2 s . c  o  m*/
 * */
public static void create_MT(Actor actor, float duration, float delayBefore, float posX, float posY,
        final Group group, final boolean removeActor) {
    if (actor != null) {
        actor.addAction(Actions.sequence(Actions.delay(delayBefore), Actions.moveTo(posX, posY, duration),
                new Action() {
                    @Override
                    public boolean act(float delta) {
                        if (removeActor) {
                            removeActor(group, actor);
                            return false;
                        } else {
                            return true;
                        }
                    }
                }));
    }
}

From source file:com.bagon.matchteam.mtx.scene2d.effects.EffectCreator.java

License:Apache License

/**
 * Shake effect (SHK)//from   www .  j  a  v  a 2 s  .co  m
 * */
public static void create_SHK(Actor actor, float shakeAngle, float originalAngle, float duration,
        final Group group, final boolean removeActor) {
    if (actor != null) {
        actor.addAction(Actions.sequence(Actions.rotateTo(shakeAngle, duration),
                Actions.rotateTo(-shakeAngle, duration), Actions.rotateTo(originalAngle, duration),
                new Action() {
                    @Override
                    public boolean act(float delta) {
                        if (removeActor) {
                            removeActor(group, actor);
                            return false;
                        } else {
                            return true;
                        }
                    }
                }));
    }
}

From source file:com.bagon.matchteam.mtx.scene2d.effects.EffectCreator.java

License:Apache License

/**
 * Scale effect and Back to previous scale (SC, BTN)
 * *//*ww w .  j  av a  2  s  . c o  m*/
public static void create_SC_BTN(Actor actor, float scaleRatioX, float scaleRatioY, float duration,
        final Group group, final boolean removeActor) {
    if (actor != null) {
        float originalScaleX = actor.getScaleX();
        float originalScaleY = actor.getScaleY();
        actor.addAction(Actions.sequence(Actions.scaleTo(scaleRatioX, scaleRatioY, duration),
                Actions.scaleTo(originalScaleX, originalScaleY, duration), new Action() {
                    @Override
                    public boolean act(float delta) {
                        if (removeActor) {
                            removeActor(group, actor);
                            return false;
                        } else {
                            return true;
                        }
                    }
                }));
    }
}

From source file:com.bagon.matchteam.mtx.scene2d.effects.EffectCreator.java

License:Apache License

/**
 * Scale effect and Back to original (1.0f)
 * *//* ww  w .j  av  a  2 s.co  m*/
public static void create_SC_BTO(Actor actor, float scaleRatioX, float scaleRatioY, float duration,
        final Group group, final boolean removeActor) {
    if (actor != null) {
        actor.addAction(Actions.sequence(Actions.scaleTo(scaleRatioX, scaleRatioY, duration),
                Actions.scaleTo(1.0f, 1.0f, duration), new Action() {
                    @Override
                    public boolean act(float delta) {
                        if (removeActor) {
                            removeActor(group, actor);
                            return false;
                        } else {
                            return true;
                        }
                    }
                }));
    }
}

From source file:com.bagon.matchteam.mtx.scene2d.effects.EffectCreator.java

License:Apache License

/**
 * Scale effect, Fade Out (SC, FO)//from  www.  j  a v  a 2s  . c  o  m
 * */
public static void create_SC_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.delay(delayBeforeFadeOut), Actions.fadeOut(duration), new Action() {
                    @Override
                    public boolean act(float delta) {
                        if (removeActor) {
                            removeActor(group, actor);
                            return false;
                        } else {
                            return true;
                        }
                    }
                }));
    }
}

From source file:com.bagon.matchteam.mtx.scene2d.effects.EffectCreator.java

License:Apache License

/**
 * Scale effect, Shake effect (SC, SHK)/*from www  .j ava 2s  .  c  o m*/
 * */
public static void create_SC_SHK(Actor actor, float scaleRatioX, float scaleRatioY, float shakeAngle,
        float originalAngle, float duration, final Group group, final boolean removeActor) {
    if (actor != null) {
        actor.addAction(Actions.sequence(Actions.scaleTo(scaleRatioX, scaleRatioY, duration),
                Actions.rotateTo(shakeAngle, duration), Actions.rotateTo(-shakeAngle, duration),
                Actions.rotateTo(originalAngle, duration), new Action() {
                    @Override
                    public boolean act(float delta) {
                        if (removeActor) {
                            removeActor(group, actor);
                            return false;
                        } else {
                            return true;
                        }
                    }
                }));
    }
}

From source file:com.bagon.matchteam.mtx.scene2d.effects.EffectCreator.java

License:Apache License

/**
 * Scale effect, Back To Normal, Fade Out (SC, BTN, FO)
 * *///from  w w w.  j a  v a  2  s  .c o m
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;
                        }
                    }
                }));
    }
}