Example usage for com.badlogic.gdx.math Interpolation sineIn

List of usage examples for com.badlogic.gdx.math Interpolation sineIn

Introduction

In this page you can find the example usage for com.badlogic.gdx.math Interpolation sineIn.

Prototype

Interpolation sineIn

To view the source code for com.badlogic.gdx.math Interpolation sineIn.

Click Source Link

Usage

From source file:com.jmolina.orb.widgets.ui.GameTitle.java

License:Open Source License

/**
 * Small easter egg xD// w  w w . ja v a 2 s . c om
 *
 * @return A listener performing an animation over {@link #orb}
 */
private ClickListener getEasterListener() {
    return new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            clicks++;

            orb.addAction(Actions.rotateBy(360 * (float) Math.random(), 1, Interpolation.sineOut));

            if (clicks >= 5) {
                clicks = 0;
                orb.addAction(sequence(
                        parallel(Actions.moveBy(Utils.cell(-4), 0, 0.75f, Interpolation.sineIn),
                                Actions.rotateBy(180, 0.75f, Interpolation.exp5In)),
                        Actions.moveTo(Utils.cell(12), orb.getY(), 0),
                        parallel(Actions.moveTo(0, 0, 2, Interpolation.sineOut),
                                Actions.rotateBy(720, 2, Interpolation.pow2Out))));

                gameManager.unlockAchievement(PlayServices.Achievement.EasterHunter);
            }
        }
    };
}

From source file:com.mangecailloux.pebble.screens.loading.MangeCaillouxSplashScreen.java

License:Apache License

private void startAnimation() {
    SequenceAction action = Actions.sequence(Actions.alpha(0.0f), Actions.show(), Actions.delay(firstDelay),
            Actions.alpha(1.0f, caillouFadeInDuration, Interpolation.sineIn));

    caillouImage.addAction(action);//from w  w  w  .  ja v a  2  s  .  c o  m
}

From source file:com.nhydock.storymode.scenes.title.TitleSequence.java

