use of javafx.scene.effect.ColorAdjust in project bitsquare by bitsquare.
the class Transitions method blur.
public void blur(Node node, int duration, double brightness, boolean removeNode, double blurRadius) {
if (removeEffectTimeLine != null)
removeEffectTimeLine.stop();
node.setMouseTransparent(true);
GaussianBlur blur = new GaussianBlur(0.0);
Timeline timeline = new Timeline();
KeyValue kv1 = new KeyValue(blur.radiusProperty(), blurRadius);
KeyFrame kf1 = new KeyFrame(Duration.millis(getDuration(duration)), kv1);
ColorAdjust darken = new ColorAdjust();
darken.setBrightness(0.0);
blur.setInput(darken);
KeyValue kv2 = new KeyValue(darken.brightnessProperty(), brightness);
KeyFrame kf2 = new KeyFrame(Duration.millis(getDuration(duration)), kv2);
timeline.getKeyFrames().addAll(kf1, kf2);
node.setEffect(blur);
if (removeNode)
timeline.setOnFinished(actionEvent -> UserThread.execute(() -> ((Pane) (node.getParent())).getChildren().remove(node)));
timeline.play();
}
use of javafx.scene.effect.ColorAdjust in project bitsquare by bitsquare.
the class Transitions method removeEffect.
private void removeEffect(Node node, int duration) {
if (node != null) {
node.setMouseTransparent(false);
removeEffectTimeLine = new Timeline();
GaussianBlur blur = (GaussianBlur) node.getEffect();
if (blur != null) {
KeyValue kv1 = new KeyValue(blur.radiusProperty(), 0.0);
KeyFrame kf1 = new KeyFrame(Duration.millis(getDuration(duration)), kv1);
removeEffectTimeLine.getKeyFrames().add(kf1);
ColorAdjust darken = (ColorAdjust) blur.getInput();
KeyValue kv2 = new KeyValue(darken.brightnessProperty(), 0.0);
KeyFrame kf2 = new KeyFrame(Duration.millis(getDuration(duration)), kv2);
removeEffectTimeLine.getKeyFrames().add(kf2);
removeEffectTimeLine.setOnFinished(actionEvent -> {
node.setEffect(null);
removeEffectTimeLine = null;
});
removeEffectTimeLine.play();
} else {
node.setEffect(null);
removeEffectTimeLine = null;
}
}
}
use of javafx.scene.effect.ColorAdjust in project bisq-desktop by bisq-network.
the class Transitions method blur.
public void blur(Node node, int duration, double brightness, boolean removeNode, double blurRadius) {
if (removeEffectTimeLine != null)
removeEffectTimeLine.stop();
node.setMouseTransparent(true);
GaussianBlur blur = new GaussianBlur(0.0);
Timeline timeline = new Timeline();
KeyValue kv1 = new KeyValue(blur.radiusProperty(), blurRadius);
KeyFrame kf1 = new KeyFrame(Duration.millis(getDuration(duration)), kv1);
ColorAdjust darken = new ColorAdjust();
darken.setBrightness(0.0);
blur.setInput(darken);
KeyValue kv2 = new KeyValue(darken.brightnessProperty(), brightness);
KeyFrame kf2 = new KeyFrame(Duration.millis(getDuration(duration)), kv2);
timeline.getKeyFrames().addAll(kf1, kf2);
node.setEffect(blur);
if (removeNode)
timeline.setOnFinished(actionEvent -> UserThread.execute(() -> ((Pane) (node.getParent())).getChildren().remove(node)));
timeline.play();
}
use of javafx.scene.effect.ColorAdjust in project POL-POM-5 by PlayOnLinux.
the class IconsListElementSkin method updateEnabled.
/**
* Updates grayscale of the miniature when the enabled state has been updated
*
* @param miniature The miniature
*/
private void updateEnabled(final Region miniature) {
if (!getControl().isEnabled()) {
final ColorAdjust grayScale = new ColorAdjust();
grayScale.setSaturation(-1);
miniature.setEffect(grayScale);
} else {
miniature.setEffect(null);
}
}
use of javafx.scene.effect.ColorAdjust in project fxexperience2 by EricCanull.
the class MainController method setIconBinding.
// Adjusts the color of the toogle icons upon selection
private void setIconBinding(ToggleButton toggle) {
ImageView icon = (ImageView) toggle.getGraphic();
icon.effectProperty().bind(new ObjectBinding<Effect>() {
{
bind(toggle.selectedProperty());
}
@Override
protected Effect computeValue() {
return toggle.isSelected() ? null : new ColorAdjust(0, -1, 0, 0);
}
});
}
Aggregations