use of javafx.animation.KeyFrame in project fxexperience2 by EricCanull.
the class FadeOutDownBigTransition method starting.
@Override
protected void starting() {
double endY = node.getScene().getHeight() - node.localToScene(0, 0).getY();
timeline = new Timeline(new KeyFrame(Duration.millis(0), new KeyValue(node.opacityProperty(), 1, WEB_EASE), new KeyValue(node.translateYProperty(), 0, WEB_EASE)), new KeyFrame(Duration.millis(1000), new KeyValue(node.opacityProperty(), 0, WEB_EASE), new KeyValue(node.translateYProperty(), endY, WEB_EASE)));
super.starting();
}
use of javafx.animation.KeyFrame in project fxexperience2 by EricCanull.
the class BounceInDownTransition method starting.
@Override
protected void starting() {
double startY = -node.localToScene(0, 0).getY() - node.getBoundsInParent().getHeight();
timeline = new Timeline();
timeline.getKeyFrames().add(new KeyFrame(Duration.millis(0), new KeyValue(node.opacityProperty(), 0, WEB_EASE), new KeyValue(node.translateYProperty(), startY, WEB_EASE)));
timeline.getKeyFrames().add(new KeyFrame(Duration.millis(600), new KeyValue(node.opacityProperty(), 1, WEB_EASE), new KeyValue(node.translateYProperty(), 30, WEB_EASE)));
timeline.getKeyFrames().add(new KeyFrame(Duration.millis(800), new KeyValue(node.translateYProperty(), -10, WEB_EASE)));
timeline.getKeyFrames().add(new KeyFrame(Duration.millis(1000), new KeyValue(node.translateYProperty(), 0, WEB_EASE)));
super.starting();
}
use of javafx.animation.KeyFrame in project fxexperience2 by EricCanull.
the class BounceOutDownTransition method starting.
@Override
protected void starting() {
double endY = node.getScene().getHeight() - node.localToScene(0, 0).getY();
timeline = new Timeline(new KeyFrame(Duration.millis(0), new KeyValue(node.translateYProperty(), 0, WEB_EASE)), new KeyFrame(Duration.millis(200), new KeyValue(node.opacityProperty(), 1, WEB_EASE), new KeyValue(node.translateYProperty(), -20, WEB_EASE)), new KeyFrame(Duration.millis(1000), new KeyValue(node.opacityProperty(), 0, WEB_EASE), new KeyValue(node.translateYProperty(), endY, WEB_EASE)));
super.starting();
}
use of javafx.animation.KeyFrame in project fxexperience2 by EricCanull.
the class FadeInLeftBigTransition method starting.
@Override
protected void starting() {
double startX = -node.localToScene(0, 0).getX() - node.getBoundsInParent().getWidth();
timeline = new Timeline(new KeyFrame(Duration.millis(0), new KeyValue(node.opacityProperty(), 0, WEB_EASE), new KeyValue(node.translateXProperty(), startX, WEB_EASE)), new KeyFrame(Duration.millis(1000), new KeyValue(node.opacityProperty(), 1, WEB_EASE), new KeyValue(node.translateXProperty(), 0, WEB_EASE)));
super.starting();
}
use of javafx.animation.KeyFrame in project TeachingInSimulation by ScOrPiOzzy.
the class ExamController method initialize.
public void initialize(LibraryPublish publish) {
clear();
this.publish = publish;
this.library = publish.getLibrary();
this.libraryName.setTitle(library.getName());
// 创建答题卡项
List<Question> questions = this.library.getQuestions();
// // XXX 暂时不做:顺序打乱
// Collections.shuffle(questions);
float total = 0f;
for (int i = 0; i < questions.size(); i++) {
ToggleButton toggle = new ToggleButton(String.valueOf(i + 1));
toggle.getStyleClass().add("undo");
toggle.setUserData(i);
toggle.setWrapText(false);
flow.getChildren().add(toggle);
group.getToggles().add(toggle);
Question question = questions.get(i);
LibraryAnswer libraryAnswer = new LibraryAnswer();
libraryAnswer.setIndex(i);
libraryAnswer.setQuestion(question);
libraryAnswer.setQuestionId(question.getId());
this.answers.put(i, libraryAnswer);
total += question.getPoint();
}
this.total.setText(String.valueOf(total));
groupListener = (b, o, n) -> {
if (o == null) {
return;
} else if (n == null) {
this.group.selectToggle(o);
return;
}
if (!submited) {
// 验证上一个试题是否作答完成
checkAnswer((ToggleButton) o);
}
// 加载下一个试题
currIndex = (int) n.getUserData();
prev.setDisable(false);
next.setDisable(false);
if (currIndex <= 0) {
prev.setDisable(true);
}
if (currIndex >= questions.size() - 1) {
next.setDisable(true);
}
loadQuestion();
};
group.selectedToggleProperty().addListener(groupListener);
group.selectToggle(group.getToggles().get(0));
loadQuestion();
// 启动计时器
timeline = new Timeline();
timeline.setCycleCount(Timeline.INDEFINITE);
timeline.getKeyFrames().add(new KeyFrame(Duration.seconds(1), (ActionEvent event1) -> {
cost++;
this.minute.setText(String.valueOf(cost / 60));
this.second.setText(String.valueOf(cost % 60));
}));
timeline.play();
}
Aggregations