@Override
public void init() {
    final TitleSequence ui = this;

    // create title sequence
    final Skin skin = manager.get(DataDirs.Home + "title.json", Skin.class);
    final Skin uiskin = shared.getResource(DataDirs.Home + "uiskin.json", Skin.class);

    //clouds//ww  w. jav  a 2 s .  com
    {

        Image goddess = new Image(uiskin, "goddess");
        goddess.setSize(32, 32);
        goddess.setPosition(getWidth(), getHeight() - 96f);
        goddess.setOrigin(Align.center);
        addActor(goddess);

        Image cloudsPan1 = new Image(new TiledDrawable(uiskin.getRegion("clouds")));
        Image cloudsPan2 = new Image(new TiledDrawable(uiskin.getRegion("clouds")));
        cloudsPan1.setWidth(getWidth() * 5);
        cloudsPan2.setWidth(getWidth() * 5);

        cloudsPan1.setPosition(0, 0, Align.topLeft);
        cloudsPan2.setPosition(0, 0, Align.topLeft);
        addActor(cloudsPan1);
        addActor(cloudsPan2);

        cloudsPan1.addAction(Actions.sequence(Actions.moveToAligned(getWidth(), 0, Align.topRight),
                Actions.delay(10f), Actions.parallel(Actions.moveBy(0, 140f, 3f, Interpolation.sineOut),
                        Actions.moveBy(getWidth() * 5, 0, 50f))));

        cloudsPan2.addAction(Actions.sequence(Actions.moveToAligned(getWidth(), 0, Align.topRight),
                Actions.delay(10f), Actions.parallel(Actions.moveBy(0, 80f, 3f, Interpolation.sineOut),
                        Actions.moveBy(getWidth() * 5, 0, 40f))));

        goddess.addAction(Actions.sequence(Actions.delay(20f),
                Actions.parallel(Actions.repeat(5, Actions.rotateBy(360, .4f)),
                        Actions.moveBy(-getWidth() - 32, 0f, 2f)),
                Actions.delay(1f),
                Actions.addAction(Actions.moveBy(0, getHeight(), 1f, Interpolation.sineIn), cloudsPan1),
                Actions.addAction(Actions.moveBy(0, getHeight(), 1f, Interpolation.sineIn), cloudsPan2)));
    }

    // initial text
    {
        Table textGrid = new Table();
        textGrid.setFillParent(true);
        textGrid.pad(40f);

        Label text = new Label(
                "This game is Shareware!\n\nThat means it's completely free to download and distribute.\n\nIf you'd like to be nice, you can donate and learn more at http://nhydock.github.io/Storymode",
                skin);
        text.setWrap(true);
        text.setAlignment(Align.center);
        text.addAction(Actions.sequence(Actions.alpha(0f), Actions.alpha(1f, 1f)));
        textGrid.add(text).expandX().fillX();
        text = new Label("~Thanks a bunch!", skin);
        text.setWrap(true);
        text.setAlignment(Align.right);
        text.addAction(Actions.sequence(Actions.alpha(0f), Actions.delay(3f), Actions.alpha(1f, 1f)));
        textGrid.row();
        textGrid.add(text).expandX().fillX().padRight(60f);
        textGrid.addAction(Actions.sequence(Actions.alpha(1f), Actions.delay(8f), Actions.alpha(0f, 2f),
                Actions.run(new PlayBGM(manager.get(DataDirs.Audio + "title.mp3", Music.class)))));
        addActor(textGrid);
    }

    // credits animation
    {
        Table textGrid = new Table();
        textGrid.setFillParent(true);
        textGrid.pad(40f);

        Label text = new Label("Graphics, Programming, Project Lead", skin);
        text.setAlignment(Align.center);
        textGrid.add(text).expandX().fillX();
        textGrid.row();
        text = new Label("Nicholas Hydock", skin);
        text.setAlignment(Align.center);
        textGrid.add(text).expandX().fillX();
        textGrid.row();
        text = new Label(" ", skin);
        text.setAlignment(Align.center);
        textGrid.add(text).expandX().fillX();
        textGrid.row();
        text = new Label("Ideas, Suggestions, Emotional Support, & Bros4Lyfe", skin);
        text.setAlignment(Align.center);
        textGrid.add(text).expandX().fillX();
        textGrid.row();
        text = new Label("Patrick Flanagan", skin);
        text.setAlignment(Align.center);
        textGrid.add(text).expandX().fillX();
        textGrid.row();
        text = new Label("Matthew Hydock", skin);
        text.setAlignment(Align.center);
        textGrid.add(text).expandX().fillX();
        textGrid.row();
        text = new Label("Andrew Hoffman", skin);
        text.setAlignment(Align.center);
        textGrid.add(text).expandX().fillX();

        textGrid.addAction(Actions.sequence(Actions.alpha(0f), Actions.delay(10f), Actions.alpha(1f, .75f),
                Actions.delay(4f), Actions.alpha(0f, .75f)));
        addActor(textGrid);
    }

    // display tool logos
    {
        Group group = new Group();
        Image tools = new Image(skin.getDrawable("tools"));
        tools.setPosition(getWidth() / 2 - tools.getWidth() / 2, getHeight() / 2 - tools.getHeight() / 2);
        Label label = new Label(
                "All music is licensed under Creative-Commons BY(-NC) or other permissive licenses.\nAll attribution can be found in the README",
                skin, "small");
        label.setPosition(getWidth() / 2f, getHeight() / 2f - 80f, Align.top);
        label.setAlignment(Align.center);
        group.addActor(tools);
        group.addActor(label);
        group.addAction(Actions.sequence(Actions.alpha(0f), Actions.delay(16f), Actions.alpha(1f, .75f),
                Actions.delay(4f), Actions.alpha(0f, .75f)));
        addActor(group);
    }

    // cool animation
    {
        Group cool = new Group();
        cool.setSize(getWidth(), getHeight());
        Group group = new Group();
        Image cliff = new Image(skin.getRegion("cliff"));
        group.addAction(Actions.sequence(Actions.moveTo(0, -cliff.getHeight()), Actions.delay(24f),
                Actions.moveTo(0, 0, 4f)));
        group.addActor(cliff);
        final Image character = new Image(skin.getRegion("back"));
        character.setSize(96f, 96f);
        group.addActor(character);
        character.addAction(
                Actions.sequence(Actions.moveTo(200f, 200f), Actions.delay(31f), Actions.run(new Runnable() {

                    @Override
                    public void run() {
                        character.setDrawable(skin.getDrawable("character"));
                    }

                }), Actions.moveTo(-character.getWidth() / 2, -character.getHeight(), 1f), Actions.delay(10f),
                        Actions.run(new Runnable() {

                            @Override
                            public void run() {
                                character.setDrawable(skin.getDrawable("back"));
                            }

                        }), Actions.moveTo(200f, 200f, 1f), Actions.delay(.2f), Actions.run(new Runnable() {

                            @Override
                            public void run() {
                                character.setDrawable(skin.getDrawable("character"));
                            }

                        })));

        Image castle = new Image(skin.getRegion("castle"));
        castle.addAction(
                Actions.sequence(Actions.moveToAligned(getWidth() - castle.getWidth(), 0f, Align.topLeft),
                        Actions.delay(24f), Actions.moveBy(0, getHeight(), 4f)));
        Image lightning = new Image(skin.getRegion("lightning"));
        lightning.setPosition(getWidth() - castle.getWidth(), getHeight() - castle.getHeight());
        lightning.addAction(Actions.sequence(Actions.alpha(0f), Actions.delay(29f), Actions.alpha(1f, .1f),
                Actions.delay(.3f), Actions.alpha(.3f, .3f), Actions.alpha(1f, .1f), Actions.delay(.3f),
                Actions.alpha(0f, 1f)));

        Image logo = new Image(skin.getRegion("logo"));
        logo.addAction(Actions.sequence(Actions.alpha(0f),
                Actions.moveTo(0, getHeight() - logo.getHeight() + 5f), Actions.delay(34f),
                Actions.alpha(1f, 1f),
                Actions.forever(Actions.sequence(Actions.moveTo(0, getHeight() - logo.getHeight() + 5f, 2f),
                        Actions.moveTo(0, getHeight() - logo.getHeight() - 5f, 2f)))));

        Table table = new Table();

        Label label = new Label("Title theme", skin, "small");
        label.setAlignment(Align.right);
        table.add(label).expandX().fillX();
        table.row();
        label = new Label("Anamanaguchi - Helix Nebula", skin, "small");
        label.setAlignment(Align.right);
        table.add(label).expandX().fillX();
        table.row();
        table.pad(10f);
        table.pack();
        table.addAction(Actions.sequence(Actions.alpha(0f), Actions.moveTo(getWidth() - table.getWidth(), 0),
                Actions.delay(40f), Actions.alpha(1f, 1f)));

        cool.addActor(castle);
        cool.addActor(lightning);
        cool.addActor(group);
        cool.addActor(logo);
        cool.addActor(table);

        cool.addAction(Actions.sequence(Actions.alpha(0f), Actions.delay(24f), Actions.alpha(1f),
                Actions.delay(40f), Actions.alpha(0f, 1f), Actions.delay(1f), Actions.run(new Runnable() {

                    @Override
                    public void run() {
                        SceneManager.switchToScene("title");
                    }

                }), Actions.delay(1.5f), Actions.run(new Runnable() {

                    @Override
                    public void run() {
                    }

                })));
        addActor(cool);

        final Label startLabel = new Label("Press Start", skin);
        startLabel.setPosition(getWidth() - 360f, 120f);
        startLabel.addAction(Actions.sequence(Actions.alpha(0f), Actions.delay(38f), Actions.alpha(1f, .3f),
                Actions.run(new Runnable() {

                    @Override
                    public void run() {
                        ui.addListener(new InputListener() {
                            @Override
                            public boolean touchDown(InputEvent evt, float x, float y, int pointer,
                                    int button) {
                                if (button == Buttons.LEFT) {
                                    SceneManager.switchToScene("newgame");
                                    return true;
                                }
                                return false;
                            }
                        });
                    }

                }), Actions.delay(24f), Actions.alpha(0f, 1f)));
        addActor(startLabel);

    }

    // make sure all initial steps are set
    act();

    addListener(new InputListener() {
        @Override
        public boolean keyDown(InputEvent evt, int keycode) {
            // skip the intro
            if (Input.ACCEPT.match(keycode) || Input.CANCEL.match(keycode)) {
                SceneManager.switchToScene("newgame");
                return true;
            }
            return false;
        }

        @Override
        public boolean touchDown(InputEvent evt, float x, float y, int pointer, int button) {
            if (button == Buttons.RIGHT) {
                SceneManager.switchToScene("newgame");
                return true;
            }
            return false;
        }
    });
}

