Search in sources :

Example 26 with DropShadow

use of javafx.scene.effect.DropShadow in project JFoenix by jfoenixadmin.

the class JFXDepthManager method createMaterialNode.

/**
 * this method will generate a new container node that prevent
 * control transformation to be applied to the shadow effect
 * (which makes it looks as a real shadow)
 */
public static Node createMaterialNode(Node control, int level) {
    Node container = new Pane(control) {

        @Override
        protected double computeMaxWidth(double height) {
            return computePrefWidth(height);
        }

        @Override
        protected double computeMaxHeight(double width) {
            return computePrefHeight(width);
        }

        @Override
        protected double computePrefWidth(double height) {
            return control.prefWidth(height);
        }

        @Override
        protected double computePrefHeight(double width) {
            return control.prefHeight(width);
        }
    };
    container.getStyleClass().add("depth-container");
    container.setPickOnBounds(false);
    level = level < 0 ? 0 : level;
    level = level > 5 ? 5 : level;
    container.setEffect(new DropShadow(BlurType.GAUSSIAN, depth[level].getColor(), depth[level].getRadius(), depth[level].getSpread(), depth[level].getOffsetX(), depth[level].getOffsetY()));
    return container;
}
Also used : Node(javafx.scene.Node) Pane(javafx.scene.layout.Pane) DropShadow(javafx.scene.effect.DropShadow)

Example 27 with DropShadow

use of javafx.scene.effect.DropShadow in project Malai by arnobl.

the class DnDHelpAnimation method createTransition.

@Override
public Transition createTransition() {
    ell = new Ellipse(x1, y1, size, size);
    text = new Text(textPress);
    text.xProperty().bind(ell.centerXProperty().add(ell.getRadiusX()));
    text.yProperty().bind(ell.centerYProperty().subtract(ell.getRadiusY()));
    ell.setFill(Color.LIGHTGRAY);
    ell.setEffect(new DropShadow(20d, Color.BLACK));
    helpPane.getChildren().add(ell);
    helpPane.getChildren().add(text);
    ell.setVisible(false);
    text.setVisible(false);
    ell.setFocusTraversable(false);
    ell.setMouseTransparent(true);
    text.setFocusTraversable(false);
    text.setMouseTransparent(true);
    final SequentialTransition mainTrans = new SequentialTransition();
    final ParallelTransition parallelTransition = new ParallelTransition(new Timeline(new KeyFrame(duration, new KeyValue(ell.centerXProperty(), x2))), new Timeline(new KeyFrame(duration, new KeyValue(ell.centerYProperty(), y2))));
    mainTrans.getChildren().add(new Timeline(new KeyFrame(Duration.millis(10), new KeyValue(text.visibleProperty(), Boolean.TRUE))));
    mainTrans.getChildren().add(new Timeline(new KeyFrame(Duration.millis(10), new KeyValue(ell.visibleProperty(), Boolean.TRUE))));
    mainTrans.getChildren().add(new PauseTransition(Duration.seconds(1.5)));
    mainTrans.getChildren().add(new ParallelTransition(new Timeline(new KeyFrame(Duration.millis(400d), new KeyValue(ell.radiusXProperty(), size / 2d))), new Timeline(new KeyFrame(Duration.millis(400d), new KeyValue(ell.radiusYProperty(), size / 2d)))));
    mainTrans.getChildren().add(new Timeline(new KeyFrame(Duration.millis(100d), new KeyValue(text.textProperty(), textDrag))));
    mainTrans.getChildren().add(parallelTransition);
    mainTrans.getChildren().add(new Timeline(new KeyFrame(Duration.millis(100d), new KeyValue(text.textProperty(), textRelease))));
    mainTrans.getChildren().add(new ParallelTransition(new Timeline(new KeyFrame(Duration.millis(400d), new KeyValue(ell.radiusXProperty(), size))), new Timeline(new KeyFrame(Duration.millis(400d), new KeyValue(ell.radiusYProperty(), size)))));
    mainTrans.getChildren().add(new PauseTransition(Duration.seconds(1.5)));
    mainTrans.getChildren().add(new Timeline(new KeyFrame(Duration.millis(10), new KeyValue(text.visibleProperty(), Boolean.FALSE))));
    mainTrans.getChildren().add(new Timeline(new KeyFrame(Duration.millis(10), new KeyValue(ell.visibleProperty(), Boolean.FALSE))));
    transition = mainTrans;
    return transition;
}
Also used : Ellipse(javafx.scene.shape.Ellipse) Timeline(javafx.animation.Timeline) KeyValue(javafx.animation.KeyValue) SequentialTransition(javafx.animation.SequentialTransition) KeyFrame(javafx.animation.KeyFrame) Text(javafx.scene.text.Text) PauseTransition(javafx.animation.PauseTransition) DropShadow(javafx.scene.effect.DropShadow) ParallelTransition(javafx.animation.ParallelTransition)

