本文整理汇总了Java中javafx.animation.TranslateTransition.setDelay方法的典型用法代码示例。如果您正苦于以下问题:Java TranslateTransition.setDelay方法的具体用法?Java TranslateTransition.setDelay怎么用?Java TranslateTransition.setDelay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.animation.TranslateTransition
的用法示例。
在下文中一共展示了TranslateTransition.setDelay方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createMiddleContent
import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
private Node createMiddleContent() {
String title = "MKX Menu App";
HBox letters = new HBox(0);
letters.setAlignment(Pos.CENTER);
for (int i = 0; i < title.length(); i++) {
Text letter = new Text(title.charAt(i) + "");
letter.setFont(FONT);
letter.setFill(Color.WHITE);
letters.getChildren().add(letter);
TranslateTransition tt = new TranslateTransition(Duration.seconds(2), letter);
tt.setDelay(Duration.millis(i * 50));
tt.setToY(-25);
tt.setAutoReverse(true);
tt.setCycleCount(TranslateTransition.INDEFINITE);
tt.play();
}
return letters;
}
示例2: panelShake
import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
/**
* Shake a panel in the event of an error.
*
* @param pane the pane to shake
*/
public static void panelShake(Pane pane) {
int duration = 100;
int count = 2;
TranslateTransition transition1 = new TranslateTransition(Duration.millis(duration), pane);
transition1.setFromX(0);
transition1.setToX(-5);
transition1.setInterpolator(Interpolator.LINEAR);
TranslateTransition transition2 = new TranslateTransition(Duration.millis(duration), pane);
transition2.setFromX(-5);
transition2.setToX(5);
transition2.setDelay(Duration.millis(duration));
transition2.setInterpolator(Interpolator.LINEAR);
transition2.setCycleCount(count);
TranslateTransition transition3 = new TranslateTransition(Duration.millis(duration), pane);
transition3.setToX(0);
transition3.setDelay(Duration.millis((count + 1) * duration));
transition3.setInterpolator(Interpolator.LINEAR);
transition1.play();
transition2.play();
transition3.play();
}
示例3: slidePanel
import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
private void slidePanel(int show, Duration delay) {
Node n = root.getParent();
TranslateTransition openNav = new TranslateTransition(new Duration(200), n);
openNav.setDelay(delay);
openNav.setToX(show * -SETTINGS_PANE_DISTANCE);
openNav.play();
}
示例4: hide
import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
private void hide(Duration delay) {
Node n = root.getParent();
TranslateTransition openNav = new TranslateTransition(new Duration(200), n);
openNav.setDelay(delay);
openNav.setToX(-MainViewController.SETTINGS_PANE_DISTANCE);
openNav.play();
}
示例5: addGebouwKaartViews
import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
/**
* Voeg gebouwKaart views toe aan de HandActionBarView.
* Wijzig de X coordinaat van elke GebouwKaartView zodat
* deze de vorige kaart overlapt.
*/
private void addGebouwKaartViews() {
Pane handPane = new Pane();
int x = 0; // X coordinaat (voor uitlijning)
int totalWidth = 0;
int index = 0;
int delay = 75;
// Loop door gebouwKaartViews en wijzig de X coordinaat.
for (GebouwKaartView gebouwKaartView: gebouwKaartViews) {
// gebouwKaartView.view().setLayoutX(x); // Zet X coordinaat
gebouwKaartView.view().setCache(true);
gebouwKaartView.view().setCacheShape(true);
gebouwKaartView.view().setCacheHint(CacheHint.SPEED);
gebouwKaartView.view().setRotate(calcRotation(index, gebouwKaartViews.size()));
handPane.getChildren().add(gebouwKaartView.view()); // Voeg view to aan Pane
totalWidth += gebouwKaartView.view().getPrefWidth();
TranslateTransition transition = new TranslateTransition(Duration.millis(250), gebouwKaartView.view());
transition.setDelay(Duration.millis(delay));
transition.setFromX(0);
transition.setToX(x);
FadeTransition fadeTransition = new FadeTransition(Duration.millis(125), gebouwKaartView.view());
fadeTransition.setDelay(Duration.millis(delay));
fadeTransition.setFromValue(0.0);
fadeTransition.setToValue(1.0);
fadeTransition.play();
transition.play();
delay += 75;
x += 130; // Verhoog X coordinaat met 100
index++;
}
handPane.setMaxWidth(totalWidth);
this.pane.getChildren().add(handPane);
StackPane.setAlignment(handPane, Pos.TOP_CENTER);
}
示例6: translateTo
import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
private void translateTo(Node node, Duration delay, double y, EventHandler<ActionEvent> onFinished) {
TranslateTransition transition = new TranslateTransition(Duration.seconds(1), node);
transition.setOnFinished(onFinished);
transition.setDelay(delay);
transition.setToY(y);
transition.play();
}
示例7: onActionShowMainMenu
import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
public void onActionShowMainMenu() {
LoggerFacade.INSTANCE.debug(this.getClass(), "On action show MainMenu"); // NOI18N
// Dont listen in Preview and GameView on KeyEvents
PreferencesFacade.INSTANCE.putBoolean(
IGameConfiguration.PROP__KEY_RELEASED__FOR_GAMEVIEW,
IGameConfiguration.PROP__KEY_RELEASED__FOR_GAMEVIEW__DEFAULT_VALUE);
PreferencesFacade.INSTANCE.putBoolean(
IPreviewConfiguration.PROP__KEY_RELEASED__FOR_PREVIEW,
Boolean.FALSE);
// MainMenuView is shown
PreferencesFacade.INSTANCE.putBoolean(
IMainMenuConfiguration.PROP__MAIN_MENU_IS_SHOWN,
Boolean.TRUE);
// Button
lMenuButton.setDisable(Boolean.TRUE);
// HiddenLayer
apHiddenLayer.setOpacity(0.0d);
apHiddenLayer.setVisible(Boolean.TRUE);
apHiddenLayer.setManaged(Boolean.TRUE);
final FadeTransition ftShowHiddenLayer = new FadeTransition();
ftShowHiddenLayer.setDelay(Duration.millis(125.0d));
ftShowHiddenLayer.setDuration(Duration.millis(250.0d));
ftShowHiddenLayer.setFromValue(0.0d);
ftShowHiddenLayer.setToValue(1.0d);
ftShowHiddenLayer.setNode(apHiddenLayer);
// Init MainMenuView
final MainMenuView mainMenuView = new MainMenuView();
final Parent menu = mainMenuView.getView();
menu.setOpacity(0.0d);
bpMenuArea.setCenter(null);
bpMenuArea.setCenter(menu);
final FadeTransition ftShowMenuView = new FadeTransition();
ftShowMenuView.setDelay(Duration.millis(200.0d));
ftShowMenuView.setDuration(Duration.millis(375.0d));
ftShowMenuView.setFromValue(0.0d);
ftShowMenuView.setToValue(1.0d);
ftShowMenuView.setNode(menu);
ftShowMenuView.setOnFinished((ActionEvent event) -> {
bpMenuArea.setMouseTransparent(Boolean.FALSE);
if (this.hasMediaPlayerFollowing(MediaPlayer.Status.PLAYING)) {
mediaPlayer.pause();
}
ActionFacade.INSTANCE.handle(ON_ACTION__MANAGED_MAP_PLAYER);
});
// Move menu
final TranslateTransition translateTransition = new TranslateTransition();
translateTransition.setDelay(Duration.millis(200.0d));
translateTransition.setDuration(Duration.millis(375.0d));
translateTransition.setFromX(300.0d);
translateTransition.setToX(0.0d);
translateTransition.setNode(menu);
// Animate
final ParallelTransition pt = new ParallelTransition();
pt.getChildren().addAll(ftShowHiddenLayer, ftShowMenuView, translateTransition);
pt.playFromStart();
}