From source file:es.eucm.ead.editor.view.builders.scene.SceneEditor.java

License:Open Source License

@Override
public void modelChanged(SelectionEvent event) {
    interactiveButton.clearActions();/*  w w w.jav  a  2s  .  com*/
    if (selection.get(Selection.SCENE_ELEMENT).length != 1) {
        lockContextOnly(true);
        interactiveButton.addAction(Actions.sequence(Actions.touchable(Touchable.disabled),
                Actions.scaleTo(0, 0, ANIMATION_TIME, Interpolation.sineIn), Actions.visible(false)));
    } else {
        lockContextOnly(false);
        interactiveButton.addAction(Actions.sequence(Actions.visible(true),
                Actions.scaleTo(1, 1, ANIMATION_TIME, Interpolation.sineIn),
                Actions.touchable(Touchable.enabled)));
    }
    setMode(mode);
}

From source file:es.eucm.ead.editor.view.widgets.MultiWidget.java

License:Open Source License

public MultiWidget(MultiWidgetStyle style) {
    this.style = style;
    setBackground(style.background);//from   w w w .j  a  va 2 s . co  m
    if (style.color != null) {
        setColor(style.color);
    }
    widgets = new Array<Actor>();
    colors = new Array<Color>();
    fill();
    actionAddActor = new Runnable() {
        @Override
        public void run() {

            float timeShow = ANIM_TIME * (1 - Math.abs(toShow.getScaleY()));
            setActor(toShow);
            toShow.addAction(
                    Actions.sequence(Actions.parallel(Actions.scaleTo(1, 1, timeShow, Interpolation.sineIn),
                            Actions.fadeIn(timeShow)), Actions.touchable(Touchable.enabled)));
        }
    };
}

