Details
-
Bug
-
Resolution: Fixed
-
P4
-
8
Description
When a Transition is put into a ParallelTransition, it does not behave as expected and as it did in JavaFX 2.2.
See this example: The transition always starts at y = 0, although it should have another value.
This is a regression and nearly the same bug as inRT-32811.
(The only difference is, that this bug is with ParallelTransition, where as the other one was with SequentialTransition).
Tested with Java 8 b120.
import javafx.animation.ParallelTransition;
import javafx.animation.RotateTransition;
import javafx.animation.SequentialTransition;
import javafx.animation.TranslateTransition;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
import javafx.util.Duration;
public class TestApp5 extends Application {
public static void main(String[] args) {
Application.launch();
}
private int y = 1;
@Override
public void start(Stage stage) throws Exception {
Rectangle rectangle = new Rectangle(50, 50, Color.RED);
final ParallelTransition parallelTransition = new ParallelTransition();
final RotateTransition rotateTransition = new RotateTransition(Duration.seconds(1), rectangle);
rotateTransition.setToAngle(0);
final TranslateTransition translateTransition = new TranslateTransition(Duration.seconds(1), rectangle);
translateTransition.setToY(y * 10);
parallelTransition.getChildren().addAll(translateTransition);
Group group = new Group();
group.getChildren().add(rectangle);
parallelTransition.setOnFinished(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
// This line helps a little bit, but there's still a lot of flickering.
// And it wasn't needed in JavaFX 2.2.
//translateTransition.setFromY(y * 10);
translateTransition.setToY(++y * 10);
//rotateTransition.setToAngle(rotateTransition.getToAngle()+90);
parallelTransition.playFromStart();
}
});
parallelTransition.playFromStart();
Scene scene = new Scene(group, 500, 500);
stage.setScene(scene);
stage.show();
}
}
See this example: The transition always starts at y = 0, although it should have another value.
This is a regression and nearly the same bug as in
(The only difference is, that this bug is with ParallelTransition, where as the other one was with SequentialTransition).
Tested with Java 8 b120.
import javafx.animation.ParallelTransition;
import javafx.animation.RotateTransition;
import javafx.animation.SequentialTransition;
import javafx.animation.TranslateTransition;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
import javafx.util.Duration;
public class TestApp5 extends Application {
public static void main(String[] args) {
Application.launch();
}
private int y = 1;
@Override
public void start(Stage stage) throws Exception {
Rectangle rectangle = new Rectangle(50, 50, Color.RED);
final ParallelTransition parallelTransition = new ParallelTransition();
final RotateTransition rotateTransition = new RotateTransition(Duration.seconds(1), rectangle);
rotateTransition.setToAngle(0);
final TranslateTransition translateTransition = new TranslateTransition(Duration.seconds(1), rectangle);
translateTransition.setToY(y * 10);
parallelTransition.getChildren().addAll(translateTransition);
Group group = new Group();
group.getChildren().add(rectangle);
parallelTransition.setOnFinished(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
// This line helps a little bit, but there's still a lot of flickering.
// And it wasn't needed in JavaFX 2.2.
//translateTransition.setFromY(y * 10);
translateTransition.setToY(++y * 10);
//rotateTransition.setToAngle(rotateTransition.getToAngle()+90);
parallelTransition.playFromStart();
}
});
parallelTransition.playFromStart();
Scene scene = new Scene(group, 500, 500);
stage.setScene(scene);
stage.show();
}
}
Attachments
Issue Links
- blocks
-
JDK-8095902 animation hangs up
- Resolved
- duplicates
-
JDK-8092660 [Animation] Combinations of transitions don't work as expected (circle should fade in)
- Resolved
- relates to
-
JDK-8096830 Regression: Misbehavior of TranslateTransition within SequentialTransition
- Closed