Search in sources :

Example 1 with ColorAdjust

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();
}
Also used : EventHandler(javafx.event.EventHandler) Inject(javax.inject.Inject) Preferences(io.bitsquare.user.Preferences) ActionEvent(javafx.event.ActionEvent) Duration(javafx.util.Duration) UserThread(io.bitsquare.common.UserThread) Node(javafx.scene.Node) javafx.animation(javafx.animation) ColorAdjust(javafx.scene.effect.ColorAdjust) GaussianBlur(javafx.scene.effect.GaussianBlur) Pane(javafx.scene.layout.Pane) GaussianBlur(javafx.scene.effect.GaussianBlur) ColorAdjust(javafx.scene.effect.ColorAdjust) Pane(javafx.scene.layout.Pane)

Example 2 with ColorAdjust

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;
        }
    }
}
Also used : GaussianBlur(javafx.scene.effect.GaussianBlur) ColorAdjust(javafx.scene.effect.ColorAdjust)

Example 3 with ColorAdjust

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();
}
Also used : EventHandler(javafx.event.EventHandler) KeyFrame(javafx.animation.KeyFrame) Node(javafx.scene.Node) ColorAdjust(javafx.scene.effect.ColorAdjust) Timeline(javafx.animation.Timeline) Inject(javax.inject.Inject) ActionEvent(javafx.event.ActionEvent) Duration(javafx.util.Duration) FadeTransition(javafx.animation.FadeTransition) Interpolator(javafx.animation.Interpolator) Preferences(bisq.core.user.Preferences) UserThread(bisq.common.UserThread) KeyValue(javafx.animation.KeyValue) GaussianBlur(javafx.scene.effect.GaussianBlur) Pane(javafx.scene.layout.Pane) Timeline(javafx.animation.Timeline) KeyValue(javafx.animation.KeyValue) GaussianBlur(javafx.scene.effect.GaussianBlur) KeyFrame(javafx.animation.KeyFrame) ColorAdjust(javafx.scene.effect.ColorAdjust) Pane(javafx.scene.layout.Pane)

Example 4 with ColorAdjust

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);
    }
}
Also used : ColorAdjust(javafx.scene.effect.ColorAdjust)

Example 5 with ColorAdjust

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);
        }
    });
}
Also used : Effect(javafx.scene.effect.Effect) ColorAdjust(javafx.scene.effect.ColorAdjust) ImageView(javafx.scene.image.ImageView)

Aggregations

ColorAdjust (javafx.scene.effect.ColorAdjust)7 GaussianBlur (javafx.scene.effect.GaussianBlur)4 KeyFrame (javafx.animation.KeyFrame)2 KeyValue (javafx.animation.KeyValue)2 Timeline (javafx.animation.Timeline)2 ActionEvent (javafx.event.ActionEvent)2 EventHandler (javafx.event.EventHandler)2 Node (javafx.scene.Node)2 Pane (javafx.scene.layout.Pane)2 Duration (javafx.util.Duration)2 Inject (javax.inject.Inject)2 UserThread (bisq.common.UserThread)1 Preferences (bisq.core.user.Preferences)1 UserThread (io.bitsquare.common.UserThread)1 Preferences (io.bitsquare.user.Preferences)1 javafx.animation (javafx.animation)1 FadeTransition (javafx.animation.FadeTransition)1 Interpolator (javafx.animation.Interpolator)1 Effect (javafx.scene.effect.Effect)1 ImageView (javafx.scene.image.ImageView)1