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

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

Introduction

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

Prototype

Pow pow2

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

Click Source Link

Usage

From source file:com.agateau.pixelwheels.racer.GroundCollisionHandlerComponent.java

License:Open Source License

private void actLifting(float delta) {
    mTime += delta;//from  w  w  w.j  av  a  2  s  .  c  o m
    if (mTime >= LIFTING_DELAY) {
        mTime = LIFTING_DELAY;
        startRecovering();
    }
    mVehicle.setZ(Interpolation.pow2.apply(mTime / LIFTING_DELAY));
}

From source file:com.jmolina.orb.elements.Heater.java

License:Open Source License

/**
 * Devuelve una animacion de parpadeo/*w  w w.  j ava  2 s. c  o m*/
 */
private Action blinkAction() {
    RepeatAction forever = new RepeatAction();
    forever.setCount(RepeatAction.FOREVER);
    forever.setAction(new SequenceAction(alpha(1, BLINK_HALF_TIME, Interpolation.pow2),
            alpha(0.4f, BLINK_HALF_TIME, Interpolation.pow2)));

    return forever;
}

From source file:com.jmolina.orb.elements.Orb.java

License:Open Source License

/**
 * Ejecuta la animacion de introduccion//from   w ww.  j a  va 2  s .c  o m
 */
public void applyIntroAction() {
    getActor().addAction(sequence(
            parallel(scaleBy(4 * this.getNaturalScale(), 4 * this.getNaturalScale(), 0), rotateTo(0, 0),
                    alpha(0)),
            parallel(rotateTo(360, INTRO_TIME, Interpolation.exp5),
                    scaleTo(this.getNaturalScale(), this.getNaturalScale(), INTRO_TIME, Interpolation.pow2),
                    fadeIn(INTRO_TIME, Interpolation.pow2))));
}

From source file:com.jmolina.orb.elements.Orb.java

License:Open Source License

/**
 * Ejecuta la animacion de salida/*from w  w w  .  j a v a  2 s. c  o m*/
 *
 * @param toSuccess Callback de cambio a la pantalla de exito
 */
public void applyOutroAction(Runnable toSuccess) {
    getActor()
            .addAction(sequence(
                    parallel(rotateBy(1080, OUTRO_TIME, Interpolation.pow2Out),
                            scaleTo(4 * this.getNaturalScale(), 4 * this.getNaturalScale(), OUTRO_TIME,
                                    Interpolation.pow2),
                            fadeOut(OUTRO_TIME, Interpolation.pow2)),
                    run(toSuccess)));
}

From source file:com.jmolina.orb.screens.Level.java

License:Open Source License

/**
 * Cambia a la pantalla indicada//  w w  w  .  j  a v  a 2  s .  co m
 *
 * @param screen Identificador de la siguiente pantalla
 * @param hierarchy Jerarqua de la siguiente pantalla respecto de la actual
 */
@Override
public void switchToScreen(final ScreenManager.Key screen, final Hierarchy hierarchy) {

    Runnable flagSwitch = new Runnable() {
        @Override
        public void run() {
            flagSwitch(screen, hierarchy);
        }
    };

    getHUDStage().addAction(sequence(
            Actions.addAction(fadeIn(TRANSITION_DURATION, Interpolation.pow2), getBackgroundStage().getRoot()),
            delay(TRANSITION_DURATION), getTransitionAction(Flow.LEAVING, hierarchy), run(flagSwitch)));
}

From source file:com.jumpbuttonstudios.vikingdodge.ui.popup.WelcomeMessagePopup.java

License:Apache License

public WelcomeMessagePopup(VikingDodge vikingDodge, Layout layout) {
    super(vikingDodge, layout, new Image(Assets.skin.get("welcomeBar", TextureRegionDrawable.class)), 1, false,
            false);/*ww w  . j  a  va 2 s. c  o  m*/

    moveIn(1, Interpolation.pow2);

}

From source file:com.quadbits.gdxhelper.scenemodel.handlers.PeriodicRotationControllerModelHandler.java

License:Apache License

@Override
public Object create(BaseModel model, String id, boolean forceCreation) {
    // Safeguard against duplicate calls
    if (!forceCreation && model.created) {
        return null;
    }// w w  w . jav  a 2  s .  c o m
    model.created = true;

    // Id
    if (id == null) {
        id = model.id;
    }

    PeriodicRotationControllerModel controllerModel = (PeriodicRotationControllerModel) model;
    HashMap<String, Controller> allControllers = sceneModelManager.getAllControllers();

    // Create controller
    PeriodicRotationController controller = periodicRotationControllerPool.obtain();
    allControllers.put(id, controller);

    // Min and max angle
    controller.setMinAngle(controllerModel.minAngle);
    controller.setMaxAngle(controllerModel.maxAngle);

    // Durations
    controller.setDurations(controllerModel.rotationDuration, controllerModel.stallDuration);

    // Interpolation
    if (controllerModel.decelerate) {
        controller.setInterpolation(Interpolation.pow2);
    }

    return controller;
}

From source file:com.quadbits.gdxhelper.utils.TimeManager.java

License:Apache License