Example 28 with DropShadow

use of javafx.scene.effect.DropShadow in project Smartcity-Smarthouse by TechnionYP5777.

the class AppLabel method addShadow.

public AppLabel addShadow() {
    DropShadow ds = new DropShadow();
    ds.setOffsetY(3.0f);
    ds.setColor(Color.color(0.4f, 0.4f, 0.4f));
    setEffect(ds);
    return this;
}
Also used : DropShadow(javafx.scene.effect.DropShadow)

Example 29 with DropShadow

use of javafx.scene.effect.DropShadow in project tilesfx by HanSolo.

the class TileSkin method initGraphics.

// ******************** Initialization ************************************
protected void initGraphics() {
    // Set initial size
    if (Double.compare(tile.getPrefWidth(), 0.0) <= 0 || Double.compare(tile.getPrefHeight(), 0.0) <= 0 || Double.compare(tile.getWidth(), 0.0) <= 0 || Double.compare(tile.getHeight(), 0.0) <= 0) {
        if (tile.getPrefWidth() > 0 && tile.getPrefHeight() > 0) {
            tile.setPrefSize(tile.getPrefWidth(), tile.getPrefHeight());
        } else {
            tile.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }
    shadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 3, 0, 0, 0);
    notifyRegion = new NotifyRegion();
    enableNode(notifyRegion, false);
    pane = new Pane(notifyRegion);
    pane.setBorder(new Border(new BorderStroke(tile.getBorderColor(), BorderStrokeStyle.SOLID, new CornerRadii(PREFERRED_WIDTH * 0.025), new BorderWidths(tile.getBorderWidth()))));
    pane.setBackground(new Background(new BackgroundFill(tile.getBackgroundColor(), new CornerRadii(PREFERRED_WIDTH * 0.025), Insets.EMPTY)));
    getChildren().setAll(pane);
}
Also used : NotifyRegion(eu.hansolo.tilesfx.tools.NotifyRegion) Background(javafx.scene.layout.Background) BorderWidths(javafx.scene.layout.BorderWidths) BackgroundFill(javafx.scene.layout.BackgroundFill) BorderStroke(javafx.scene.layout.BorderStroke) CornerRadii(javafx.scene.layout.CornerRadii) Pane(javafx.scene.layout.Pane) Border(javafx.scene.layout.Border) DropShadow(javafx.scene.effect.DropShadow)

Example 30 with DropShadow

use of javafx.scene.effect.DropShadow in project tilesfx by HanSolo.

the class TimerControlTileSkin method initGraphics.

