private void init(Stage primaryStage) { Group root = new Group(); primaryStage.setResizable(false); primaryStage.setScene(new Scene(root, 140,140)); Rectangle rect = new Rectangle(20, 20, 100, 100); rect.setArcHeight(20); rect.setArcWidth(20); rect.setFill(Color.ORANGE); root.getChildren().add(rect); rotateTransition = RotateTransitionBuilder.create() .node(rect) .duration(Duration.seconds(4)) .fromAngle(0) .toAngle(720) .cycleCount(Timeline.INDEFINITE) .autoReverse(true) .build(); }
public RotateTransitionSample() { super(140,140); Rectangle rect = new Rectangle(20, 20, 100, 100); rect.setArcHeight(20); rect.setArcWidth(20); rect.setFill(Color.ORANGE); getChildren().add(rect); rotateTransition = RotateTransitionBuilder.create() .node(rect) .duration(Duration.seconds(4)) .fromAngle(0) .toAngle(720) .cycleCount(Timeline.INDEFINITE) .autoReverse(true) .build(); }
private void initEffects() { rotateTransition = RotateTransitionBuilder.create() .node(radialElements) .duration(Duration.seconds(6)) .fromAngle(0) .toAngle(720) .cycleCount(2) .autoReverse(true) .build(); }
public void handle(ActionEvent t) { double parentRot = slide.getParent().getParent().getRotate(); double parentScale = slide.getParent().getParent().getScaleX(); if (parentScale != PresentationController.SCALE) { ScaleTransitionBuilder.create() .node(slide.getParent().getParent()) .toX(PresentationController.SCALE) .toY(PresentationController.SCALE) .duration(Duration.millis(600)) .onFinished(this) .build().play(); } else if (parentRot != PresentationController.getRotation(slide.getRotate())) { RotateTransitionBuilder.create() .toAngle(PresentationController.getRotation(slide.getRotate())) .node(slide.getParent().getParent()) .onFinished(this) .duration(Duration.millis(600)).build().play(); } else { Bounds point = slide.localToScene(slide.getBoundsInLocal()); double nowX = point.getMinX(); double nowY = point.getMinY(); TranslateTransitionBuilder.create() .node(slide.getParent().getParent()) .byX(-nowX) .byY(-nowY) .interpolator(Interpolator.EASE_OUT) .duration(Duration.millis(600)) .onFinished(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent arg0) { slide.toFront(); onFinished.handle(arg0); } }) .build().play(); } }