当前位置: 首页>>代码示例>>Java>>正文


Java TemporalAction类代码示例

本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.actions.TemporalAction的典型用法代码示例。如果您正苦于以下问题:Java TemporalAction类的具体用法?Java TemporalAction怎么用?Java TemporalAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TemporalAction类属于com.badlogic.gdx.scenes.scene2d.actions包,在下文中一共展示了TemporalAction类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: playMusicBeautifully

import com.badlogic.gdx.scenes.scene2d.actions.TemporalAction; //导入依赖的package包/类
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);
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:23,代码来源:SoundManager.java

示例2: stopMusicBeautifully

import com.badlogic.gdx.scenes.scene2d.actions.TemporalAction; //导入依赖的package包/类
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);
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:22,代码来源:SoundManager.java

示例3: animateCounter

import com.badlogic.gdx.scenes.scene2d.actions.TemporalAction; //导入依赖的package包/类
public static void animateCounter(final Label label, final int from, final int to) {
    label.addAction(new TemporalAction(MathUtils.clamp(Math.abs(to - from) / 30f, 0.5f, 1.5f), new Interpolation.ExpOut(2, 3)) {
        @Override protected void update(float percent) {
            label.setText(String.valueOf((int) (from + (to - from) * percent)));
        }
    });
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:8,代码来源:AnimationHelper.java

示例4: interpolate

import com.badlogic.gdx.scenes.scene2d.actions.TemporalAction; //导入依赖的package包/类
public static TemporalAction interpolate(TemporalAction action,
		Interpolation interpolation) {
	action.setInterpolation(interpolation);
	return action;
}
 
开发者ID:halfreal,项目名称:spezi-gdx,代码行数:6,代码来源:Animations.java


注:本文中的com.badlogic.gdx.scenes.scene2d.actions.TemporalAction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。