@Override public void start(Stage primaryStage) throws Exception { Button button = new Button("BindableTransition"); DropShadow shadow = DropShadowBuilder.create().build(); button.setEffect(shadow); button.setStyle("-fx-font-size: 32px;"); final Duration duration = Duration.millis(1200); BindableTransition transition = new BindableTransition(duration); transition.setCycleCount(1000); transition.setAutoReverse(true); shadow.offsetXProperty().bind(transition.fractionProperty().multiply(32)); shadow.offsetYProperty().bind(transition.fractionProperty().multiply(32)); button.translateXProperty().bind(transition.fractionProperty().multiply(-32)); transition.play(); StackPane pane = new StackPane(); pane.getChildren().add(button); Scene myScene = new Scene(pane, 800, 600); primaryStage.setScene(myScene); primaryStage.show(); }
/** * Build and return the header panel. * * @return the header panel */ protected Node getHeaderPanel() { final Pane headerPane = PaneBuilder.create() .styleClass("header") .layoutX(0.0) .layoutY(0.0) .minWidth(1024) .prefWidth(1024) .build(); this.primaryTitle = LabelBuilder.create() // .styleClass("slideTitle") .font(JpFonts.SLIDE_TITLE.get()) .textFill(PrezColors.SLIDE_TITLE.get()) .text(model().getSlide().getTitle().replaceAll("\\\\n", "\n").replaceAll("\\\\t", "\t")) .layoutX(3000) // 40 .layoutY(45) // .style("-fx-background-color:#CCCB20") .build(); this.secondaryTitle = LabelBuilder.create() // .styleClass("slideTitle") .font(PrezFonts.SLIDE_SUB_TITLE.get()) .textFill(PrezColors.SLIDE_TITLE.get()) // .scaleX(1.5) // .scaleY(1.5) .layoutX(110) .layoutY(80) .minWidth(450) // .style("-fx-background-color:#E53B20") .alignment(Pos.CENTER_RIGHT) .textAlignment(TextAlignment.RIGHT) .build(); this.prezTitle = LabelBuilder.create() // .styleClass("slideTitle") .font(JpFonts.PREZ_TITLE.get()) .textFill(Color.LIGHTGRAY) // .scaleX(1.5) // .scaleY(1.5) // .layoutX(545) // .layoutY(711) .layoutX(480) .layoutY(14.0) .minWidth(450) // .style("-fx-background-color:#E53B20") .alignment(Pos.CENTER_RIGHT) .textAlignment(TextAlignment.RIGHT) .build(); this.placeLogo = ImageViewBuilder.create() // .layoutX(680.0) // .layoutY(-14.0) .layoutX(1200) .layoutY(700) // .scaleX(0.6) // .scaleY(0.6) .image(JpImages.JREBIRTH_LOGO.get()) .build(); final Polyline pl = PolylineBuilder.create() .strokeWidth(3) .stroke(Color.web("F79508")) .points(684.0, 12.0, 946.0, 12.0, 946.0, 107.0) .build(); this.topRectangle = RectangleBuilder.create() .layoutX(95.0) .layoutY(95.0) .width(0.0) // 60.0 .height(14.0) .fill(Color.web("1C9A9A")) .build(); this.bottomRectangle = RectangleBuilder.create() .layoutX(0) .layoutY(738) .width(0.0) // 60.0 .height(14.0) .fill(Color.web("1C9A9A")) .build(); // this.circle = CircleBuilder.create() // .scaleX(0) // .scaleY(0) // .layoutX(18 + 54) // .layoutY(18 + 54) // .radius(54) // .fill(Color.web("444442")) // .build(); final Effect smallPokemonEffect = InnerShadowBuilder.create() .offsetX(1) .offsetY(1) .color(Color.LIGHTGRAY) .input(GlowBuilder.create().level(0.6).build()) .build(); final Effect bigPokemonEffect = DropShadowBuilder.create() .offsetX(2) .offsetY(2) .input(GlowBuilder.create().level(0.6).build()) .build(); this.smallPokemon = SVGPathBuilder.create() .scaleX(0) .scaleY(0) .layoutX(40) .layoutY(40) .fill(Color.web("F79508")) .effect(smallPokemonEffect) .content( "M64.332,33.584l3.166-3.166C65.99,14.311,53.104,1.493,36.916,0l-3.167,3.167L30.582,0 C14.394,1.493,1.507,14.312,0,30.419l3.166,3.166L0,36.751c1.508,16.106,14.395,28.925,30.582,30.418l3.167-3.167l3.168,3.168 c16.188-1.493,29.073-14.313,30.58-30.421L64.332,33.584z M37.387,44.951h-7.275c-5.114,0-9.26-4.146-9.26-9.26v-4.917 c0-5.114,4.146-9.26,9.26-9.26h7.275c5.114,0,9.26,4.146,9.26,9.26v4.917C46.646,40.805,42.501,44.951,37.387,44.951z") .build(); this.bigPokemon = SVGPathBuilder.create() .scaleX(0) .scaleY(0) .layoutX(40) .layoutY(40) .fill(Color.web("D9E021")) .effect(bigPokemonEffect) .content( "M64.332,33.584l3.166-3.166C65.99,14.311,53.104,1.493,36.916,0l-3.167,3.167L30.582,0 C14.394,1.493,1.507,14.312,0,30.419l3.166,3.166L0,36.751c1.508,16.106,14.395,28.925,30.582,30.418l3.167-3.167l3.168,3.168 c16.188-1.493,29.073-14.313,30.58-30.421L64.332,33.584z M37.387,44.951h-7.275c-5.114,0-9.26-4.146-9.26-9.26v-4.917 c0-5.114,4.146-9.26,9.26-9.26h7.275c5.114,0,9.26,4.146,9.26,9.26v4.917C46.646,40.805,42.501,44.951,37.387,44.951z") .build(); this.pageLabel = LabelBuilder.create() .layoutX(970) .layoutY(18.0) .text(String.valueOf(model().getSlide().getPage())) .font(PrezFonts.PAGE.get()) .textFill(Color.WHITE) .rotate(90.0) .build(); // final FlowPane fp = FlowPaneBuilder.create() // .orientation(Orientation.HORIZONTAL) // .alignment(Pos.BASELINE_CENTER) // .children(this.secondaryTitle) // // .style("-fx-background-color:#CCCCCC") // .build(); headerPane .getChildren() .addAll( this.topRectangle, this.bottomRectangle, this.bigPokemon, this.smallPokemon, this.primaryTitle, this.placeLogo, this.secondaryTitle, pl, this.pageLabel, this.prezTitle); // AnchorPane.setLeftAnchor(primaryTitle, 40.0); // AnchorPane.setTopAnchor(primaryTitle, 45.0); // // AnchorPane.setRightAnchor(this.secondaryTitle, 80.0); // AnchorPane.setTopAnchor(primaryTitle, 20.0); // ap.setStyle("-fx-background-color:#002266"); // sp.setStyle("-fx-background-color:#663366"); // StackPane.setAlignment(ap, Pos.BOTTOM_CENTER); // sp.getChildren().add(ap); return headerPane; }