public void updateTime(long unnormalizedTimeDiff) {
    long currentUnnormalizedT = unnormalizedT + unnormalizedTimeDiff;

    // Switch to FAST_FORWARD mode?
    if (switchToFastForwardMode(unnormalizedTimeDiff)) {
        if (timeMode == TimeMode.NORMAL) {
            ffTimeInit = unnormalizedT;/*w ww  .  j a  v  a 2 s  .  com*/
            ffAnimTimeInit = currentUnnormalizedT;
            ffTimeLength = unnormalizedTimeDiff;
            ffAnimTimeLength = FF_ANIMATION_MIN_LENGTH
                    + (long) (((float) unnormalizedTimeDiff / (float) periodMillis) * FF_ANIMATION_MAX_LENGTH);
        }
        timeMode = TimeMode.FAST_FORWARD;
    }

    // Switch to NORMAL mode?
    long ffAnimTimeDiff = 0;
    if (timeMode == TimeMode.FAST_FORWARD) {
        ffAnimTimeDiff = getTimeDiffMillis(ffAnimTimeInit, currentUnnormalizedT);
        if (ffAnimTimeDiff > ffAnimTimeLength) {
            timeMode = TimeMode.NORMAL;
        }
    }

    // time mode
    switch (timeMode) {
    case NORMAL:
        // Set time
        setUnnormalizedT(currentUnnormalizedT);
        break;

    case FAST_FORWARD:
        // Calculate the % of animation time passed
        float ffPerc = (float) ffAnimTimeDiff / (float) ffAnimTimeLength;
        if (ffPerc > 1) {
            ffPerc = 1; // Clamp
        }

        // Use an interpolation function to update fast-forward time
        //                long ffUnormalizedT = (long) Interpolation.linear
        //                        .apply(ffTimeInit, ffTimeInit + ffTimeLength, ffPerc);
        //                long ffUnormalizedT = (long) Interpolation.pow5Out
        //                        .apply(ffTimeInit, ffTimeInit + ffTimeLength, ffPerc);
        long ffUnormalizedT = (long) Interpolation.pow2.apply(ffTimeInit, ffTimeInit + ffTimeLength, ffPerc);

        // Set time
        setUnnormalizedT(ffUnormalizedT);
    }
}

From source file:de.longri.cachebox3.gui.animations.actor_animations.GestureHelpAnimation.java

License:Open Source License

public GestureHelpAnimation(final Vector2 start, final Vector2 end) {
    // create finger actor
    final Image finger = new Image(CB.getSprite("finger"));
    final Image fingerClick = new Image(CB.getSprite("finger_click"));

    //set start and end to finger of hand

    float fingerY = finger.getHeight() * 0.7f;
    float fingerX = finger.getWidth() * 0.2f;
    start.y -= fingerY;/*from   w ww  . j  a va 2 s  .com*/
    start.x += fingerX;
    end.y -= fingerY;
    end.x += fingerX;

    finger.addAction(Actions.moveTo(start.x, start.y));
    fingerClick.addAction(Actions.moveTo(start.x, start.y));

    this.addAction(new AddActorAction(finger));
    this.addAction(Actions.delay(0.7f));
    this.addAction(Actions.removeActor(finger));
    this.addAction(new AddActorAction(fingerClick));
    RunnableAction runnableAction = new RunnableAction();
    runnableAction.setRunnable(new Runnable() {
        @Override
        public void run() {
            RunnableAction runnableAction = new RunnableAction();
            runnableAction.setRunnable(new Runnable() {
                @Override
                public void run() {
                    fingerClick.addAction(Actions.sequence(Actions.delay(0.7f), Actions.removeActor()));
                }
            });

            Action action = Actions.sequence(Actions.moveTo(end.x, end.y, 1.0f, Interpolation.pow2),
                    runnableAction);
            fingerClick.addAction(action);
            finger.addAction(Actions.moveTo(end.x, end.y));
        }
    });

    this.addAction(runnableAction);

}

From source file:io.piotrjastrzebski.sfg.screen.MainMenuScreen.java

License:Open Source License

private Actor createGPlusButton() {
    // player can be automatically logged in
    final String signInText = isSignedIn ? assets.getText(Assets.SIGN_OUT) : assets.getText(Assets.SIGN_IN);
    // special g+ branded skin
    gPlusSignIn = new TextButton(signInText, assets.getSkin(), "gplus");
    gPlusSignIn.addListener(new ClickListener() {
        @Override// w  w w  . j  av a2  s.  c  om
        public void clicked(InputEvent event, float x, float y) {
            // this will show native sign in dialog
            if (!isSignedIn) {
                actionResolver.signIn();
            } else {
                actionResolver.signOut();
            }
        }
    });
    // center origin so its scaled from it
    gPlusSignIn.setOrigin(gPlusSignIn.getWidth() / 2, gPlusSignIn.getHeight() / 2);
    // allow scaling
    gPlusSignIn.setTransform(true);
    // invisible
    gPlusSignIn.setColor(1, 1, 1, 0);
    gPlusSignIn.setScale(0.5f);
    // move the button off screen and slide it back in
    gPlusSignIn
            .addAction(Actions.parallel(Actions.scaleTo(1, 1, 0.5f, Interpolation.pow2), Actions.fadeIn(0.5f)));
    return gPlusSignIn;
}