當前位置: 首頁>>代碼示例>>Java>>正文


Java Interpolation類代碼示例

本文整理匯總了Java中com.badlogic.gdx.math.Interpolation的典型用法代碼示例。如果您正苦於以下問題:Java Interpolation類的具體用法?Java Interpolation怎麽用?Java Interpolation使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Interpolation類屬於com.badlogic.gdx.math包,在下文中一共展示了Interpolation類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: tryToTransition

import com.badlogic.gdx.math.Interpolation; //導入依賴的package包/類
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;
        }
    }
}
 
開發者ID:ZKasica,項目名稱:Planet-Generator,代碼行數:17,代碼來源:Scene.java

示例2: showConfig

import com.badlogic.gdx.math.Interpolation; //導入依賴的package包/類
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();
        }
    });
}
 
開發者ID:Anuken,項目名稱:Mindustry,代碼行數:20,代碼來源:BlockConfigFragment.java

示例3: addLogo

import com.badlogic.gdx.math.Interpolation; //導入依賴的package包/類
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)
                );

    }
 
開發者ID:DaanVanYperen,項目名稱:odb-artax,代碼行數:19,代碼來源:FeatureScreenSetupSystem.java

示例4: process

import com.badlogic.gdx.math.Interpolation; //導入依賴的package包/類
@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();
    }
}
 
開發者ID:DaanVanYperen,項目名稱:odb-artax,代碼行數:27,代碼來源:CameraFollowSystem.java

示例5: draw

import com.badlogic.gdx.math.Interpolation; //導入依賴的package包/類
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);
}
 
開發者ID:LonamiWebs,項目名稱:Klooni1010,代碼行數:19,代碼來源:BaseScorer.java

示例6: hide

import com.badlogic.gdx.math.Interpolation; //導入依賴的package包/類
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();
}
 
開發者ID:LonamiWebs,項目名稱:Klooni1010,代碼行數:17,代碼來源:PauseMenuStage.java

示例7: draw

import com.badlogic.gdx.math.Interpolation; //導入依賴的package包/類
@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);
}
 
開發者ID:LonamiWebs,項目名稱:Klooni1010,代碼行數:24,代碼來源:SpinEffect.java

示例8: draw

import com.badlogic.gdx.math.Interpolation; //導入依賴的package包/類
@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);
}
 
開發者ID:LonamiWebs,項目名稱:Klooni1010,代碼行數:22,代碼來源:EvaporateEffect.java

示例9: draw

import com.badlogic.gdx.math.Interpolation; //導入依賴的package包/類
@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);
}
 
開發者ID:LonamiWebs,項目名稱:Klooni1010,代碼行數:21,代碼來源:VanishEffect.java

示例10: onApply

import com.badlogic.gdx.math.Interpolation; //導入依賴的package包/類
@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;
}
 
開發者ID:rafaskb,項目名稱:typing-label,代碼行數:19,代碼來源:WaveEffect.java

示例11: onApply

import com.badlogic.gdx.math.Interpolation; //導入依賴的package包/類
@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;
}
 
開發者ID:rafaskb,項目名稱:typing-label,代碼行數:26,代碼來源:JumpEffect.java

示例12: render

import com.badlogic.gdx.math.Interpolation; //導入依賴的package包/類
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;
}
 
開發者ID:CypherCove,項目名稱:gdx-cclibs,代碼行數:26,代碼來源:FullScreenFader.java

示例13: setUpSkinImages

import com.badlogic.gdx.math.Interpolation; //導入依賴的package包/類
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);
}
 
開發者ID:ZephyrVentum,項目名稱:FlappySpinner,代碼行數:23,代碼來源:MarketScreen.java

示例14: trustEffect

import com.badlogic.gdx.math.Interpolation; //導入依賴的package包/類
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;
            }
        }

    }
 
開發者ID:DaanVanYperen,項目名稱:odb-little-fortune-planet,代碼行數:21,代碼來源:StarEffectSystem.java

示例15: processSystem

import com.badlogic.gdx.math.Interpolation; //導入依賴的package包/類
@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();
}
 
開發者ID:DaanVanYperen,項目名稱:odb-little-fortune-planet,代碼行數:21,代碼來源:MyCameraSystem.java


注:本文中的com.badlogic.gdx.math.Interpolation類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。