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());
}
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);
}
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);
}
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));
}
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()));
}
Aggregations