From source file:headmade.arttag.actions.ActionFactory.java

License:Apache License

public static RepeatAction wiggleRepeat(Float rotationAmount, Float duration) {
    final RepeatAction wiggleAction = Actions
            .forever(Actions.sequence(Actions.rotateBy(rotationAmount, duration / 4, Interpolation.sineOut),
                    Actions.rotateBy(-rotationAmount * 2, duration / 2, Interpolation.sine),
                    Actions.rotateBy(rotationAmount, duration / 4, Interpolation.sineIn)));
    return wiggleAction;
}

From source file:net.mwplay.cocostudio.ui.CocoStudioUIEditor.java

License:Apache License

/**
 * ??/* ww  w.j  a va  2  s  . c  om*/
 */
public Interpolation getInterpolation(int tweenType) {
    switch (tweenType) {
    case 0:
        return Interpolation.linear;
    case 1:
        return Interpolation.sineIn;
    case 2:
        return Interpolation.sineOut;
    case 3:
        return Interpolation.sine;
    case 4:
        return Interpolation.linear; //??Quad_EaseIn
    case 5:
        return Interpolation.linear; //??Quad_EaseOut
    case 6:
        return Interpolation.linear; //??Quad_EaseInOut
    case 7:
        return Interpolation.linear; //??Cubic_EaseIn
    case 8:
        return Interpolation.linear; //??Cubic_EaseOut
    case 9:
        return Interpolation.linear; //??Cubic_EaseInOut
    case 10:
        return Interpolation.linear; //??Quart_EaseIn
    case 11:
        return Interpolation.linear; //??Quart_EaseOut
    case 12:
        return Interpolation.linear; //??Quart_EaseInOut
    case 13:
        return Interpolation.linear; //??Quint_EaseIn
    case 14:
        return Interpolation.linear; //??Quint_EaseOut
    case 15:
        return Interpolation.linear; //??Quint_EaseInOut
    case 16:
        return Interpolation.exp10In;
    case 17:
        return Interpolation.exp10Out;
    case 18:
        return Interpolation.exp10;
    case 19:
        return Interpolation.circleIn;
    case 20:
        return Interpolation.circleOut;
    case 21:
        return Interpolation.circle;
    case 22:
        return Interpolation.elasticIn;
    case 23:
        return Interpolation.elasticOut;
    case 24:
        return Interpolation.elastic;
    case 25:
        return Interpolation.linear; //??Back_EaseIn
    case 26:
        return Interpolation.linear; //??Back_EaseOut
    case 27:
        return Interpolation.linear; //??Back_EaseInOut
    case 28:
        return Interpolation.bounceIn;
    case 29:
        return Interpolation.bounceOut;
    case 30:
        return Interpolation.bounce;

    default:
        return Interpolation.linear;
    }
}

