@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(); }
public VUMeter() { for(int i=0; i<bars.length;i++) { bars[i] = new Rectangle(26, 2); bars[i].setFill(BAR_COLOR); bars[i].setX(-13); bars[i].setY(1-(i*4)); } getChildren().addAll(bars); setEffect(DropShadowBuilder.create().blurType(BlurType.TWO_PASS_BOX).radius(10).spread(0.4).color(Color.web("#b10000")).build()); }
/** * Build the drop shadow. * * @return the drop shadow effect */ private Effect getDropShadow() { return DropShadowBuilder.create() .offsetX(0) .offsetY(5) .color(MTColors.BEAN_SHADOW.get()) .blurType(BlurType.GAUSSIAN) .radius(5) .spread(0.1) .build(); }
public RaceTrack() { ImageView carImageView = new ImageView(new Image( DataAppPreloader.class.getResourceAsStream("images/car.png"))); road = SVGPathBuilder.create() .content(trackPath).fill(null).stroke(Color.gray(0.4)) .strokeWidth(50) .effect(DropShadowBuilder.create().radius(20).blurType(BlurType.ONE_PASS_BOX).build()) .build(); SVGPath trackLine = SVGPathBuilder.create() .content(trackPath).fill(null).stroke(Color.WHITE) .strokeDashArray(8d,6d).build(); Line startLine = LineBuilder.create() .startX(610.312).startY(401.055).endX(610.312).endY(450.838) .stroke(Color.WHITE).strokeDashArray(2d,2d).build(); Text startFinish = TextBuilder.create().text("START/FINISH").fill(Color.WHITE) .x(570).y(475).build(); percentage = TextBuilder.create().text("0%") .x(390).y(170).font(Font.font("System", 60)) .fill(Color.web("#ddf3ff")) .stroke(Color.web("#73c0f7")) .effect(DropShadowBuilder.create().radius(15).color(Color.web("#3382ba")).blurType(BlurType.ONE_PASS_BOX).build()) .build(); ImageView raceCarImg = new ImageView(new Image( DataAppPreloader.class.getResourceAsStream("images/Mini-red-and-white.png"))); raceCarImg.setX(raceCarImg.getImage().getWidth()/2); raceCarImg.setY(raceCarImg.getImage().getHeight()/2); raceCarImg.setRotate(90); raceCar = new Group(raceCarImg); track = new Group(road, trackLine, startLine, startFinish); track.setCache(true); // add children getChildren().addAll(track, raceCar, percentage); // Create path animation that we will use to drive the car along the track race = new PathTransition(Duration.seconds(1), road, raceCar); race.setOrientation(PathTransition.OrientationType.ORTHOGONAL_TO_TANGENT); race.play(); race.pause(); // center our content and set our size setTranslateX(-road.getBoundsInLocal().getMinX()); setTranslateY(-road.getBoundsInLocal().getMinY()); setPrefSize(road.getBoundsInLocal().getWidth(), road.getBoundsInLocal().getHeight()); setMaxSize(USE_PREF_SIZE, USE_PREF_SIZE); }
/** * {@inheritDoc} */ @Override protected void initView() { node().setAlignment(Pos.CENTER); node().setPrefSize(650, 200); node().setMaxSize(700, 200); this.leftOperand = getExpressionTextBuilder() .wrappingWidth(180) .build(); this.operator = getExpressionTextBuilder() .wrappingWidth(60) .build(); this.rightOperand = getExpressionTextBuilder() .wrappingWidth(120) .build(); this.equality = getExpressionTextBuilder() .wrappingWidth(60) .text("=") .build(); this.result = getExpressionTextBuilder() .wrappingWidth(180) .scaleX(1.0) .scaleY(1.0) .text("") .build(); node().getChildren().addAll(this.leftOperand, this.operator, this.rightOperand, this.equality, this.result); // Manage Animation this.expressionResolved = buildExpressionResolved(); this.expressionFailure = buildExpressionFailure(); this.showExpression = SequentialTransitionBuilder.create() .children( buildTextPartAnimation(getLeftOperand()), buildTextPartAnimation(getOperator()), buildTextPartAnimation(getRightOperand()), buildTextPartAnimation(getEquality())) .build(); // Add a nice drop shadow in all direction final DropShadow s = DropShadowBuilder.create() .height(10) .width(10) .color(Color.BLACK) .blurType(BlurType.THREE_PASS_BOX) .radius(10) .spread(0.1) .build(); node().setEffect(s); }