Skip to content

Commit

Permalink
Fixed view movement
Browse files Browse the repository at this point in the history
  • Loading branch information
AcaciaMan authored Dec 11, 2021
1 parent de5f5d7 commit eab202d
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/main/java/sample/RaceView.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public class RaceView {

public Circle[] gates;

public boolean once = false;

public void translateViews() {

circle.setTranslateY(-RaceView.views[0][1]);
Expand All @@ -25,17 +27,20 @@ public void translateViews() {

public void translateViews1(ParallelTransition pt) {

TranslateTransition translateTransition =
new TranslateTransition(new javafx.util.Duration(50.0), circle);
translateTransition.setByY(RaceView.views[1][1]);

pt.getChildren().add(translateTransition);
pt.play();
if (!once) {
once = true;
TranslateTransition translateTransition =
new TranslateTransition(new javafx.util.Duration(1000.0), circle);
translateTransition.setByY(RaceView.views[1][1]);

for (int i = 0; i < Engine.gates.length; i++) {
gates[i].setTranslateY(RaceView.views[1][1]-100);
}
pt.getChildren().add(translateTransition);
pt.play();

for (int i = 0; i < Engine.gates.length; i++) {
gates[i].setTranslateY(RaceView.views[1][1] - 100);
}
}

}
}

0 comments on commit eab202d

Please sign in to comment.