Java 类com.badlogic.gdx.math.Interpolation 实例源码

项目:Planet-Generator    文件:Scene.java   
private void tryToTransition(float delta) {
    if(focus) {
        elapsed += delta;
        float progress = Math.min(1f, elapsed / lifetime);

        gameCamera.position.x = Interpolation.circleOut.apply(startX, targetX, progress);
        gameCamera.update();

        starCamera.position.x = Interpolation.circleOut.apply(startStarX, targetStarX, progress);
        starCamera.update();

        if(progress == 1) {
            focus = false;
        }
    }
}
项目:Mindustry    文件:BlockConfigFragment.java   
public void showConfig(Tile tile){
    configTile = tile;

    table.clear();
    tile.block().buildTable(tile, table);
    table.pack();
    table.setTransform(true);
    table.actions(Actions.scaleTo(0f, 1f), Actions.visible(true),
            Actions.scaleTo(1f, 1f, 0.07f, Interpolation.pow3Out));

    table.update(()->{
        table.setOrigin(Align.center);
        Vector2 pos = Graphics.screen(tile.worldx() + tile.block().getPlaceOffset().x, tile.worldy() + tile.block().getPlaceOffset().y);
        table.setPosition(pos.x, pos.y, Align.center);
        if(configTile == null || configTile.block() == Blocks.air){
            hideConfig();
        }
    });
}
项目:odb-artax    文件:FeatureScreenSetupSystem.java   
public void addLogo() {

        // approximate percentage of screen size with logo. Use rounded numbers to keep the logo crisp.

        float zoom = Anims.scaleToScreenRounded(0.8f, FeatureScreenAssetSystem.LOGO_WIDTH);

        Anims.createCenteredAt(
                FeatureScreenAssetSystem.LOGO_WIDTH,
                FeatureScreenAssetSystem.LOGO_HEIGHT,
                "logo",
                zoom)
                .tint(COLOR_LOGO_FADED)
                .script(
                        scaleBetween(zoom * 2, zoom, 2f, Interpolation.bounceOut),
                        tween(new Tint(COLOR_LOGO_FADED), new Tint(COLOR_LOGO_FULL), 2f, Interpolation.fade)
                );

    }
