本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.actions.MoveToAction类的典型用法代码示例。如果您正苦于以下问题:Java MoveToAction类的具体用法?Java MoveToAction怎么用?Java MoveToAction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MoveToAction类属于com.badlogic.gdx.scenes.scene2d.actions包,在下文中一共展示了MoveToAction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldParseSpriteView
import com.badlogic.gdx.scenes.scene2d.actions.MoveToAction; //导入依赖的package包/类
@Test
@NeedGL
public void shouldParseSpriteView() throws Exception {
CocoStudioUIEditor editor = new CocoStudioUIEditor(
Gdx.files.internal("animation/MainScene.json"), null, null, null, null);
Group group = editor.createGroup();
Image image = group.findActor("st_2");
Array<Action> actions = image.getActions();
assertThat(actions.size, is(1));
RepeatAction repeatAction = (RepeatAction) actions.get(0);
ParallelAction parallelAction = (ParallelAction) repeatAction.getAction();
assertThat(parallelAction.getActions().size, is(3));
assertThat(parallelAction.getActions(), (Matcher) everyItem(instanceOf(SequenceAction.class)));
SequenceAction moveAction = (SequenceAction) parallelAction.getActions().get(0);
SequenceAction scaleAction = (SequenceAction) parallelAction.getActions().get(1);
assertThat(moveAction.getActions().size, is(4));
assertThat(moveAction.getActions(), (Matcher) everyItem(instanceOf(MoveToAction.class)));
assertThat(scaleAction.getActions().size, is(4));
assertThat(scaleAction.getActions(), (Matcher) everyItem(instanceOf(ScaleToAction.class)));
}
示例2: addBackgroundExtension
import com.badlogic.gdx.scenes.scene2d.actions.MoveToAction; //导入依赖的package包/类
private void addBackgroundExtension() {
Image stobottom = new Image(new TextureRegion(manager.getAssetsExtension().getTexture(NameFiles.imageArrowBottom)));
stobottom.setSize(Gdx.graphics.getWidth() * 0.1f, Gdx.graphics.getWidth() * 0.22f);
stobottom.setPosition(Gdx.graphics.getWidth() / 2 - stobottom.getWidth() / 2, Gdx.graphics.getHeight() * 0.74f);
Image selectroomtext = new Image(new TextureRegion(manager.getAssetsExtension().getTexture(NameFiles.txtSelectExtension)));
selectroomtext.setSize(Gdx.graphics.getWidth() * 0.44f, Gdx.graphics.getHeight() * 0.12f);
selectroomtext.setPosition(Gdx.graphics.getWidth() / 2 - selectroomtext.getWidth() / 2, Gdx.graphics.getHeight() * 0.815f);
RepeatAction repeatActioan = new RepeatAction();
MoveToAction fadedown = new MoveToAction();
fadedown.setPosition(Gdx.graphics.getWidth() / 2 - stobottom.getWidth() / 2, Gdx.graphics.getHeight() * 0.71f);
fadedown.setDuration(0.5f);
MoveToAction fadeup = new MoveToAction();
fadeup.setPosition(Gdx.graphics.getWidth() / 2 - stobottom.getWidth() / 2, Gdx.graphics.getHeight() * 0.74f);
fadeup.setDuration(1f);
repeatActioan.setAction(new SequenceAction(fadedown, fadeup));
repeatActioan.setCount(RepeatAction.FOREVER);
stobottom.addAction(repeatActioan);
groupBtn = new Group();
groupBtn.addActor(stobottom);
groupBtn.addActor(selectroomtext);
}
示例3: move3
import com.badlogic.gdx.scenes.scene2d.actions.MoveToAction; //导入依赖的package包/类
private void move3(Group gr, float procent, float time) {
MoveToAction move = new MoveToAction();
move.setDuration(time);
if(time==0) {
move.setPosition(0, -procent * distanceReference);
}else {
if(Math.abs(procent)<=0.5) {
move.setPosition(0, 0);
}else if(procent>0.5){
move.setPosition(p2.x,p2.y);
}else{
move.setPosition(p4.x,p4.y);
}
}
gr.addAction(move);
}
示例4: show
import com.badlogic.gdx.scenes.scene2d.actions.MoveToAction; //导入依赖的package包/类
@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);
}
示例5: showMenu
import com.badlogic.gdx.scenes.scene2d.actions.MoveToAction; //导入依赖的package包/类
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;
}
示例6: showExit
import com.badlogic.gdx.scenes.scene2d.actions.MoveToAction; //导入依赖的package包/类
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;
}
示例7: play
import com.badlogic.gdx.scenes.scene2d.actions.MoveToAction; //导入依赖的package包/类
private void play() {
AlphaAction alphaAction = new AlphaAction();
alphaAction.setAlpha(0);
alphaAction.setDuration(0.5f);
play.addAction(alphaAction);
play.setTouchable(Touchable.disabled);
MoveToAction moveToAction = new MoveToAction();
moveToAction.setPosition(gameTitle.getX(), HEIGHT * 12 / 13 - gameTitle.getHeight());
moveToAction.setDuration(2);
gameTitle.addAction(moveToAction);
Timer.instance().clear();
gameTitle.setText("L'Odyssée des Maths");
currentState = State.TRANSITION;
}
示例8: translateup
import com.badlogic.gdx.scenes.scene2d.actions.MoveToAction; //导入依赖的package包/类
private void translateup(Group[] arrayGroup) {
ScaleToAction scaleToAction = new ScaleToAction();
scaleToAction.setScale(1, 1);
scaleToAction.setDuration(0.4f);
MoveToAction moveToAction = new MoveToAction();
moveToAction.setPosition(0, 0);
moveToAction.setDuration(0.4f);
arrayGroup[1].toFront();
arrayGroup[1].addAction(moveToAction);
arrayGroup[1].addAction(scaleToAction);
ScaleToAction scaleToAction1 = new ScaleToAction();
scaleToAction1.setScale(0.8f, 0.8f);
scaleToAction1.setDuration(0.4f);
MoveToAction moveToAction1 = new MoveToAction();
moveToAction1.setPosition(Gdx.graphics.getWidth() * 0.1f, Gdx.graphics.getHeight() * 0.28f);
moveToAction1.setDuration(0.4f);
arrayGroup[0].addAction(scaleToAction1);
arrayGroup[0].addAction(moveToAction1);
MoveToAction moveToAction2 = new MoveToAction();
moveToAction2.setPosition(Gdx.graphics.getWidth() * 0.1f, -Gdx.graphics.getHeight() * 0.1f);
moveToAction2.setDuration(0.4f);
arrayGroup[2].addAction(moveToAction2);
MoveToAction moveToAction3 = new MoveToAction();
moveToAction3.setPosition(Gdx.graphics.getWidth() * 0.1f, 0);
moveToAction3.setDuration(0.4f);
arrayGroup[3].addAction(moveToAction3);
}
示例9: translatebottom
import com.badlogic.gdx.scenes.scene2d.actions.MoveToAction; //导入依赖的package包/类
private void translatebottom(Group[] group) {
ScaleToAction scaleToAction = new ScaleToAction();
scaleToAction.setScale(1, 1);
scaleToAction.setDuration(0.4f);
MoveToAction moveToAction = new MoveToAction();
moveToAction.setPosition(0, 0);
moveToAction.setDuration(0.4f);
group[3].toFront();
group[3].addAction(moveToAction);
group[3].addAction(scaleToAction);
ScaleToAction scaleToAction1 = new ScaleToAction();
scaleToAction1.setScale(0.8f, 0.8f);
scaleToAction1.setDuration(0.4f);
MoveToAction moveToAction1 = new MoveToAction();
moveToAction1.setPosition(Gdx.graphics.getWidth() * 0.1f, -Gdx.graphics.getHeight() * 0.1f);
moveToAction1.setDuration(0.4f);
group[0].addAction(moveToAction1);
group[0].addAction(scaleToAction1);
MoveToAction moveToAction2 = new MoveToAction();
moveToAction2.setPosition(Gdx.graphics.getWidth() * 0.1f, Gdx.graphics.getHeight() * 0.28f);
moveToAction2.setDuration(0.4f);
group[2].addAction(moveToAction2);
MoveToAction moveToAction3 = new MoveToAction();
moveToAction3.setPosition(Gdx.graphics.getWidth() * 0.1f, 0);
moveToAction3.setDuration(0.4f);
group[1].addAction(moveToAction3);
}
示例10: createPuls
import com.badlogic.gdx.scenes.scene2d.actions.MoveToAction; //导入依赖的package包/类
public Group createPuls(float x, float y){
grPuls = new Group();
Texture txt = managerAssets.getAssetsTutorial().getTexture(NameFiles.circlePulsTutorial);
Image image = new Image(new TextureRegion(txt));
Vector2 crop = Scaling.fit.apply(txt.getWidth(),txt.getHeight(),WIDTH,HEIGHT);
image.setSize(crop.x * 0.135f, crop.y * 0.135f);
image.setPosition(x, y);
grPuls.addActor(image);
txt = managerAssets.getAssetsTutorial().getTexture(NameFiles.PulsCircleScalable);
Image puls = new Image(new TextureRegion(txt));
crop = Scaling.fit.apply(txt.getWidth(),txt.getHeight(),WIDTH,HEIGHT);
puls.setPosition(image.getRight() - image.getWidth() / 2, image.getTop() - image.getHeight() / 2);
puls.setSize(1, 1);
MoveToAction move = new MoveToAction();
move.setDuration(1);
move.setPosition(image.getRight() - image.getWidth() / 2 - crop.x*0.085f, image.getTop() - image.getHeight() / 2 - crop.y*0.085f);
MoveToAction mo = new MoveToAction();
mo.setDuration(0);
mo.setPosition(image.getRight() - image.getWidth() / 2, image.getTop() - image.getHeight() / 2);
ScaleToAction scale = new ScaleToAction();
scale.setScale(WIDTH*0.17f);
scale.setDuration(1);
ScaleToAction sc = new ScaleToAction();
sc.setDuration(0);
sc.setScale(0);
RepeatAction repeat = new RepeatAction();
repeat.setCount(RepeatAction.FOREVER);
repeat.setAction(new SequenceAction(scale, sc));
puls.addAction(repeat);
RepeatAction r = new RepeatAction();
r.setCount(RepeatAction.FOREVER);
r.setAction(new SequenceAction(move, mo));
puls.addAction(r);
grPuls.addActor(puls);
return grPuls;
}
示例11: FadeIn
import com.badlogic.gdx.scenes.scene2d.actions.MoveToAction; //导入依赖的package包/类
public void FadeIn(){
gr.clearActions();
MoveToAction in = new MoveToAction();
in.setPosition(0.0f, 0.0f);
in.setDuration(2f);
gr.addAction(in);
}
示例12: move0
import com.badlogic.gdx.scenes.scene2d.actions.MoveToAction; //导入依赖的package包/类
private void move0(Group gr, float procent, float time) {
MoveToAction move = new MoveToAction();
move.setDuration(time);
ScaleToAction scale = new ScaleToAction();
scale.setDuration(time);
if(time == 0) {
gr.clearActions();
gr.clearActions();
if (procent < 0) {
scale.setScale(0.5f + (Math.abs(procent) * 0.3f));
move.setPosition(p0.x + procent * d01.x, p0.y + (1 - (procent * d01.y)));
addfirst();
}else{
scale.setScale(0.5f);
move.setPosition(p0.x,p0.y);
}
}else{
if(Math.abs(procent)<=0.5){
scale.setScale(0.5f);
move.setPosition(p0.x,p0.y);
}else if(procent < -0.5) {
scale.setScale(0.8f);
move.setPosition(p1.x, p1.y);
addfirst();
}else{
scale.setScale(0.5f);
move.setPosition(p0.x,p0.y);
}
}
gr.addAction(scale);
gr.addAction(move);
}
示例13: move1
import com.badlogic.gdx.scenes.scene2d.actions.MoveToAction; //导入依赖的package包/类
private void move1(Group gr, float procent, float time) {
MoveToAction move = new MoveToAction();
move.setDuration(time);
ScaleToAction scale = new ScaleToAction();
scale.setDuration(time);
if(time == 0) {
gr.clearActions();
gr.clearActions();
if (procent > 0) {
scale.setScale(0.8f - (Math.abs(procent) * 0.3f));
move.setPosition(p1.x + (procent * d01.x), p1.y + (1 - (procent * d01.y)));
} else {
scale.setScale(0.8f + (Math.abs(procent) * 0.2f));
move.setPosition(p1.x + (procent * d12.x), p1.y + (1 - (procent * d12.y)));
}
}else{
if(Math.abs(procent)<=0.5){
scale.setScale(0.8f);
move.setPosition(p1.x,p1.y);
}else if(procent > 0.5){
scale.setScale(0.5f);
move.setPosition(p0.x, p0.y);
}else{
scale.setScale(1);
move.setPosition(p2.x,p2.y);
}
}
gr.addAction(scale);
gr.addAction(move);
}
示例14: move2
import com.badlogic.gdx.scenes.scene2d.actions.MoveToAction; //导入依赖的package包/类
private void move2(Group gr, float procent, float time) {
MoveToAction move = new MoveToAction();
move.setDuration(time);
ScaleToAction scale = new ScaleToAction();
scale.setDuration(time);
if(time == 0) {
if (procent > 0) {
scale.setScale(1 - (Math.abs(procent) * 0.2f));
move.setPosition(p2.x + procent * d12.x, p2.y + (1 - (procent * d12.y)));
} else {
scale.setScale(1);
move.setPosition(0, p2.y - procent * distanceReference);
}
}else{
if(Math.abs(procent)<=0.5){
scale.setScale(1);
move.setPosition(p2.x,p2.y);
}else if(procent>0.5){
scale.setScale(0.8f);
move.setPosition(p1.x,p1.y);
}else{
scale.setScale(1);
move.setPosition(0,0);
}
}
gr.addAction(scale);
gr.addAction(move);
}
示例15: move4
import com.badlogic.gdx.scenes.scene2d.actions.MoveToAction; //导入依赖的package包/类
private void move4(Group gr, float procent, float time) {
MoveToAction move = new MoveToAction();
move.setDuration(time);
ScaleToAction scale = new ScaleToAction();
scale.setDuration(time);
if (time ==0) {
if (procent > 0) {
scale.setScale(1);
move.setPosition(0, p4.y - procent * distanceReference);
} else {
scale.setScale(1 - (Math.abs(procent) * 0.2f));
move.setPosition(p4.x - procent * d45.x, p4.y + (1 - (procent * d45.y)));
}
}else{
if(Math.abs(procent)<=0.5){
scale.setScale(1);
move.setPosition(p4.x,p4.y);
}else if(procent>=0.5){
scale.setScale(1);
move.setPosition(0,0);
}else{
scale.setScale(0.8f);
move.setPosition(p5.x,p5.y);
}
}
gr.addAction(scale);
gr.addAction(move);
}