本文整理匯總了Java中javafx.animation.FadeTransition類的典型用法代碼示例。如果您正苦於以下問題:Java FadeTransition類的具體用法?Java FadeTransition怎麽用?Java FadeTransition使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
FadeTransition類屬於javafx.animation包,在下文中一共展示了FadeTransition類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: ActionTextPane
import javafx.animation.FadeTransition; //導入依賴的package包/類
public ActionTextPane() {
actionText = new Label("Test");
graphic = new ImageView(new Image("assets/icons/editor_action_info_icon.png"));
actionText.setGraphic(graphic);
actionText.setTextFill(Utils.getDefaultTextColor());
actionText.setAlignment(Pos.CENTER);
actionText.setPadding(new Insets(0, 0, 0, 5));
getChildren().add(actionText);
setAlignment(Pos.CENTER);
ft = new FadeTransition(Duration.millis(500), graphic);
ft.setFromValue(1.0);
ft.setToValue(0.0);
ft.setAutoReverse(true);
ft.setCycleCount(4);
}
示例2: dataItemRemoved
import javafx.animation.FadeTransition; //導入依賴的package包/類
@Override protected void dataItemRemoved(Data<Number, Number> item, Series<Number, Number> series) {
final Node candle = item.getNode();
if (shouldAnimate()) {
// fade out old candle
FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
ft.setToValue(0);
ft.setOnFinished(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
getPlotChildren().remove(candle);
}
});
ft.play();
} else {
getPlotChildren().remove(candle);
}
}
示例3: seriesRemoved
import javafx.animation.FadeTransition; //導入依賴的package包/類
@Override protected void seriesRemoved(Series<Number, Number> series) {
// remove all candle nodes
for (XYChart.Data<Number, Number> d : series.getData()) {
final Node candle = d.getNode();
if (shouldAnimate()) {
// fade out old candle
FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
ft.setToValue(0);
ft.setOnFinished(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
getPlotChildren().remove(candle);
}
});
ft.play();
} else {
getPlotChildren().remove(candle);
}
}
}
示例4: showSplash
import javafx.animation.FadeTransition; //導入依賴的package包/類
private void showSplash(final Stage initStage, Task<?> task, InitCompletionHandler initCompletionHandler) {
progressText.textProperty().bind(task.messageProperty());
loadProgress.progressProperty().bind(task.progressProperty());
task.stateProperty().addListener((observableValue, oldState, newState) -> {
if (newState == Worker.State.SUCCEEDED) {
loadProgress.progressProperty().unbind();
loadProgress.setProgress(1);
initStage.toFront();
FadeTransition fadeSplash = new FadeTransition(Duration.seconds(1.2), splashLayout);
fadeSplash.setFromValue(1.0);
fadeSplash.setToValue(0.0);
fadeSplash.setOnFinished(actionEvent -> initStage.hide());
fadeSplash.play();
initCompletionHandler.complete();
}
});
Scene splashScene = new Scene(splashLayout);
initStage.initStyle(StageStyle.UNDECORATED);
final Rectangle2D bounds = Screen.getPrimary().getBounds();
initStage.setScene(splashScene);
initStage.setX(bounds.getMinX() + bounds.getWidth() / 2 - SPLASH_WIDTH / 2);
initStage.setY(bounds.getMinY() + bounds.getHeight() / 2 - SPLASH_HEIGHT / 2);
initStage.show();
}
示例5: onActionSimulateGameMode
import javafx.animation.FadeTransition; //導入依賴的package包/類
private void onActionSimulateGameMode(EGameMode gameMode) {
DebugConsole.getDefault().debug(this.getClass(), "On Action simulate GameMode: " + gameMode.toString()); // NOI18N
final SequentialTransition st = new SequentialTransition();
st.setDelay(Duration.millis(125.0d));
final PauseTransition ptStopGameMode = this.onActionStopGameMode();
st.getChildren().add(ptStopGameMode);
final FadeTransition ftHideGameInformations = this.onActionHideGameInformations();
st.getChildren().add(ftHideGameInformations);
final FadeTransition ftShowGameInformations = this.onActionShowGameInformations(gameMode);
st.getChildren().add(ftShowGameInformations);
final PauseTransition ptStartGameMode = this.onActionStartGameMode(gameMode);
st.getChildren().add(ptStartGameMode);
st.playFromStart();
}
示例6: start
import javafx.animation.FadeTransition; //導入依賴的package包/類
@Override
public void start(Stage primaryStage) {
if (primaryStage == null) {
return;
}
Group group = new Group();
Rectangle rect = new Rectangle(20,20,200,200);
FadeTransition ft = new FadeTransition(Duration.millis(5000), rect);
ft.setFromValue(1.0);
ft.setToValue(0.0);
ft.play();
group.getChildren().add(rect);
Scene scene = new Scene(group, 300, 200);
primaryStage.setScene(scene);
primaryStage.show();
}
示例7: dataItemAdded
import javafx.animation.FadeTransition; //導入依賴的package包/類
@Override protected void dataItemAdded(Series<Number, Number> series, int itemIndex, Data<Number, Number> item) {
Node candle = createCandle(getData().indexOf(series), item, itemIndex);
if (shouldAnimate()) {
candle.setOpacity(0);
getPlotChildren().add(candle);
// fade in new candle
FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
ft.setToValue(1);
ft.play();
} else {
getPlotChildren().add(candle);
}
// always draw average line on top
if (series.getNode() != null) {
series.getNode().toFront();
}
}
示例8: seriesAdded
import javafx.animation.FadeTransition; //導入依賴的package包/類
@Override protected void seriesAdded(Series<Number, Number> series, int seriesIndex) {
// handle any data already in series
for (int j = 0; j < series.getData().size(); j++) {
Data item = series.getData().get(j);
Node candle = createCandle(seriesIndex, item, j);
if (shouldAnimate()) {
candle.setOpacity(0);
getPlotChildren().add(candle);
// fade in new candle
FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
ft.setToValue(1);
ft.play();
} else {
getPlotChildren().add(candle);
}
}
// create series path
Path seriesPath = new Path();
seriesPath.getStyleClass().setAll("candlestick-average-line", "series" + seriesIndex);
series.setNode(seriesPath);
getPlotChildren().add(seriesPath);
}
示例9: makeFadeOut
import javafx.animation.FadeTransition; //導入依賴的package包/類
/**
* Método de efeito de transição de saída
*/
private void makeFadeOut(String path) {
FadeTransition fadeTransition = new FadeTransition();
fadeTransition.setDuration(Duration.millis(250));
fadeTransition.setNode(rootPane);
fadeTransition.setFromValue(1);
fadeTransition.setToValue(0);
fadeTransition.setOnFinished(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
try {
loadScreenPlay(path);
} catch (IOException ex) {
Logger.getLogger(ControllerLayoutInicial.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
fadeTransition.play();
}
示例10: makeFadeOut
import javafx.animation.FadeTransition; //導入依賴的package包/類
/**
* Método que inicia a view Inicial (MENU) e aplica estilos CSS nos botões
*/
@Autor("Divino Matheus")
private void makeFadeOut(String path) {
FadeTransition fadeTransition = new FadeTransition();
fadeTransition.setDuration(Duration.millis(250));
fadeTransition.setNode(rootPane);
fadeTransition.setFromValue(1);
fadeTransition.setToValue(0);
fadeTransition.setOnFinished(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
try {
loadScreenPlay(path);
} catch (IOException ex) {
Logger.getLogger(ControllerLayoutInicial.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
fadeTransition.play();
}
示例11: makeFadeOut
import javafx.animation.FadeTransition; //導入依賴的package包/類
private void makeFadeOut(String path) {
FadeTransition fadeTransition = new FadeTransition();
fadeTransition.setDuration(Duration.millis(250));
fadeTransition.setNode(rootPane);
fadeTransition.setFromValue(1);
fadeTransition.setToValue(0);
fadeTransition.setOnFinished(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
try {
loadScreenPlay(path);
} catch (IOException ex) {
Logger.getLogger(ControllerLayoutInicial.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
fadeTransition.play();
}
示例12: makeFadeOut
import javafx.animation.FadeTransition; //導入依賴的package包/類
/**
* Método para efeito de transição de saída
*/
private void makeFadeOut(String path) {
FadeTransition fadeTransition = new FadeTransition();
fadeTransition.setDuration(Duration.millis(250));
fadeTransition.setNode(rootPane);
fadeTransition.setFromValue(1);
fadeTransition.setToValue(0);
fadeTransition.setOnFinished(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
try {
loadScreenPlay(path);
} catch (IOException ex) {
Logger.getLogger(ControllerLayoutInicial.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
fadeTransition.play();
}
示例13: makeFadeOut
import javafx.animation.FadeTransition; //導入依賴的package包/類
private void makeFadeOut(String path) {
FadeTransition fadeTransition = new FadeTransition();
fadeTransition.setDuration(Duration.millis(250));
fadeTransition.setNode(rootPane);
fadeTransition.setFromValue(1);
fadeTransition.setToValue(0);
fadeTransition.setOnFinished(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
try {
loadScreenPlay(path);
} catch (IOException ex) {
Logger.getLogger(ControllerLayoutInicial.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
fadeTransition.play();
}
示例14: makeFadeOut
import javafx.animation.FadeTransition; //導入依賴的package包/類
/**
* Método para efeito de transição de saída
*/
private void makeFadeOut(String path) {
FadeTransition fadeTransition = new FadeTransition();
fadeTransition.setDuration(Duration.millis(250));
fadeTransition.setNode(rootPane);
fadeTransition.setFromValue(1);
fadeTransition.setToValue(0);
fadeTransition.setOnFinished(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
try {
loadScreenPlay(path);
} catch (IOException ex) {
Logger.getLogger(ControllerLayoutInicial.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
fadeTransition.play();
}
示例15: setPlusScoreAnimation
import javafx.animation.FadeTransition; //導入依賴的package包/類
/**
* Animates a label with the plus(new additional value) text.
* @param plus
*/
private void setPlusScoreAnimation(String plus) {
if(plus.length() > 2 ) {
double width = 25 * plus.length();
PLUS_SCORE.setMinSize(width, 45);
}
PLUS_SCORE.setText("+" + plus);
this.setScoreStyle();
PLUS_SCORE.setTextFill(Color.WHITE);
FadeTransition ft = new FadeTransition(Duration.seconds(.7), PLUS_SCORE);
ft.setFromValue(1);
ft.setToValue(0);
ft.play();
TranslateTransition tt = new TranslateTransition(Duration.seconds(.7), PLUS_SCORE);
tt.setFromX(55);
tt.setFromY(-50);
tt.setToY(50);
tt.play();
}