// ******************** Initialization ************************************
@Override
protected void initGraphics() {
    super.initGraphics();
    currentValueListener = o -> {
        // Update time only if clock is not already running
        if (tile.isRunning()) {
            return;
        }
        updateTime(ZonedDateTime.ofInstant(Instant.ofEpochSecond(tile.getCurrentTime()), ZoneId.of(ZoneId.systemDefault().getId())));
    };
    timeListener = o -> updateTime(tile.getTime());
    dateFormatter = DateTimeFormatter.ofPattern("EE d", tile.getLocale());
    sectionMap = new HashMap<>(tile.getTimeSections().size());
    for (TimeSection section : tile.getTimeSections()) {
        sectionMap.put(section, new Arc());
    }
    minuteRotate = new Rotate();
    hourRotate = new Rotate();
    secondRotate = new Rotate();
    sectionsPane = new Pane();
    sectionsPane.getChildren().addAll(sectionMap.values());
    Helper.enableNode(sectionsPane, tile.getSectionsVisible());
    minuteTickMarks = new Path();
    minuteTickMarks.setFillRule(FillRule.EVEN_ODD);
    minuteTickMarks.setFill(null);
    minuteTickMarks.setStroke(tile.getMinuteColor());
    minuteTickMarks.setStrokeLineCap(StrokeLineCap.ROUND);
    hourTickMarks = new Path();
    hourTickMarks.setFillRule(FillRule.EVEN_ODD);
    hourTickMarks.setFill(null);
    hourTickMarks.setStroke(tile.getHourColor());
    hourTickMarks.setStrokeLineCap(StrokeLineCap.ROUND);
    hour = new Rectangle(3, 60);
    hour.setArcHeight(3);
    hour.setArcWidth(3);
    hour.setStroke(tile.getHourColor());
    hour.getTransforms().setAll(hourRotate);
    minute = new Rectangle(3, 96);
    minute.setArcHeight(3);
    minute.setArcWidth(3);
    minute.setStroke(tile.getMinuteColor());
    minute.getTransforms().setAll(minuteRotate);
    second = new Rectangle(1, 96);
    second.setArcHeight(1);
    second.setArcWidth(1);
    second.setStroke(tile.getSecondColor());
    second.getTransforms().setAll(secondRotate);
    second.setVisible(tile.isSecondsVisible());
    second.setManaged(tile.isSecondsVisible());
    knob = new Circle(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, 4.5);
    knob.setStroke(Color.web("#282a3280"));
    dropShadow = new DropShadow();
    dropShadow.setColor(Color.rgb(0, 0, 0, 0.25));
    dropShadow.setBlurType(BlurType.TWO_PASS_BOX);
    dropShadow.setRadius(0.015 * PREFERRED_WIDTH);
    dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH);
    shadowGroupHour = new Group(hour);
    shadowGroupMinute = new Group(minute);
    shadowGroupSecond = new Group(second, knob);
    shadowGroupHour.setEffect(tile.isShadowsEnabled() ? dropShadow : null);
    shadowGroupMinute.setEffect(tile.isShadowsEnabled() ? dropShadow : null);
    shadowGroupSecond.setEffect(tile.isShadowsEnabled() ? dropShadow : null);
    titleText = new Text("");
    titleText.setTextOrigin(VPos.TOP);
    Helper.enableNode(titleText, !tile.getTitle().isEmpty());
    amPmText = new Text(tile.getTime().get(ChronoField.AMPM_OF_DAY) == 0 ? "AM" : "PM");
    dateText = new Text("");
    Helper.enableNode(dateText, tile.isDateVisible());
    text = new Text("");
    Helper.enableNode(text, tile.isTextVisible());
    getPane().getChildren().addAll(sectionsPane, hourTickMarks, minuteTickMarks, titleText, amPmText, dateText, text, shadowGroupHour, shadowGroupMinute, shadowGroupSecond);
}
Also used : Path(javafx.scene.shape.Path) Circle(javafx.scene.shape.Circle) Group(javafx.scene.Group) Arc(javafx.scene.shape.Arc) TimeSection(eu.hansolo.tilesfx.TimeSection) Rotate(javafx.scene.transform.Rotate) Rectangle(javafx.scene.shape.Rectangle) Text(javafx.scene.text.Text) Pane(javafx.scene.layout.Pane) DropShadow(javafx.scene.effect.DropShadow)

Aggregations

DropShadow (javafx.scene.effect.DropShadow)40 Pane (javafx.scene.layout.Pane)18 InnerShadow (javafx.scene.effect.InnerShadow)17 Region (javafx.scene.layout.Region)13 Text (javafx.scene.text.Text)13 Canvas (javafx.scene.canvas.Canvas)9 Group (javafx.scene.Group)8 Label (javafx.scene.control.Label)8 ImageView (javafx.scene.image.ImageView)8 Rotate (javafx.scene.transform.Rotate)6 AnchorPane (javafx.scene.layout.AnchorPane)5 Color (javafx.scene.paint.Color)5 Stop (javafx.scene.paint.Stop)5 Image (javafx.scene.image.Image)4 RadialGradient (javafx.scene.paint.RadialGradient)4 FXML (javafx.fxml.FXML)3 ProgressBar (javafx.scene.control.ProgressBar)3 StackPane (javafx.scene.layout.StackPane)3 VBox (javafx.scene.layout.VBox)3 LinearGradient (javafx.scene.paint.LinearGradient)3