From source file:org.pidome.client.photoframe.screens.photoscreen.actors.PhotosActor.java

public Interpolation getRandomFadeInterpolation() {
    switch (new Random().nextInt(14)) {
    case 0:/*from  www.  j  a  va  2 s .  c  om*/
        return Interpolation.exp10;
    case 1:
        return Interpolation.exp10In;
    case 2:
        return Interpolation.exp10Out;
    case 3:
        return Interpolation.exp5;
    case 4:
        return Interpolation.exp5In;
    case 5:
        return Interpolation.exp5Out;
    case 6:
        return Interpolation.fade;
    case 7:
        return Interpolation.linear;
    case 8:
        return Interpolation.sine;
    case 9:
        return Interpolation.sineIn;
    case 10:
        return Interpolation.sineOut;
    case 11:
        return Interpolation.bounce;
    case 12:
        return Interpolation.bounceIn;
    case 13:
        return Interpolation.bounceOut;
    default:
        return Interpolation.linear;
    }
}

From source file:org.pidome.client.photoframe.screens.photoscreen.actors.PhotosActor.java

public Interpolation getRandomInterpolation() {
    switch (new Random().nextInt(20)) {
    case 0:/*from w w  w. j  a v a 2s. com*/
        return Interpolation.bounce;
    case 1:
        return Interpolation.bounceIn;
    case 2:
        return Interpolation.bounceOut;
    case 3:
        return Interpolation.circle;
    case 4:
        return Interpolation.circleIn;
    case 5:
        return Interpolation.circleOut;
    case 6:
        return Interpolation.exp10;
    case 7:
        return Interpolation.exp10In;
    case 8:
        return Interpolation.exp10Out;
    case 9:
        return Interpolation.exp5;
    case 10:
        return Interpolation.exp5In;
    case 11:
        return Interpolation.exp5Out;
    case 12:
        return Interpolation.fade;
    case 13:
        return Interpolation.linear;
    case 14:
        return Interpolation.sine;
    case 15:
        return Interpolation.sineIn;
    case 16:
        return Interpolation.sineOut;
    case 17:
        return Interpolation.swing;
    case 18:
        return Interpolation.swingIn;
    case 19:
        return Interpolation.swingOut;
    default:
        return Interpolation.linear;
    }
}