项目:odb-artax    文件:CameraFollowSystem.java   
@Override
protected void process(E e) {
    if ( Gdx.input.isKeyJustPressed(Input.Keys.F9) ) lockCamera = !lockCamera;

    if ( lockCamera) return;
    if (e.wallSensorOnFloor() || e.wallSensorOnPlatform()) {
        float newTargetY = myAnimRenderSystem.roundToPixels(e.posY());
        if (targetY != newTargetY) {
            sourceY = (int) cameraSystem.camera.position.y;
            targetY = (int) newTargetY;
            cooldown = 0f;
        }
    }
    if (cooldown <= 1F) {
        cooldown += world.delta*2f;
        if (cooldown > 1f) cooldown = 1f;
        cameraSystem.camera.position.y = myAnimRenderSystem.roundToPixels(Interpolation.pow2Out.apply(sourceY,targetY, cooldown));        }
    cameraSystem.camera.position.x = myAnimRenderSystem.roundToPixels(e.posX());
    cameraSystem.camera.update();

    float maxDistance = (Gdx.graphics.getHeight() / G.CAMERA_ZOOM) * 0.5F * 0.6f;
    if (  e.posY() < cameraSystem.camera.position.y - maxDistance) {
        cameraSystem.camera.position.y = e.posY() + maxDistance;
        cameraSystem.camera.update();
    }
}
项目:Klooni1010    文件:BaseScorer.java   
public void draw(SpriteBatch batch) {
    // If we beat a new record, the cup color will linear interpolate to the high score color
    cupColor.lerp(isNewRecord() ? Klooni.theme.highScore : Klooni.theme.currentScore, 0.05f);
    batch.setColor(cupColor);
    batch.draw(cupTexture, cupArea.x, cupArea.y, cupArea.width, cupArea.height);

    int roundShown = MathUtils.round(shownScore);
    if (roundShown != currentScore) {
        shownScore = Interpolation.linear.apply(shownScore, currentScore, 0.1f);
        currentScoreLabel.setText(Integer.toString(MathUtils.round(shownScore)));
    }

    currentScoreLabel.setColor(Klooni.theme.currentScore);
    currentScoreLabel.draw(batch, 1f);

    highScoreLabel.setColor(Klooni.theme.highScore);
    highScoreLabel.draw(batch, 1f);
}
项目:Klooni1010    文件:PauseMenuStage.java   
private void hide() {
    shown = false;
    hiding = true;
    Gdx.input.setInputProcessor(lastInputProcessor);

    addAction(Actions.sequence(
            Actions.moveTo(0, Gdx.graphics.getHeight(), 0.5f, Interpolation.swingIn),
            new RunnableAction() {
                @Override
                public void run() {
                    hiding = false;
                }
            }
    ));
    scorer.resume();
}
项目:Klooni1010    文件:SpinEffect.java   
@Override
public void draw(Batch batch) {
    age += Gdx.graphics.getDeltaTime();

    final float progress = age * INV_LIFETIME;
    final float currentSize = Interpolation.pow2In.apply(size, 0, progress);
    final float currentRotation = Interpolation.sine.apply(0, TOTAL_ROTATION, progress);

    final Matrix4 original = batch.getTransformMatrix().cpy();
    final Matrix4 rotated = batch.getTransformMatrix();

    final float disp =
            + 0.5f * (size - currentSize) // the smaller, the more we need to "push" to center
            + currentSize * 0.5f; // center the cell for rotation

    rotated.translate(pos.x + disp, pos.y + disp, 0);
    rotated.rotate(0, 0, 1, currentRotation);
    rotated.translate(currentSize * -0.5f, currentSize * -0.5f, 0); // revert centering for rotation

    batch.setTransformMatrix(rotated);
    Cell.draw(color, batch, 0, 0, currentSize);
    batch.setTransformMatrix(original);
}
项目:Klooni1010    文件:EvaporateEffect.java   
@Override
public void draw(Batch batch) {
    vanishElapsed += Gdx.graphics.getDeltaTime();

    // Update the size as we fade away
    final float progress = vanishElapsed * INV_LIFETIME;
    vanishSize = Interpolation.fade.apply(size, 0, progress);

    // Fade away depending on the time
    vanishColor.set(vanishColor.r, vanishColor.g, vanishColor.b, 1.0f - progress);

    // Ghostly fade upwards, by doing a lerp from our current position to the wavy one
    pos.x = MathUtils.lerp(
            pos.x,
            originalX + MathUtils.sin(randomOffset + vanishElapsed * 3f) * driftMagnitude,
            0.3f
    );
    pos.y += UP_SPEED * Gdx.graphics.getDeltaTime();

    Cell.draw(vanishColor, batch, pos.x, pos.y, vanishSize);
}
项目:Klooni1010    文件:VanishEffect.java   
@Override
public void draw(Batch batch) {
    vanishElapsed += Gdx.graphics.getDeltaTime();

    // vanishElapsed might be < 0 (delay), so clamp to 0
    float progress = Math.min(1f,
            Math.max(vanishElapsed, 0f) / vanishLifetime);

    // If one were to plot the elasticIn function, they would see that the slope increases
    // a lot towards the end- a linear interpolation between the last size + the desired
    // size at 20% seems to look a lot better.
    vanishSize = MathUtils.lerp(
            vanishSize,
            Interpolation.elasticIn.apply(cell.size, 0, progress),
            0.2f
    );

    float centerOffset = cell.size * 0.5f - vanishSize * 0.5f;
    Cell.draw(vanishColor, batch, cell.pos.x + centerOffset, cell.pos.y + centerOffset, vanishSize);
}
项目:typing-label    文件:WaveEffect.java   
@Override
protected void onApply (Glyph glyph, int localIndex) {
    // Calculate progress
    float progressModifier = (1f / intensity) * DEFAULT_INTENSITY;
    float normalFrequency = (1f / frequency) * DEFAULT_FREQUENCY;
    float progressOffset = localIndex / normalFrequency;
    float progress = calculateProgress(progressModifier, progressOffset);

    // Calculate offset
    float y = getLineHeight() * distance * Interpolation.sine.apply(-1, 1, progress) * DEFAULT_DISTANCE;

    // Calculate fadeout
    float fadeout = calculateFadeout();
    y *= fadeout;

    // Apply changes
    glyph.yoffset += y;
}
项目:typing-label    文件:JumpEffect.java   
@Override
protected void onApply (Glyph glyph, int localIndex) {
    // Calculate progress
    float progressModifier = (1f / intensity) * DEFAULT_INTENSITY;
    float normalFrequency = (1f / frequency) * DEFAULT_FREQUENCY;
    float progressOffset = localIndex / normalFrequency;
    float progress = calculateProgress(progressModifier, -progressOffset, false);

    // Calculate offset
    float interpolation = 0;
    float split = 0.2f;
    if (progress < split) {
        interpolation = Interpolation.pow2Out.apply(0, 1, progress / split);
    } else {
        interpolation = Interpolation.bounceOut.apply(1, 0, (progress - split) / (1f - split));
    }
    float y = getLineHeight() * distance * interpolation * DEFAULT_DISTANCE;

    // Calculate fadeout
    float fadeout = calculateFadeout();
    y *= fadeout;

    // Apply changes
    glyph.yoffset += y;
}
项目:gdx-cclibs    文件:FullScreenFader.java   
public void render(float deltaTime){
    if (elapsed >= fadeTime)
        return;

    if (delay > 0){
        delay -= deltaTime;
    }

    GL20 gl = Gdx.gl20;
    gl.glEnable(GL20.GL_BLEND);
    gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

    color.a = delay > 0 ? 1f : 1f - Interpolation.fade.apply( elapsed / fadeTime);

    if (shader==null)
        createShader();
    shader.begin();
    shader.setUniformf(u_color, color);
    mesh.render(shader, GL20.GL_TRIANGLE_FAN);

    shader.end();

    if (delay <= 0)
        elapsed += deltaTime;
}
项目:FlappySpinner    文件:MarketScreen.java   
public void setUpSkinImages() {
    skinImage = new Image(skins.get(position).getTextureRegion());
    skinImageRotation = new Image(skins.get(position).getTextureRegion());

    skinImage.setSize(3f, 3f);
    skinImage.setOrigin(skinImage.getWidth() / 2, skinImage.getHeight() / 2);
    skinImage.setPosition(Constants.WIDTH / 3 - skinImage.getWidth() / 2, Constants.HEIGHT / 2);

    skinImageRotation.setSize(3f, 3f);
    skinImageRotation.setOrigin(skinImageRotation.getWidth() / 2, skinImageRotation.getHeight() / 2);
    skinImageRotation.setPosition(Constants.WIDTH * 2 / 3 - skinImageRotation.getWidth() / 2, Constants.HEIGHT / 2);

    SequenceAction rotateAction = new SequenceAction();
    rotateAction.addAction(Actions.rotateBy(360, 0.5f, Interpolation.linear));
    RepeatAction infiniteLoop = new RepeatAction();
    infiniteLoop.setCount(RepeatAction.FOREVER);
    infiniteLoop.setAction(rotateAction);

    skinImageRotation.addAction(infiniteLoop);
    stage.addActor(skinImageRotation);
    stage.addActor(skinImage);
}
项目:odb-little-fortune-planet    文件:FeatureScreenSetupSystem.java   
public void addLogo() {

        // approximate percentage of screen size with logo. Use rounded numbers to keep the logo crisp.

        float zoom = Anims.scaleToScreenRounded(0.8f, FeatureScreenAssetSystem.LOGO_WIDTH);

        Anims.createCenteredAt(
                FeatureScreenAssetSystem.LOGO_WIDTH,
                FeatureScreenAssetSystem.LOGO_HEIGHT,
                "logo",
                zoom)
                .tint(COLOR_LOGO_FADED)
                .script(
                        scaleBetween(zoom * 2, zoom, 2f, Interpolation.bounceOut),
                        tween(new Tint(COLOR_LOGO_FADED), new Tint(COLOR_LOGO_FULL), 2f, Interpolation.fade)
                );

    }
