use of javafx.animation.Timeline in project bitsquare by bitsquare.
the class Overlay method animateHide.
protected void animateHide(Runnable onFinishedHandler) {
Interpolator interpolator = Interpolator.SPLINE(0.25, 0.1, 0.25, 1);
double duration = getDuration(200);
Timeline timeline = new Timeline();
ObservableList<KeyFrame> keyFrames = timeline.getKeyFrames();
if (type.animationType == AnimationType.SlideDownFromCenterTop) {
double endY = -gridPane.getHeight();
keyFrames.add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 1, interpolator), new KeyValue(gridPane.translateYProperty(), -10, interpolator)));
keyFrames.add(new KeyFrame(Duration.millis(duration), new KeyValue(gridPane.opacityProperty(), 0, interpolator), new KeyValue(gridPane.translateYProperty(), endY, interpolator)));
timeline.setOnFinished(e -> onFinishedHandler.run());
timeline.play();
} else if (type.animationType == AnimationType.ScaleFromCenter) {
double endScale = 0.25;
keyFrames.add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 1, interpolator), new KeyValue(gridPane.scaleXProperty(), 1, interpolator), new KeyValue(gridPane.scaleYProperty(), 1, interpolator)));
keyFrames.add(new KeyFrame(Duration.millis(duration), new KeyValue(gridPane.opacityProperty(), 0, interpolator), new KeyValue(gridPane.scaleXProperty(), endScale, interpolator), new KeyValue(gridPane.scaleYProperty(), endScale, interpolator)));
} else if (type.animationType == AnimationType.ScaleYFromCenter) {
gridPane.setRotationAxis(Rotate.X_AXIS);
gridPane.getScene().setCamera(new PerspectiveCamera());
keyFrames.add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.rotateProperty(), 0, interpolator), new KeyValue(gridPane.opacityProperty(), 1, interpolator)));
keyFrames.add(new KeyFrame(Duration.millis(duration), new KeyValue(gridPane.rotateProperty(), -90, interpolator), new KeyValue(gridPane.opacityProperty(), 0, interpolator)));
} else if (type.animationType == AnimationType.ScaleDownToCenter) {
double endScale = 0.1;
keyFrames.add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 1, interpolator), new KeyValue(gridPane.scaleXProperty(), 1, interpolator), new KeyValue(gridPane.scaleYProperty(), 1, interpolator)));
keyFrames.add(new KeyFrame(Duration.millis(duration), new KeyValue(gridPane.opacityProperty(), 0, interpolator), new KeyValue(gridPane.scaleXProperty(), endScale, interpolator), new KeyValue(gridPane.scaleYProperty(), endScale, interpolator)));
} else if (type.animationType == AnimationType.FadeInAtCenter) {
keyFrames.add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 1, interpolator)));
keyFrames.add(new KeyFrame(Duration.millis(duration), new KeyValue(gridPane.opacityProperty(), 0, interpolator)));
}
timeline.setOnFinished(e -> onFinishedHandler.run());
timeline.play();
}
use of javafx.animation.Timeline in project Gargoyle by callakrsos.
the class LettersPane method createRandomTimeLine.
private Timeline createRandomTimeLine(Node node) {
// over 3 seconds move letter to random position and fade it out
final Timeline timeline = new Timeline();
timeline.getKeyFrames().add(new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
// we are done remove us from scene
getChildren().remove(node);
}
}, new KeyValue(node.translateXProperty(), getRandom(0.0f, getWidth() - node.getBoundsInLocal().getWidth()), INTERPOLATOR), new KeyValue(node.translateYProperty(), getRandom(0.0f, getHeight() - node.getBoundsInLocal().getHeight()), INTERPOLATOR), new KeyValue(node.opacityProperty(), 0f)));
return timeline;
}
use of javafx.animation.Timeline in project Gargoyle by callakrsos.
the class LettersPane method createUpperTimeLine.
// private Timeline createCurveTimeLine(Node node) {
// // over 3 seconds move letter to random position and fade it out
// final Timeline timeline = new Timeline();
// timeline.getKeyFrames().add(new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {
// @Override
// public void handle(ActionEvent event) {
// // we are done remove us from scene
// getChildren().remove(node);
// }
// }, new KeyValue(node.translateXProperty(), node.translateXProperty().get(), INTERPOLATOR),
// new KeyValue(node.translateYProperty(), 100f, INTERPOLATOR), new KeyValue(node.opacityProperty(), 0f)));
//
// new KeyFrame(Duration.millis(0.5), new KeyFrame(time, values))
//
//
//
// return timeline;
//
//
// }
private Timeline createUpperTimeLine(Node node) {
// over 3 seconds move letter to random position and fade it out
final Timeline timeline = new Timeline();
timeline.getKeyFrames().add(new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
// we are done remove us from scene
getChildren().remove(node);
}
}, new KeyValue(node.translateXProperty(), node.translateXProperty().get(), INTERPOLATOR), new KeyValue(node.translateYProperty(), 100f, INTERPOLATOR), new KeyValue(node.opacityProperty(), 0f)));
return timeline;
}
use of javafx.animation.Timeline in project arquivoProject by fader-azevedo.
the class CriarEstanteController method salvarEstante.
@FXML
private void salvarEstante() {
if (txtCodigo.getText().isEmpty() || txtDescricao.getText().isEmpty()) {
db.alertInfo("Por Favor, Preenche todos os campos");
return;
}
Calendar cal = Calendar.getInstance();
Estante e = new Estante(1, db.tratamento(txtCodigo.getText().trim()), db.tratamento(txtDescricao.getText().trim()), cal.getTime());
db.salvar(e);
lbMessage.setOpacity(1);
Timeline times = new Timeline(new KeyFrame(Duration.millis(4000), ev -> {
lbMessage.setOpacity(0);
}));
times.play();
txtCodigo.setText("");
txtDescricao.setText("");
lista.setItems(db.listarCogigoEstante());
}
use of javafx.animation.Timeline in project arquivoProject by fader-azevedo.
the class ListaEstanteController method playThis.
private void playThis(JFXButton button) {
Timeline timeline = new Timeline(new KeyFrame(Duration.millis(250), ev -> {
clipRectNextPratieira.setHeight(pnCarregaPratileira.getHeight());
if (clipRectNextPratieira.widthProperty().get() != 0) {
Timeline timelineUp = new Timeline();
final KeyValue kvUp1 = new KeyValue(clipRectNextPratieira.widthProperty(), 0);
final KeyValue kvUp2 = new KeyValue(clipRectNextPratieira.translateXProperty(), pnCarregaPratileira.getWidth());
final KeyValue kvUp4 = new KeyValue(pnCarregaPratileira.prefWidthProperty(), 0);
final KeyValue kvUp3 = new KeyValue(pnCarregaPratileira.translateXProperty(), pnCarregaPratileira.getWidth());
final KeyFrame kfUp = new KeyFrame(Duration.millis(1000), kvUp1, kvUp2, kvUp3, kvUp4);
timelineUp.getKeyFrames().add(kfUp);
timelineUp.play();
} else {
try {
pnCarregaPratileira.toFront();
FXMLLoader listPratView = new FXMLLoader();
listPratView.load(getClass().getResource("/view/ListaPratileira.fxml").openStream());
ListaPratileiraController lpController = listPratView.getController();
lpController.removeClass();
lpController.scrollBtnPratileira(button.getText());
Tooltip toot = new Tooltip("Voltar para Estantes");
// acao para volta nesse controller
lpController.btnBack.setOnAction(ic -> {
this.playThis(button);
});
lpController.btnBack.setTooltip(toot);
lpController.btnBack.setVisible(true);
lpController.boxCaminho.setVisible(true);
lpController.btnClosePratileira.setVisible(false);
AnchorPane root = listPratView.getRoot();
pnCarregaPratileira.getChildren().add(root);
btnCloseEstante.toFront();
Timeline timeDireita = new Timeline();
final KeyValue kvDir1 = new KeyValue(clipRectNextPratieira.widthProperty(), pnCarregaPratileira.getWidth());
final KeyValue kvDir2 = new KeyValue(clipRectNextPratieira.translateXProperty(), 0);
final KeyValue kvDir4 = new KeyValue(pnCarregaPratileira.prefWidthProperty(), pnCarregaPratileira.getWidth());
final KeyValue kvDir3 = new KeyValue(pnCarregaPratileira.translateXProperty(), 0);
final KeyFrame kfDwn = new KeyFrame(Duration.millis(600), kvDir1, kvDir2, kvDir3, kvDir4);
timeDireita.getKeyFrames().add(kfDwn);
timeDireita.play();
} catch (IOException ex) {
Logger.getLogger(ListaEstanteController.class.getName()).log(Level.SEVERE, null, ex);
}
}
}));
timeline.play();
}
Aggregations