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