项目:odb-little-fortune-planet    文件:StarEffectSystem.java   
private void trustEffect() {

        // work towards full thrust.
        if (active) {
            timer += world.delta * 0.25f;
            timer = MathUtils.clamp(timer, 0f, 1f);
            speedFactor = Interpolation.exp5.apply(timer * 0.6f);
            if (playSoundState == 0) {
                playSoundState = 1;
            }
        } else {
            timer -= world.delta * 0.25f;
            timer = MathUtils.clamp(timer, 0f, 1f);
            speedFactor = Interpolation.exp5.apply(timer * 0.6f);
            if (playSoundState == 1) {
                playSoundState = 0;
            }
        }

    }
项目:odb-little-fortune-planet    文件:MyCameraSystem.java   
@Override
protected void processSystem() {
    if (cooldown > 0 && !G.DEBUG_SKIP_INTRO) {
        if ( cooldown < 2f ) {
            starEffectSystem.active=false;
        }
        starEffectSystem.active = true;
        cooldown -= world.delta;
        if (cooldown < 0) cooldown = 0;
        camera.position.y = Interpolation.pow2In.apply(y, y + G.SCREEN_HEIGHT / 2, MathUtils.clamp(cooldown / VISIBLE_FOCUS_COOLDOWN,0f,1f));
        camera.update();
    } else  {
        if ( !introDone ) {
            introDone=true;
            gameScreenAssetSystem.playMusicInGame();
        }
        starEffectSystem.active = false;
    }
    super.processSystem();
}
项目:odb-little-fortune-planet    文件:PlanetCreationSystem.java   
@Override
protected void initialize() {
    super.initialize();
    loadPlanets();

    if (!G.DEBUG_SKIP_INTRO) {
        E.E()
                .pos()
                .anim("logo")
                .animLoop(false)
                .renderLayer(10000)
                .tint(Tint.TRANSPARENT)
                .script(
                        parallel(
                                tween(logoStartPos, logoEndPos, 10f, Interpolation.linear),
                                sequence(
                                        delay(2f),
                                        tween(Tint.TRANSPARENT, Tint.WHITE, 1f, Interpolation.linear),
                                        delay(2f),
                                        tween(Tint.WHITE, Tint.TRANSPARENT, 4f, Interpolation.linear)
                                )
                        )
                );
    }
}
项目:ClickerGame    文件:Player.java   
public void reactOnClick() {
    //Action testAction = Actions.moveBy(10, 15);//sizeBy, moveBy and other action :D
    int xMoveAmount = MathUtils.random(-130, 130);

    Action moveAction = Actions.sequence(
            Actions.moveBy(xMoveAmount, 10, 0.30f, Interpolation.circleOut),
            Actions.moveBy(-xMoveAmount, -10, 0.30f, Interpolation.circle)
    );

    int yGrowAmount = MathUtils.random(-30, 100);

    Action growAction = Actions.sequence(
            Actions.sizeBy(yGrowAmount, 20, 0.2f, Interpolation.circleOut),
            Actions.sizeBy(-yGrowAmount, -20, 0.2f, Interpolation.circle)
    );

    this.addAction(moveAction);
    this.addAction(growAction);

    if(this.getHeight() > 170) {
        this.addAction(Actions.rotateBy(MathUtils.randomSign() * 360, 0.4f));
    }
}
项目:odb-dynasty    文件:FeatureScreenSetupSystem.java   
public void addLogo() {

        // approximate percentage of screen size with logo. Use rounded numbers to keep the logo crisp.

        float zoom = Anims.scaleToScreenRounded(0.8f, FeatureScreenAssetSystem.LOGO_WIDTH);
        final Entity entity = Anims.createCenteredAt(world,
                FeatureScreenAssetSystem.LOGO_WIDTH,
                FeatureScreenAssetSystem.LOGO_HEIGHT,
                "logo",
                zoom);

        E.edit(entity)
                .tint(COLOR_LOGO_FADED)
                .schedule(
                        scaleBetween(zoom * 2, zoom, 2f, Interpolation.bounceOut),
                        tween(new Tint(COLOR_LOGO_FADED), new Tint(COLOR_LOGO_FULL), 2f, Interpolation.fade)
                );

    }
