本文整理匯總了Java中javafx.animation.FadeTransition.setFromValue方法的典型用法代碼示例。如果您正苦於以下問題:Java FadeTransition.setFromValue方法的具體用法?Java FadeTransition.setFromValue怎麽用?Java FadeTransition.setFromValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.animation.FadeTransition
的用法示例。
在下文中一共展示了FadeTransition.setFromValue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: keyPressedAnimation
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
/**
* Animation for key pressed.
* @param b
*/
private void keyPressedAnimation(Button b) {
ScaleTransition st = new ScaleTransition(Duration.seconds(.2), b);
st.setFromX(.8);
st.setFromY(.8);
st.setToX(1.6);
st.setToY(1.6);
st.play();
st.setOnFinished(e -> {
if(!b.isHover()) {
ScaleTransition st2 = new ScaleTransition(Duration.seconds(.09), b);
st2.setToX(1);
st2.setToY(1);
st2.play();
}
});
FadeTransition ft = new FadeTransition(Duration.seconds(.2), b);
ft.setFromValue(.2);
ft.setToValue(1);
ft.play();
}
示例2: handleStateChangeNotification
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
@Override
public void handleStateChangeNotification(StateChangeNotification evt) {
if (evt.getType() == StateChangeNotification.Type.BEFORE_START) {
if (stage.isShowing()) {
// fade out, hide stage at the end of animation
final FadeTransition fadeTransition =
new FadeTransition(
Duration.millis(1000), stage.getScene().getRoot());
fadeTransition.setFromValue(1.0);
fadeTransition.setToValue(0.0);
final EventHandler<ActionEvent> eventHandler = t -> stage.hide();
fadeTransition.setOnFinished(eventHandler);
fadeTransition.play();
} else {
stage.hide();
}
}
}
示例3: buttonClicked
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
/**
*
* @param b
*/
public void buttonClicked(Button b, KeyCode key) {
ScaleTransition st = new ScaleTransition(Duration.seconds(.2), b);
st.setFromX(.8);
st.setFromY(.8);
st.setToX(1.6);
st.setToY(1.6);
st.play();
FadeTransition ft = new FadeTransition(Duration.seconds(.2), b);
ft.setFromValue(.2);
ft.setToValue(1);
ft.play();
boolean movable = true;
Direction direction = new Direction(key);
if(direction.getKey().equals(KeyCode.UP)) movable = this.upMove(direction);
if(direction.getKey().equals(KeyCode.RIGHT)) movable = this.rightMove(direction);
if(direction.getKey().equals(KeyCode.DOWN)) movable = this.downMove(direction);
if(direction.getKey().equals(KeyCode.LEFT)) movable = this.leftMove(direction);
if(movable) {
int random_value = ((int)(new Random().nextDouble() * 10)) > 8 ? 4 : 2;
this.addNewTile(String.valueOf(random_value), Duration.seconds(.2));
}
}
示例4: 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();
}
示例5: 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();
}
示例6: showNotification
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
public void showNotification(String text)
{
labelNotification.setText(text);
labelNotification.setStyle("-fx-text-fill: #FFFFFF; -fx-font-size: 16; -fx-font-weight: bold; -fx-background-color: " + ConvertTo.toRGBHexWithoutOpacity(Colors.BACKGROUND_NOTIFICATION));
FadeTransition fadeIn = new FadeTransition(Duration.millis(200), labelNotification);
fadeIn.setFromValue(0.0);
fadeIn.setToValue(1.0);
FadeTransition fadeOut = new FadeTransition(Duration.millis(400), labelNotification);
fadeOut.setFromValue(1.0);
fadeOut.setToValue(0.0);
fadeOut.setDelay(Duration.millis(3000));
fadeOut.play();
SequentialTransition seqT = new SequentialTransition(fadeIn, fadeOut);
seqT.play();
seqT.setOnFinished((a) -> {
labelNotification.setStyle("-fx-text-fill: #FFFFFF; -fx-font-size: 16; -fx-font-weight: bold; -fx-background-color: transparent;");
});
}
示例7: switchStateAnimation
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
private void switchStateAnimation(TDDState newState){
RotateTransition rotateTransition = new RotateTransition(Duration.millis(800), cycleImage);
rotateTransition.setFromAngle(0);
rotateTransition.setToAngle(-180);
FadeTransition ft = new FadeTransition(Duration.millis(800), cycleImage);
ft.setFromValue(1);
ft.setToValue(0);
RotateTransition rotateTransition2 = new RotateTransition(Duration.millis(800), cycleImageOverlay);
rotateTransition2.setFromAngle(180);
rotateTransition2.setToAngle(0);
Image newImg = getImageOfPhase(newState);
rotateTransition2.setOnFinished(event -> {
cycleImage.setImage(newImg);
});
FadeTransition ft2 = new FadeTransition(Duration.millis(800), cycleImageOverlay);
ft2.setFromValue(0);
ft2.setToValue(1);
ft.play();
cycleImageOverlay.setImage(newImg);
rotateTransition.play();
ft.play();
ft2.play();
rotateTransition2.play();
}
開發者ID:ProPra16,項目名稱:programmierpraktikum-abschlussprojekt-amigos,代碼行數:27,代碼來源:ExerciseController.java
示例8: onActionNextRandomMap
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
private void onActionNextRandomMap() {
LoggerFacade.INSTANCE.debug(this.getClass(), "On action next random Map"); // NOI18N
final int randomMapIndex = MapFacade.INSTANCE.getRandomMapIndex();
final MapModel mm = MapFacade.INSTANCE.loadMap(randomMapIndex);
this.printMapToConsole(mm);
vbRandomMap.getChildren().clear();
vbRandomMap.setOpacity(0.0d);
vbRandomMap.getChildren().add(this.getLabel("Map: " + randomMapIndex)); // NOI18N
vbRandomMap.getChildren().add(this.getLabel("")); // NOI18N
final ObservableList<String> map = mm.getMapAsStrings();
map.stream().forEach(line -> {
vbRandomMap.getChildren().add(this.getLabel(line));
});
final FadeTransition ftShowNextRandomMap = new FadeTransition();
ftShowNextRandomMap.setDuration(Duration.millis(550.0d));
ftShowNextRandomMap.setFromValue(0.0d);
ftShowNextRandomMap.setToValue(1.0d);
ftShowNextRandomMap.setNode(vbRandomMap);
ftShowNextRandomMap.playFromStart();
}
示例9: initGraphics
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
private void initGraphics() {
font = Font.font(0.4 * PREFERRED_HEIGHT);
text = new Text(getSkinnable().getText());
text.setFont(font);
text.setFill(getSkinnable().getTextColor());
thumb = new Rectangle();
thumb.setFill(getSkinnable().getThumbColor());
thumb.setOpacity(0.0);
thumb.setMouseTransparent(true);
pressed = new FadeTransition(Duration.millis(100), thumb);
pressed.setInterpolator(Interpolator.EASE_IN);
pressed.setFromValue(0.0);
pressed.setToValue(0.8);
released = new FadeTransition(Duration.millis(250), thumb);
released.setInterpolator(Interpolator.EASE_OUT);
released.setFromValue(0.8);
released.setToValue(0.0);
pane = new Pane(thumb, text);
getChildren().setAll(pane);
}
示例10: TransitionAlert
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
private void TransitionAlert(Pane player_pane, Pane energy_pane) {
Rectangle rectangle = new Rectangle(150, 50);
Stop[] stops = new Stop[]{new Stop(0, Color.RED), new Stop(1, Color.WHITE)};
LinearGradient gp = new LinearGradient(0, 0, 10, 24, true, CycleMethod.NO_CYCLE, stops);
rectangle.setFill(gp);
rectangle.setArcHeight(18);
rectangle.setArcWidth(18);
rectangle.setLayoutX(energy_pane.getLayoutX());
rectangle.setLayoutY(energy_pane.getLayoutY());
FadeTransition fadeTransition1 = new FadeTransition(Duration.millis(500), rectangle);
fadeTransition1.setFromValue(0f);
fadeTransition1.setToValue(0.6f);
fadeTransition1.setCycleCount(2);
fadeTransition1.setAutoReverse(true);
player_pane.getChildren().add(rectangle);
fadeTransition1.play();
}
示例11: TransitionGainPV
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
private void TransitionGainPV(Pane player_pane, Pane energy_pane) {
Rectangle rectangle = new Rectangle(150, 50);
Stop[] stops = new Stop[]{new Stop(0, Color.GREEN), new Stop(1, Color.WHITE)};
LinearGradient gp = new LinearGradient(0, 0, 10, 24, true, CycleMethod.NO_CYCLE, stops);
rectangle.setFill(gp);
rectangle.setArcHeight(18);
rectangle.setArcWidth(18);
rectangle.setLayoutX(energy_pane.getLayoutX());
rectangle.setLayoutY(energy_pane.getLayoutY());
FadeTransition fadeTransition = new FadeTransition(Duration.millis(500), rectangle);
fadeTransition.setFromValue(0f);
fadeTransition.setToValue(0.6f);
fadeTransition.setCycleCount(2);
fadeTransition.setAutoReverse(true);
player_pane.getChildren().add(rectangle);
fadeTransition.play();
}
示例12: CardPlayedToken
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
public CardPlayedToken(GameBoardView boardView, Card card) {
Window parent = boardView.getScene().getWindow();
this.cardToken = new CardTooltip();
popup = new Popup();
popup.getContent().setAll(cardToken);
popup.setX(parent.getX() + 40);
popup.show(parent);
popup.setY(parent.getY() + parent.getHeight() * 0.5 - cardToken.getHeight() * 0.5);
cardToken.setCard(card);
NotificationProxy.sendNotification(GameNotification.ANIMATION_STARTED);
FadeTransition animation = new FadeTransition(Duration.seconds(1.2), cardToken);
animation.setDelay(Duration.seconds(0.6f));
animation.setOnFinished(this::onComplete);
animation.setFromValue(1);
animation.setToValue(0);
animation.play();
}
示例13: initController
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
@Override
protected void initController(boolean initialize) {
stage.initStyle(StageStyle.TRANSPARENT);
FadeTransition ft = new FadeTransition(Duration.millis(500), getStage().getScene().getRoot());
ft.setFromValue(0.0);
ft.setToValue(1.0);
PauseTransition pt = new PauseTransition(Duration.millis(2000));
FadeTransition ft2 = new FadeTransition(Duration.millis(1000),
getRoot());
ft2.setFromValue(1.0);
ft2.setToValue(0.0);
SequentialTransition st = new SequentialTransition(ft, pt, ft2);
st.onFinishedProperty().set(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
closeWindow();
new LobbyController(SplashController.this).showWindow();
}
});
st.playFromStart();
}
示例14: flagAsError
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
public void flagAsError() {
this.normal.setVisible(true); // hidden behind error
this.highlight.setVisible(false);
this.drag.setVisible(false);
this.error.setVisible(true);
FadeTransition ft = new FadeTransition(Duration.seconds(4), this.error);
ft.setFromValue(1.0);
ft.setToValue(0.0);
ft.setOnFinished( (evt) -> {
this.normal.setVisible(true); // show normal
this.highlight.setVisible(false);
this.drag.setVisible(false);
this.error.setVisible(false);
this.error.setOpacity( 1.0d ); // restore opacity
});
ft.play();
}
示例15: cerrarsesion
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
public void cerrarsesion(ActionEvent actionEvent) {
Stage stage = (Stage) btn_cerrarsesion.getScene().getWindow();
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Inicio.fxml"));
Parent root = null;
try {
root = (Parent)fxmlLoader.load();
} catch (Exception e) {
Alert alerta = new Alert(Alert.AlertType.ERROR);
alerta.setTitle("Error de Aplicacion");
alerta.setHeaderText("Mira, hubo un error...");
alerta.setContentText("Lo siento. Llama al administrador.");
alerta.showAndWait();
Platform.exit();
}
FadeTransition ft = new FadeTransition(Duration.millis(1500), root);
ft.setFromValue(0.0);
ft.setToValue(1.0);
ft.play();
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}