当前位置: 首页>>代码示例>>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;未经允许,请勿转载。