Search in sources :

Example 21 with DropShadow

use of javafx.scene.effect.DropShadow in project FXGL by AlmasB.

the class EntitiesScenesSample method pushNewGameSubScene.

private void pushNewGameSubScene() {
    // 3D = true
    var scene = new GameSubScene(getAppWidth(), getAppHeight(), true);
    var text = getUIFactoryService().newText("Sub Scene", Color.BLACK, 54);
    text.setTranslateX(250);
    text.setTranslateY(250);
    text.setEffect(new DropShadow(5, 7.5, 3.5, Color.BLACK));
    var player = entityBuilder().at(0, 0, -5).view(new Cuboid(1, 1, 1)).build();
    animationBuilder().interpolator(Interpolators.EXPONENTIAL.EASE_OUT()).duration(Duration.seconds(2)).repeatInfinitely().autoReverse(true).translate(player).from(new Point3D(-3, 1, -11)).to(new Point3D(4, 0, 0)).buildAndPlay(scene);
    scene.getGameScene().setBackgroundColor(Color.web("green", 0.3));
    scene.getGameScene().addUINode(text);
    scene.getGameWorld().addEntities(player);
    getSceneService().pushSubScene(scene);
    onKeyBuilder(scene.getInput(), KeyCode.F).onActionBegin(() -> pushNewGameSubScene());
    onKeyBuilder(scene.getInput(), KeyCode.G).onActionBegin(() -> getSceneService().popSubScene());
}
Also used : Point3D(javafx.geometry.Point3D) GameSubScene(com.almasb.fxgl.app.scene.GameSubScene) Cuboid(com.almasb.fxgl.scene3d.Cuboid) DropShadow(javafx.scene.effect.DropShadow)

Example 22 with DropShadow

use of javafx.scene.effect.DropShadow in project bitsquare by bitsquare.

the class MainView method setupNotificationIcon.

private void setupNotificationIcon(Pane buttonHolder) {
    Label label = new Label();
    label.textProperty().bind(model.numPendingTradesAsString);
    label.relocate(5, 1);
    label.setId("nav-alert-label");
    ImageView icon = new ImageView();
    icon.setLayoutX(0.5);
    icon.setId("image-alert-round");
    Pane notification = new Pane();
    notification.relocate(30, 9);
    notification.setMouseTransparent(true);
    notification.setEffect(new DropShadow(4, 1, 2, Color.GREY));
    notification.getChildren().addAll(icon, label);
    notification.visibleProperty().bind(model.showPendingTradesNotification);
    buttonHolder.getChildren().add(notification);
}
Also used : ImageView(javafx.scene.image.ImageView) AnchorPane(javafx.scene.layout.AnchorPane) DropShadow(javafx.scene.effect.DropShadow)

Example 23 with DropShadow

use of javafx.scene.effect.DropShadow in project bisq-desktop by bisq-network.

the class MainView method setupNotificationIcon.

private void setupNotificationIcon(Pane buttonHolder) {
    Label label = new AutoTooltipLabel();
    label.textProperty().bind(model.numPendingTradesAsString);
    label.relocate(5, 1);
    label.setId("nav-alert-label");
    ImageView icon = new ImageView();
    icon.setId("image-alert-round");
    Pane notification = new Pane();
    notification.relocate(30, 9);
    notification.setMouseTransparent(true);
    notification.setEffect(new DropShadow(4, 1, 2, Color.GREY));
    notification.getChildren().addAll(icon, label);
    notification.visibleProperty().bind(model.showPendingTradesNotification);
    buttonHolder.getChildren().add(notification);
}
Also used : AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) Label(javafx.scene.control.Label) ImageView(javafx.scene.image.ImageView) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) StackPane(javafx.scene.layout.StackPane) Pane(javafx.scene.layout.Pane) AnchorPane(javafx.scene.layout.AnchorPane) BorderPane(javafx.scene.layout.BorderPane) DropShadow(javafx.scene.effect.DropShadow)

