Java 类com.badlogic.gdx.scenes.scene2d.actions.RepeatAction 实例源码

项目:cocos-ui-libgdx    文件:CCSpriteViewTest.java   
@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)));
}
项目:enklave    文件:ScreenExtensions.java   
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);
}
项目:FlappySpinner    文件:MarketScreen.java   
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);
}
项目:enklave    文件:TutorialDialog.java   
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;
}
项目:enklave    文件:ScreenLoading.java   
public ScreenLoading(GameManager game) {
    gameManager = game;
    assets = ManagerAssets.getInstance();
    MoveToAction mred = new MoveToAction();
    mred.setPosition(Width , -Height);
    mred.setDuration(2f);
    MoveToAction mred1 = new MoveToAction();
    mred1.setPosition(-Width , Height);
    mred1.setDuration(0);
    translatered  = new RepeatAction();
    translatered.setCount(RepeatAction.FOREVER);
    translatered.setAction(new SequenceAction(new DelayAction(0.0f), mred,mred1, new DelayAction(4.0f)));
    MoveToAction mgreen = new MoveToAction();
    mgreen.setPosition(Width , -Height );
    mgreen.setDuration(2f);
    MoveToAction mgreen1 = new MoveToAction();
    mgreen1.setPosition(-Width , Height);
    mgreen1.setDuration(0);
    translategreen = new RepeatAction();
    translategreen.setCount(RepeatAction.FOREVER);
    translategreen.setAction(new SequenceAction(new DelayAction(2.0f), mgreen,mgreen1, new DelayAction(4.0f)));
    MoveToAction mblue = new MoveToAction();
    mblue.setPosition(Width , -Height);
    mblue.setDuration(2f);
    MoveToAction mblue1 = new MoveToAction();
    mblue1.setPosition(-Width , Height);
    mblue1.setDuration(0);
    translateblue = new RepeatAction();
    translateblue.setCount(RepeatAction.FOREVER);
    translateblue.setAction(new SequenceAction(new DelayAction(4.0f), mblue,mblue1,new DelayAction(4.0f)));
}
项目:FlappySpinner    文件:Spinner.java   
private void spinnerRotateAction() {
    SequenceAction rotateAction = new SequenceAction();
    rotateAction.addAction(Actions.rotateBy(360, 0.5f, Interpolation.linear));
    RepeatAction infiniteLoop = new RepeatAction();
    infiniteLoop.setCount(RepeatAction.FOREVER);
    infiniteLoop.setAction(rotateAction);
    this.addAction(infiniteLoop);
}
项目:FlappySpinner    文件:GameScreen.java   
public RepeatAction setOnStateImageAction(float duration) {
    SequenceAction sequenceAction = new SequenceAction();
    sequenceAction.addAction(Actions.scaleTo(1.3f, 1.3f, duration));
    sequenceAction.addAction(Actions.scaleTo(1f, 1f, duration));
    RepeatAction infiniteLoop = new RepeatAction();
    infiniteLoop.setCount(RepeatAction.FOREVER);
    infiniteLoop.setAction(sequenceAction);
    return infiniteLoop;
}
项目:cachebox3.0    文件:Blink.java   
public Blink(float fadeTime, float stopTime){
    setCount(RepeatAction.FOREVER);

    Action blinkSequence = Actions.sequence(
            Actions.alpha(0, fadeTime),
            Actions.delay(stopTime),
            Actions.alpha(1, fadeTime),
            Actions.delay(stopTime));

    setAction(blinkSequence);
}
项目:ChessGDX    文件:EngineThinkingImage.java   
/**
 * A spinning icon that tells the user the engine is currently processing
 * the next move.
 * 
 * @param skin
 */
public EngineThinkingImage(Skin skin) {
    super(skin, MenuSkin.IMG_LOADING_ICON);
    RepeatAction mSpinAction = new RepeatAction();
    mSpinAction.setCount(RepeatAction.FOREVER);
    mSpinAction.setAction(Actions.rotateBy(-360.0f, 1.0f));

    setOrigin(getWidth() / 2, getHeight() / 2);
    addAction(mSpinAction);

    setVisible(false);
}
项目:FlappySpinner    文件:GameScreen.java   
public void changeGameState(GameState state) {
    switch (state) {
        case RESUME:
            this.state = GameState.RESUME;
            onPause.setVisible(false);
            onResume.setVisible(true);
            pauseButton.setVisible(true);
            break;
        case RUN:
            onResume.setVisible(false);
            this.state = GameState.RUN;
            isFirstClick = false;
            break;
        case PAUSE:
            this.state = GameState.PAUSE;
            onPause.setVisible(true);
            onResume.setVisible(false);
            break;
        case FINISH:
            audioManager.playSound(audioManager.getGameoverSound());
            onFinish.setVisible(true);
            pauseButton.setVisible(false);
            playButton.setVisible(true);
            if (!isRelife) {
                videoButton.setVisible(true);
                bonusLabel.setVisible(true);
            }
            homeButton.setVisible(true);
            moneyLabel.setText(" " + SCORE);
            moneyLabel.setVisible(true);
            moneyImage.setVisible(true);
            moneyImage.setX(moneyLabel.getX() + moneyLabel.getText().length + 0.7f);
            moneyImage.addAction(Actions.rotateBy(22.5f));
            SequenceAction sequenceAction = new SequenceAction();
            sequenceAction.addAction(Actions.rotateBy(-45, 0.4f, Interpolation.linear));
            sequenceAction.addAction(Actions.rotateBy(45, 0.4f, Interpolation.linear));
            RepeatAction infiniteLoop = new RepeatAction();
            infiniteLoop.setCount(RepeatAction.FOREVER);
            infiniteLoop.setAction(sequenceAction);
            moneyImage.addAction(infiniteLoop);
            if (SCORE > preferences.getMaxScore()) {
                scoreLabel.setText(" New record! \n" + "Score:" + SCORE);
            } else {
                scoreLabel.setText("Score:" + SCORE + '\n' + "Best:" + preferences.getMaxScore());
            }
            FlappySpinner.gameManager.submitScore(SCORE);
            preferences.setMaxScore(SCORE);
            scoreLabel.addAction(Actions.moveTo(Constants.WIDTH / 3 - 1 + scoreLabel.getWidth() / 2, onFinish.getY() + onFinish.getHeight() * 1.3f + 0.1f, 0.6f, Interpolation.linear));
            preferences.setUserMoney(preferences.getUserMoney() + SCORE);
            break;
    }
}