本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.Image.addAction方法的典型用法代码示例。如果您正苦于以下问题:Java Image.addAction方法的具体用法?Java Image.addAction怎么用?Java Image.addAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.scenes.scene2d.ui.Image
的用法示例。
在下文中一共展示了Image.addAction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addBackgroundExtension
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的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);
}
示例2: setUpSkinImages
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的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);
}
示例3: createPuls
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的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;
}
示例4: setUpOnPause
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
/**
* SETTING ONSTATE IMAGES
*/
public void setUpOnPause() {
onPause = new Image(AssetsManager.getTextureRegion(Constants.PAUSE_IMAGE_NAME));
onPause.setVisible(false);
onPause.setSize(Constants.WIDTH, Constants.ONPAUSE_HEIGHT);
onPause.setPosition(Constants.WIDTH / 2 - onPause.getWidth() / 2, Constants.HEIGHT / 2 - onPause.getHeight() / 2);
onPause.setOrigin(onPause.getWidth() / 2, onPause.getHeight() / 2);
onPause.addAction(setOnStateImageAction(1.2f));
stage.addActor(onPause);
}
示例5: setUpOnFinish
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
public void setUpOnFinish() {
onFinish = new Image(AssetsManager.getTextureRegion(Constants.FINISH_IMAGE_NAME));
onFinish.setVisible(false);
onFinish.setSize(Constants.WIDTH - 5, Constants.ONFINISH_HEIGHT);
onFinish.setPosition(Constants.WIDTH / 2 - onFinish.getWidth() / 2, Constants.HEIGHT / 2 - onFinish.getHeight() / 5);
onFinish.setOrigin(onFinish.getWidth() / 2, onFinish.getHeight() / 2);
onFinish.addAction(setOnStateImageAction(1.2f));
stage.addActor(onFinish);
}
示例6: setUpOnResume
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
public void setUpOnResume() {
onResume = new Image(AssetsManager.getTextureRegion(Constants.RESUME_IMAGE_NAME));
onResume.setAlign(Align.center);
onResume.setSize(Constants.ONRESUME_WIDTH, Constants.ONRESUME_HEIGHT);
onResume.setOrigin(onResume.getWidth() / 2, onResume.getHeight() / 2);
onResume.setPosition(Constants.WIDTH / 2 - onResume.getWidth() / 2, Constants.HEIGHT / 2 - onResume.getHeight() * 1.5f);
onResume.addAction(setOnStateImageAction(0.7f));
stage.addActor(onResume);
}
示例7: visualize
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
@Override public IFuture<Void> visualize(final T result) {
final Future<Void> future = Future.make();
final WorldObjectView actorView = visualizer.viewController.getView(result.getActor());
WorldObjectView targetView = visualizer.viewController.getView(result.getTarget());
visualizer.viewController.world.dispatcher.dispatch(ResultVisualizer.VISUALIZE_ATTACK, result.getActor());
Vector2 direction = tmp
.set(result.getTarget().getX(), result.getTarget().getY())
.sub(result.getActor().getX(), result.getActor().getY());
float dx = targetView.getX() - actorView.getX();
float dy = targetView.getY() - actorView.getY();
visualizer.viewController.scroller.centerOn(result.getTarget());
final Image arrow = new Image(Config.skin,"animation/" + result.getAbility().name + "-shot");
arrow.setPosition(actorView.getX(), actorView.getY());
visualizer.viewController.effectLayer.addActor(arrow);
arrow.setOrigin(13, 14);
arrow.setRotation(direction.angle() - 45);
arrow.addAction(Actions.sequence(
Actions.moveBy(dx, dy, tmp.set(dx, dy).len() * 0.002f),
Actions.run(new Runnable() {
@Override public void run() {
SoundManager.instance.playSoundIfExists(result.getAbility().soundName);
arrow.remove();
future.happen();
}
})
));
return future;
}
示例8: visualize
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
@Override public IFuture<Void> visualize(ITargetOwner result) {
final Future<Void> future = new Future<Void>();
SoundManager.instance.playSoundIfExists(soundName);
Image image = new Image(Config.skin, "effect-luck-image");
image.setColor(color);
image.setScale(0, 0);
image.setOrigin(image.getWidth() / 2, image.getHeight() / 2);
image.setPosition(
result.getTarget().getX() * ViewController.CELL_SIZE + (ViewController.CELL_SIZE - image.getWidth()) * 0.5f,
result.getTarget().getY() * ViewController.CELL_SIZE + (ViewController.CELL_SIZE - image.getHeight()) * 0.5f + 6
);
visualizer.viewController.effectLayer.addActor(image);
image.addAction(
Actions.sequence(
Actions.parallel(
Actions.scaleTo(0.75f, 0.75f, 0.5f, Interpolation.sine),
Actions.rotateBy(135, 0.5f)
),
Actions.parallel(
Actions.scaleTo(0, 0, 0.5f, Interpolation.sine),
Actions.rotateBy(135, 0.5f)
),
Actions.run(future),
Actions.removeActor()
)
);
return future;
}
示例9: addBackgroundObject
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
private void addBackgroundObject(boolean anywhere) {
final Image image = new Image(backgroundDrawables.random());
backgroundLayer.addActor(image);
float scale = 0.5f * MathUtils.random(1, 2);
image.setSize(image.getPrefWidth() * scale, image.getPrefHeight() * scale);
image.setRotation(MathUtils.random(0, 1) * 180);
image.getColor().a = MathUtils.random(0.1f, 0.3f);
float w = Math.max(world.stage.getWidth(), root.getWidth() + ViewScroller.LEFT + ViewScroller.RIGHT);
float h = Math.max(world.stage.getHeight(), root.getHeight() + ViewScroller.TOP + ViewScroller.BOTTOM);
if (anywhere)
image.setPosition(-root.getX() + w * MathUtils.random(), -root.getY() + h * MathUtils.random());
else
image.setPosition(-root.getX() - image.getWidth(), -root.getY() + h * MathUtils.random());
image.addAction(Actions.sequence(
Actions.moveBy(w + image.getWidth() - image.getX(), 0, 15 + MathUtils.random(6)),
Actions.run(new Runnable() {
@Override public void run() {
image.remove();
addBackgroundObject(false);
}
})
));
}
示例10: rotateContinuously
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
private void rotateContinuously(final Image back) {
back.addAction(Actions.sequence(
Actions.rotateBy(-360, 6f, Interpolation.linear),
Actions.run(new Runnable() {
@Override public void run() {
rotateContinuously(back);
}
})
));
}
示例11: blink
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
private void blink(final Image image) {
image.addAction(Actions.sequence(
Actions.alpha(0.4f, 0.5f),
Actions.alpha(0f, 0.5f),
Actions.run(new Runnable() {
@Override public void run() {
blink(image);
}
})
));
}
示例12: IntroHud
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
public IntroHud(Application APP, Viewport viewport, SpriteBatch batch, Font slimJoe, Font bigJohn)
{
super(viewport, batch);
this.APP = APP;
this.slimJoe = slimJoe;
this.bigJohn = bigJohn;
background = new Image(new Texture("backgrounds/white.jpg"));
title = new Label("NahroTo", new Label.LabelStyle(bigJohn.getFont(), Color.WHITE));
underscript1 = new Label("a ", new Label.LabelStyle(slimJoe.getFont(), Color.WHITE));
underscript2 = new Label(" production", new Label.LabelStyle(slimJoe.getFont(), Color.WHITE));
title.setPosition(Constants.V_WIDTH / 2, Constants.V_HEIGHT / 2, Align.center);
underscript1.setPosition(title.getX(), title.getY() + 6, Align.bottomRight);
underscript2.setPosition(title.getX(), title.getY(), Align.topLeft);
background.addAction(alpha(0f));
title.addAction(color(Color.BLACK));
underscript1.addAction(color(Color.BLACK));
underscript2.addAction(color(Color.BLACK));
actors.add(background);
actors.add(title);
actors.add(underscript1);
actors.add(underscript2);
addAllActors();
}
示例13: LoadingIndicator
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
public LoadingIndicator(LoadingIndicatorStyle style) {
if (style.spinnerImage != null) {
Image spinner = new Image(style.spinnerImage);
spinner.setOrigin(spinner.getWidth() / 2, spinner.getHeight() / 2);
spinner.addAction(Actions.forever(Actions.rotateBy(-360, style.rotationDuration)));
add(spinner).center();
row();
}
loadingWhatLabel = new Label(Strings.getString(UIManager.STRING_TABLE, "loading", ""), style.loadingLabelStyle);
add(loadingWhatLabel)
.center().padTop(style.loadingLabelMarginTop);
pack();
}
示例14: LoadingWindow
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
public LoadingWindow(T windowToLoad, LoadingIndicatorStyle style,
Loader<T> loader) {
super(windowToLoad.getTitleLabel().getText().toString(), windowToLoad
.getStyle());
setMovable(false);
this.windowToLoad = windowToLoad;
this.loader = loader;
loader.load(am);
Group parent = windowToLoad.getParent();
windowToLoad.remove();
windowToLoad.setVisible(false);
parent.addActor(this);
setVisible(true);
Image spinner = new Image(style.spinnerImage);
spinner.setOrigin(spinner.getWidth() / 2, spinner.getHeight() / 2);
spinner.getColor().a = 0;
spinner.addAction(Actions.fadeIn(0.8f));
spinner.addAction(Actions.forever(Actions.rotateBy(-360, style.rotationDuration)));
add(spinner).center();
row();
add(new Label(Strings.getString(UIManager.STRING_TABLE, "loading",""), style.loadingLabelStyle))
.center().padTop(style.loadingLabelMarginTop);
pack();
float minWidth = getWidth();
float minHeight = getHeight();
setWidth(windowToLoad.getWidth() > minWidth ? windowToLoad.getWidth() : minWidth);
setHeight(windowToLoad.getHeight() > minHeight ? windowToLoad.getHeight() : minHeight);
setPosition(windowToLoad.getX(), windowToLoad.getY());
}
示例15: init
import com.badlogic.gdx.scenes.scene2d.ui.Image; //导入方法依赖的package包/类
@Override protected void init() {
stage.getViewport().update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
textureImage = new Texture("logo-image.png");
textureText = new Texture("logo-text.png");
final Image image = new Image(textureImage);
image.setPosition(stage.getWidth() / 2 - image.getWidth() / 2, stage.getHeight() / 2 - image.getHeight() / 2);
final Image text = new Image(textureText);
text.setPosition(image.getX(), image.getY());
stage.addActor(image);
stage.addActor(text);
image.getColor().a = 0;
text.getColor().a = 0;
image.addAction(Actions.sequence(
Actions.alpha(1, 0.3f),
Actions.run(new Runnable() {
@Override public void run() {
text.addAction(
Actions.sequence(
Actions.alpha(1, 0.3f),
Actions.delay(1.5f),
Actions.run(new Runnable() {
@Override public void run() {
image.addAction(Actions.alpha(0, 0.3f));
text.addAction(Actions.sequence(
Actions.alpha(0, 0.3f),
Actions.run(new Runnable() {
@Override public void run() {
callback.onEnded();
}
})
));
}
})
)
);
}
})
));
}