项目:odb-dynasty    文件:DilemmaSystem.java   
public float createLabel(int x, int y, String color, String text, String shadowTextColor, int maxWidth) {
    Label label = new Label(text, TEXT_ZOOM);
    label.shadowColor = new Tint(shadowTextColor);
    label.maxWidth = maxWidth;
    int insertDistanceY =AssetSystem.SLAB_HEIGHT*G.ZOOM;
    DynastyEntityBuilder builder = new DynastyEntityBuilder(world)
            .with(label)
            .group(DILEMMA_GROUP)
            .pos(x, y- insertDistanceY)
            .renderable(920)
            .scale(TEXT_ZOOM)
            .tint(color);

    builder.schedule(OperationFactory.tween(new Pos(x,y -insertDistanceY ),
            new Pos(x, y), 1f, Interpolation.pow4Out ));

    builder
            .build();
    return labelRenderSystem.estimateHeight(label);
}
项目:odb-dynasty    文件:DilemmaSystem.java   
private float createOption(int x, int y, String text, ButtonListener listener, int maxWidth) {
    //createLabel(x, y, COLOR_DILEMMA, text);
    Label label = new Label(text, TEXT_ZOOM);
    label.shadowColor = new Tint(DILEMMA_SHADOW_TEXT_COLOR);
    label.maxWidth = maxWidth;
    float height = labelRenderSystem.estimateHeight(label);
    int insertDistanceY =AssetSystem.SLAB_HEIGHT*G.ZOOM;
    DynastyEntityBuilder builder = new DynastyEntityBuilder(world)
            .with(Tint.class).with(
                    new Bounds(0, (int) -height, text.length() * 8, 0),
                    new Clickable(),
                    new Button(COLOR_RAW_DIMMED, COLOR_RAW_BRIGHT, COLOR_RAW_BRIGHT, listener),
                    label
            )
            .group(DILEMMA_GROUP)
            .renderable(920)
            .pos(x, y-insertDistanceY)
            .scale(TEXT_ZOOM);

    builder.schedule(OperationFactory.tween(new Pos(x,y-insertDistanceY),
            new Pos(x, y), 1f, Interpolation.pow4Out ));
    builder.build();
    return height;
}
项目:SpaceShift    文件:FullScreenFader.java   
public void render(float deltaTime){
    if (!on && alpha == 0)
        return; //nothing to draw or update

    alpha += (on ? 1 : -1) * deltaTime / fadeTime;
    alpha = Math.max(0, Math.min(1, alpha));

    GL20 gl = Gdx.gl20;
    gl.glEnable(GL20.GL_BLEND);
    gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

    color.a = Interpolation.fade.apply(alpha);

    shader.begin();
    shader.setUniformf(u_color, color);
    mesh.render(shader, GL20.GL_TRIANGLE_FAN);
    shader.end();

}
项目:cachebox3.0    文件:Menu.java   
private void showWidgetGroup() {
    clearActions();
    pack();

    mainMenuWidgetGroup = new WidgetGroup();
    mainMenuWidgetGroup.setName(this.name.toString());
    mainMenuWidgetGroup.setBounds(this.getX(), this.getY(), this.getWidth(), this.getHeight());
    mainMenuWidgetGroup.addActor(this);

    if (this.parentMenu == null) {
        showingStage = StageManager.showOnNewStage(mainMenuWidgetGroup);
    } else {
        showingStage = StageManager.showOnActStage(mainMenuWidgetGroup);
    }

    if (this.parentMenu == null)
        addAction(sequence(Actions.alpha(0), Actions.fadeIn(CB.WINDOW_FADE_TIME, Interpolation.fade)));
    isShowing = true;
}
项目:dice-heroes    文件:DropVisualizer.java   
@Override public IFuture<Void> visualize(DroppedItem drop) {
    final Future<Void> future = new Future<Void>();

    Group group = new Group();
    Tile image = new Tile("item/" + drop.item.name);
    Label counter = new Label(String.valueOf(drop.count), Config.skin);
    counter.setSize(image.getWidth(), image.getHeight());
    counter.setAlignment(Align.right | Align.bottom);
    group.addActor(image);
    group.addActor(counter);
    group.setTransform(false);
    visualizer.viewController.notificationLayer.addActor(group);
    group.setPosition(drop.target.getX() * ViewController.CELL_SIZE, drop.target.getY() * ViewController.CELL_SIZE);
    group.addAction(Actions.parallel(
        Actions.moveBy(0, 30, 1f, Interpolation.fade),
        Actions.alpha(0, 1f, Interpolation.fade),
        Actions.delay(0.4f, Actions.run(new Runnable() {
            @Override public void run() {
                future.happen();
            }
        }))
    ));
    return future;
}
项目:dice-heroes    文件:SpawnController.java   
private void refreshStartButton() {
    startButton.setDisabled(placed.size == 0);
    startButton.clearActions();
    if (placed.size == 0) {
        startButton.addAction(Actions.moveTo(
                world.stage.getWidth() / 2 - startButton.getWidth() / 2,
                world.stage.getHeight() + startButton.getHeight(),
                0.5f,
                Interpolation.swingIn
        ));
    } else {
        startButton.addAction(Actions.moveTo(
                world.stage.getWidth() / 2 - startButton.getWidth() / 2,
                world.stage.getHeight() - startButton.getHeight() - 4,
                0.5f,
                Interpolation.swingOut
        ));
    }
}
项目:dice-heroes    文件:SoundManager.java   
public void playMusicBeautifully(String name, Stage stage) {
    final Music music = musics.get(name);
    if (music == null) {
        Logger.error("there is no music for " + name);
        return;
    }
    music.setVolume(0);
    if (!usesMusic) {
        disabledMusics.add(music);
    } else {
        music.play();
    }
    music.setLooping(true);
    playingMusics.add(music);
    Action action = new TemporalAction(5f, Interpolation.linear) {
        @Override protected void update(float percent) {
            music.setVolume(percent * volume);
        }
    };
    stage.addAction(action);
    replaceAction(music, action);
}
项目:dice-heroes    文件:SoundManager.java   
public void stopMusicBeautifully(String name, Stage stage) {
    final Music music = musics.get(name);
    if (music == null) {
        Logger.error("there is no music for " + name);
        return;
    }
    final float initialVolume = music.getVolume();
    Action action = new TemporalAction(2f, Interpolation.linear) {
        @Override protected void update(float percent) {
            music.setVolume(initialVolume - percent * initialVolume);
        }

        @Override protected void end() {
            music.stop();
            playingMusics.remove(music);
            disabledMusics.remove(music);
        }
    };
    stage.addAction(action);
    replaceAction(music, action);
}
项目:dice-heroes    文件:LocalAchievements.java   
private void checkQueue() {
    if (current != null || queue.size == 0)
        return;
    current = queue.removeIndex(0);
    stage.addActor(current);
    current.setPosition(stage.getWidth() / 2 - current.getWidth() / 2, stage.getHeight() - current.getHeight() - 10);
    current.getColor().a = 0;
    current.addAction(sequence(
        moveBy(0, current.getHeight() + 10),
        parallel(
            alpha(1, 0.5f),
            moveBy(0, -current.getHeight() - 10, 0.5f, Interpolation.swingOut)
        ),
        delay(2.5f),
        alpha(0, 1f),
        run(new Runnable() {
            @Override public void run() {
                current.remove();
                current = null;
                checkQueue();
            }
        })
    ));
}
项目:throw-the-moon    文件:Enemy.java   
public void takeDamage(int direction) {
    health--;

    hitSfx.play();

    if (health <= 0) {
        die();
        return;
    }

    addAction(
        sequence(
            parallel(
                Actions.moveBy(20 * direction, 0, 0.3f, Interpolation.circleOut), sequence(color(Color.BLACK, 0.15f), color(Color.WHITE, 0.15f))),
                Actions.moveTo(getX(), getY(), 0.1f, Interpolation.circleIn)));
}
项目:QuickFlix    文件:MenuScene.java   
@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);
}
项目:QuickFlix    文件:MenuScene.java   
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;
}
项目:QuickFlix    文件:MenuScene.java   
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;
}
项目:tox    文件:ParticleSystem.java   
private Entity addParticle(int cx, int cy, String name) {
    Animation animation = new Animation(name, Animation.Layer.PARTICLE);
    animation.age = MathUtils.random(4f);
    animation.color.a = 0.7f;
    animation.frozen=false;
    animation.speed = 0.5f;
    animation.scale = 3;
    final Physics physics = new Physics();
    physics.velocityX = MathUtils.random(-4f,4f);
    physics.velocityY = MathUtils.random(-4f,4f);
    return Tox.world.createEntity().addComponent(new Position(cx - 5 * animation.scale, cy - 5 * animation.scale))
            .addComponent(animation)
            .addComponent(physics)
            .addComponent(new Terminal(0.5f))
            .addComponent(new ColorAnimation(new Color(1, 1, 1, 0.6f), new Color(1, 1, 1, 0f), Interpolation.exp5, 2, 0.5f));
}
项目:Dodgy-Dot    文件:GameScreen.java   
public void gameOverSetup () {
    retry = new Retry();
    retry.getColor().a = 0;
    retry.addAction(Actions.parallel(Actions.fadeIn(1f),Actions.moveTo(RETRY_X * 100, RETRY_Y * 100, 1f, Interpolation.bounceOut)));
    stage.addActor(retry);
    retry.setZIndex(50);

    if ((int) playTime > game.highScore) {
        game.highScore = (int) playTime;
        game.pref.putInteger("Score", game.highScore);
        game.pref.flush();
    }

    highScoreLabel = new Label(Integer.toString(game.highScore), game.labelStyle);
    highScoreLabel.setFontScale(1.5f);
    highScoreLabel.setPosition(VIRTUAL_WIDTH - highScoreLabel.getWidth(),  VIRTUAL_HEIGHT - highScoreLabel.getHeight() - 300);
    highScoreLabel.setAlignment(Align.right);
    stage.addActor(highScoreLabel);
    stage.addActor(game.highScoreWordsLabel);
    highScoreLabel.getColor().a = game.highScoreWordsLabel.getColor().a = 0;
    highScoreLabel.setZIndex(50);
    game.highScoreWordsLabel.setZIndex(50);
    highScoreLabel.addAction(Actions.fadeIn(0.25f));
    game.highScoreWordsLabel.addAction(Actions.fadeIn(0.25f));
}
项目:Mundus    文件:PerlinNoiseGenerator.java   
@Override
public void terraform() {
    rand.setSeed(seed);

    // final float d = (float) Math.pow(2, this.octaves);

    for (int i = 0; i < terrain.heightData.length; i++) {
        int x = i % terrain.vertexResolution;
        int z = (int) Math.floor((double) i / terrain.vertexResolution);

        float height = Interpolation.linear.apply(minHeight, maxHeight, getInterpolatedNoise(x / 4f, z / 4f));
        height += Interpolation.linear.apply(minHeight / 3f, maxHeight / 3f, getInterpolatedNoise(x / 2f, z / 2f));

        terrain.heightData[z * terrain.vertexResolution + x] = height;
    }

    terrain.update();
}
项目:lets-code-game    文件:FieldActor.java   
public void animateTouched() {
    if (field == null)
        return;

    int baseDirection = isTriangleUpper ? 1 : -1;
    float displacement = baseDirection * getHeight() * getScaleY() * 0.3f;
    float time = 0.2f;

    toFront();
    addAction(
        sequence(
            parallel(
                moveBy(0, displacement, time/2, Interpolation.sineOut)
            ),
            parallel(
                moveBy(0, -displacement, time/2, Interpolation.sineIn)
            )
        )
    );
}
项目:umbracraft    文件:TouchpadEntity.java   
@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
    touch.x = screenX;
    touch.y = screenY;
    touch.z = 0;
    this.pointer = pointer;
    Game.view().getViewport().unproject(touch);
    if (touch.x < Config.viewWidth * 0.6f && touch.y < Config.viewHeight * 0.6f) {
        touchpad.setBounds(touch.x - SIZE / 2, touch.y - SIZE / 2, 60, 60);
        if (!visible) {
            visible = true;
            touchpad.addAction(Actions.alpha(0.5f, 0.2f, Interpolation.pow2Out));
        }
    }
    return false;
}
项目:umbracraft    文件:TouchpadEntity.java   
@Override
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
    touch.x = screenX;
    touch.y = screenY;
    touch.z = 0;
    Game.view().getViewport().unproject(touch);
    if (this.pointer != pointer || touch.x < 0 || touch.x > Config.viewWidth || touch.y < 0 || touch.y > Config.viewHeight) {
        return true;
    } else {
        if (visible) {
            visible = false;
            touchpad.addAction(Actions.alpha(0f, 0.2f, Interpolation.pow2In));
        }
        return false;
    }
}
项目:umbracraft    文件:MessageWindowLayout.java   
@Override
public void hide(final Listener completeListener) {

    for (MessageLabel messageLabel : messageLabels) {
        messageLabel.addAction(Actions.sequence(Actions.delay(SHOW_TRANSITION_TIME), Actions.parallel(Actions.moveBy(0, -10, SHOW_TRANSITION_TIME, Interpolation.pow2In), Actions.alpha(0, SHOW_TRANSITION_TIME))));
    }
    nameTable.addAction(Actions.sequence(Actions.parallel(Actions.alpha(0, SHOW_TRANSITION_TIME), Actions.moveBy(-10, 0, SHOW_TRANSITION_TIME, Interpolation.pow2Out))));
    faceTable.addAction(Actions.sequence(Actions.parallel(Actions.alpha(0, SHOW_TRANSITION_TIME), Actions.moveBy(-10, 0, SHOW_TRANSITION_TIME, Interpolation.pow2Out))));
    messageWindow.addAction(Actions.sequence(Actions.delay(SHOW_TRANSITION_TIME), Actions.parallel(Actions.moveBy(0, -10, SHOW_TRANSITION_TIME, Interpolation.pow2In), Actions.alpha(0, SHOW_TRANSITION_TIME)), Actions.run(new Runnable() {

        @Override
        public void run() {
            completeListener.invoke();
        }
    })));
}
项目:LWPTools    文件:FullScreenFader.java   
public void render(float deltaTime){
    if (elapsed >= fadeTime)
        return;

    if (delay > 0){
        delay -= deltaTime;
    }

    GL20 gl = Gdx.gl20;
    gl.glEnable(GL20.GL_BLEND);
    gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

    color.a = delay > 0 ? 1f : 1f - Interpolation.fade.apply( elapsed / fadeTime);

    if (shader==null)
        createShader();
    shader.begin();
    shader.setUniformf(u_color, color);
    mesh.render(shader, GL20.GL_TRIANGLE_FAN);

    shader.end();

    if (delay <= 0)
        elapsed += deltaTime;
}