Example 24 with DropShadow

use of javafx.scene.effect.DropShadow in project KNOBS by ESSICS.

the class Knob method initComponents.

protected void initComponents() {
    angleStepProperty().bind(Bindings.divide(ANGLE_RANGE, Bindings.subtract(maxValueProperty(), minValueProperty())));
    backgroundProperty().bind(Bindings.createObjectBinding(() -> Color.TRANSPARENT.equals(getBackgroundColor()) ? Background.EMPTY : new Background(new BackgroundFill(getBackgroundColor(), CornerRadii.EMPTY, Insets.EMPTY)), backgroundColorProperty()));
    dropShadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), PREFERRED_WIDTH * 0.016, 0.0, 0, PREFERRED_WIDTH * 0.028);
    highlight = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.20), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008);
    innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.20), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008);
    highlight.setInput(innerShadow);
    dropShadow.setInput(highlight);
    barGradient = new ConicalGradient(reorderStops(getGradientStops()));
    barArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, BAR_START_ANGLE, 0);
    barArc.setType(ArcType.OPEN);
    barArc.setStrokeLineCap(StrokeLineCap.ROUND);
    barArc.setFill(null);
    barArc.setStroke(barGradient.getImagePattern(new Rectangle(0, 0, PREFERRED_WIDTH, PREFERRED_HEIGHT)));
    currentValueBarArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, BAR_START_ANGLE, 0);
    currentValueBarArc.setType(ArcType.OPEN);
    currentValueBarArc.setStrokeLineCap(StrokeLineCap.ROUND);
    currentValueBarArc.setFill(null);
    currentValueBarArc.strokeProperty().bind(currentValueColorProperty());
    currentValueBarArc.lengthProperty().bind(Bindings.createDoubleBinding(() -> {
        double localMin = (isZeroDetentEnabled() && getMinValue() < 0) ? Math.min(0, getMaxValue()) : getMinValue();
        double length = getAngleStep() * (localMin - getCurrentValue());
        if (length == 0) {
            length = getAngleStep() * (getMinValue() - getMaxValue()) / 10000;
        }
        return length;
    }, angleStepProperty(), currentValueProperty(), maxValueProperty(), minValueProperty(), zeroDetentEnabledProperty()));
    currentValueBarArc.opacityProperty().bind(Bindings.createDoubleBinding(() -> {
        double localMin = (isZeroDetentEnabled() && getMinValue() < 0) ? Math.min(0, getMaxValue()) : getMinValue();
        double length = getAngleStep() * (localMin - getCurrentValue());
        if (length == 0) {
            return 0.6666;
        } else {
            return 1.0;
        }
    }, angleStepProperty(), currentValueProperty(), maxValueProperty(), minValueProperty(), zeroDetentEnabledProperty()));
    currentValueBarArc.startAngleProperty().bind(Bindings.createDoubleBinding(() -> {
        double angle = BAR_START_ANGLE;
        if (isZeroDetentEnabled() && getMinValue() < 0) {
            angle += Math.max(getAngleStep() * getMinValue(), -ANGLE_RANGE);
        }
        return angle;
    }, angleStepProperty(), minValueProperty(), zeroDetentEnabledProperty()));
    double center = PREFERRED_WIDTH * 0.5;
    ring = Shape.subtract(new Circle(center, center, PREFERRED_WIDTH * 0.42), new Circle(center, center, PREFERRED_WIDTH * 0.3));
    ring.fillProperty().bind(colorProperty());
    ring.setEffect(dropShadow);
    ring.addEventHandler(MouseEvent.MOUSE_PRESSED, e -> {
        if (!isDisabled() && !isDragDisabled()) {
            touchRotate(e.getSceneX(), e.getSceneY());
        }
    });
    ring.addEventHandler(MouseEvent.MOUSE_DRAGGED, e -> {
        if (!isDisabled() && !isDragDisabled()) {
            touchRotate(e.getSceneX(), e.getSceneY());
        }
    });
    ring.addEventHandler(MouseEvent.MOUSE_RELEASED, e -> {
        if (!isDisabled() && !isDragDisabled()) {
            fireTargeValueSet();
        }
    });
    mainCircle = new Circle();
    mainCircle.fillProperty().bind(Bindings.createObjectBinding(() -> getColor().darker().darker(), colorProperty()));
    mainCircle.setOnMouseClicked(doubleClickHandler);
    text = new Text(String.format(format, getCurrentValue()));
    text.fillProperty().bind(textColorProperty());
    text.setOnMouseClicked(doubleClickHandler);
    text.setTextOrigin(VPos.CENTER);
    targetText = new Text(String.format(format, getTargetValue()));
    targetText.fillProperty().bind(Bindings.createObjectBinding(() -> getTextColor().darker(), textColorProperty()));
    targetText.setOnMouseClicked(doubleClickHandler);
    targetText.setTextOrigin(VPos.CENTER);
    targetText.visibleProperty().bind(Bindings.createBooleanBinding(() -> isTargetValueAlwaysVisible() || !close(getCurrentValue(), getTargetValue(), (getMaxValue() - getMinValue()) * PROXIMITY_ERROR), targetValueAlwaysVisibleProperty(), currentValueProperty(), targetValueProperty(), maxValueProperty(), minValueProperty()));
    unitText = new Text(getUnit());
    unitText.fillProperty().bind(Bindings.createObjectBinding(() -> getTextColor().darker(), textColorProperty()));
    unitText.setOnMouseClicked(doubleClickHandler);
    unitText.setTextOrigin(VPos.CENTER);
    textMinTag = new Polygon(0.0, 0.7, 0.6, 0.7, 0.6, 0.9, 0.0, 0.9);
    textMinTag.fillProperty().bind(Bindings.createObjectBinding(() -> getColor().darker().darker(), colorProperty()));
    textMinTag.visibleProperty().bind(extremaVisibleProperty());
    textMin = new Text(String.format(format, getMinValue()));
    textMin.fillProperty().bind(Bindings.createObjectBinding(() -> getTextColor().darker(), textColorProperty()));
    textMin.setTextOrigin(VPos.CENTER);
    textMin.visibleProperty().bind(extremaVisibleProperty());
    textMaxTag = new Polygon(0.0, 0.7, 0.6, 0.7, 0.6, 0.9, 0.0, 0.9);
    textMaxTag.fillProperty().bind(Bindings.createObjectBinding(() -> getColor().darker().darker(), colorProperty()));
    textMaxTag.visibleProperty().bind(extremaVisibleProperty());
    textMax = new Text(String.format(format, getMaxValue()));
    textMax.fillProperty().bind(Bindings.createObjectBinding(() -> getTextColor().darker(), textColorProperty()));
    textMax.setTextOrigin(VPos.CENTER);
    textMax.visibleProperty().bind(extremaVisibleProperty());
    tagBarArc = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.46, PREFERRED_HEIGHT * 0.46, BAR_START_ANGLE + 15, 50);
    tagBarArc.setType(ArcType.OPEN);
    tagBarArc.setStrokeLineCap(StrokeLineCap.ROUND);
    tagBarArc.setFill(null);
    tagBarArc.strokeProperty().bind(tagColorProperty());
    tagBarArc.visibleProperty().bind(tagVisibleProperty());
    indicatorRotate = new Rotate(-ANGLE_RANGE * 0.5, center, center);
    indicatorGlow = new DropShadow(BlurType.TWO_PASS_BOX, getIndicatorColor(), PREFERRED_WIDTH * 0.020, 0.0, 0, 0);
    indicatorInnerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.50), PREFERRED_WIDTH * 0.008, 0.0, 0, PREFERRED_WIDTH * 0.008);
    indicatorHighlight = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.35), PREFERRED_WIDTH * 0.008, 0.0, 0, -PREFERRED_WIDTH * 0.008);
    indicatorRotate.angleProperty().bind(Bindings.subtract(Bindings.multiply(Bindings.subtract(targetValueProperty(), minValueProperty()), angleStepProperty()), ANGLE_RANGE * 0.5));
    indicatorGlow.colorProperty().bind(selectionColorProperty());
    indicatorHighlight.setInput(indicatorInnerShadow);
    indicator = new Circle();
    indicator.effectProperty().bind(Bindings.createObjectBinding(() -> isSelected() ? indicatorGlow : null, selectionColorProperty(), selectedProperty()));
    indicator.disableProperty().bind(dragDisabledProperty());
    indicator.fillProperty().bind(Bindings.createObjectBinding(() -> {
        Color c = isSelected() ? getSelectionColor() : getIndicatorColor();
        return isDragDisabled() ? c.deriveColor(0, 1, 0.92, 0.6) : c;
    }, colorProperty(), dragDisabledProperty(), indicatorColorProperty(), selectionColorProperty(), selectedProperty()));
    indicator.strokeProperty().bind(Bindings.createObjectBinding(() -> {
        Color c = isSelected() ? getSelectionColor().darker().darker() : getIndicatorColor().darker().darker();
        return isDragDisabled() ? c.deriveColor(0, 1, 0.92, 0.6) : c;
    }, colorProperty(), dragDisabledProperty(), indicatorColorProperty(), selectionColorProperty(), selectedProperty()));
    indicator.setMouseTransparent(true);
    indicator.getTransforms().add(indicatorRotate);
    Group indicatorGroup = new Group(indicator);
    indicatorGroup.setEffect(indicatorHighlight);
    pane = new Pane(barArc, currentValueBarArc, ring, mainCircle, text, targetText, unitText, textMinTag, textMin, textMaxTag, textMax, tagBarArc, indicatorGroup);
    pane.setPrefSize(PREFERRED_HEIGHT, PREFERRED_HEIGHT);
    pane.backgroundProperty().bind(Bindings.createObjectBinding(() -> new Background(new BackgroundFill(getColor().darker(), new CornerRadii(1024), Insets.EMPTY)), colorProperty()));
    pane.setEffect(highlight);
    Platform.runLater(() -> getChildren().setAll(pane));
}
Also used : ConicalGradient(eu.hansolo.medusa.tools.ConicalGradient) Circle(javafx.scene.shape.Circle) Group(javafx.scene.Group) Background(javafx.scene.layout.Background) Rotate(javafx.scene.transform.Rotate) InnerShadow(javafx.scene.effect.InnerShadow) BackgroundFill(javafx.scene.layout.BackgroundFill) Color(javafx.scene.paint.Color) Rectangle(javafx.scene.shape.Rectangle) Text(javafx.scene.text.Text) Pane(javafx.scene.layout.Pane) BorderPane(javafx.scene.layout.BorderPane) DropShadow(javafx.scene.effect.DropShadow) Arc(javafx.scene.shape.Arc) Polygon(javafx.scene.shape.Polygon) CornerRadii(javafx.scene.layout.CornerRadii)

Example 25 with DropShadow

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

the class JFXDepthManager method setDepth.

/**
 * this method is used to add shadow effect to the node,
 * however the shadow is not real ( gets affected with node transformations)
 * <p>
 * use {@link #createMaterialNode(Node, int)} instead to generate a real shadow
 */
public static void setDepth(Node control, int level) {
    level = level < 0 ? 0 : level;
    level = level > 5 ? 5 : level;
    control.setEffect(new DropShadow(BlurType.GAUSSIAN, depth[level].getColor(), depth[level].getRadius(), depth[level].getSpread(), depth[level].getOffsetX(), depth[level].getOffsetY()));
}
Also used : 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