Search in sources :

Example 11 with GaussianBlur

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

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 : Timeline(javafx.animation.Timeline) KeyValue(javafx.animation.KeyValue) GaussianBlur(javafx.scene.effect.GaussianBlur) KeyFrame(javafx.animation.KeyFrame) ColorAdjust(javafx.scene.effect.ColorAdjust)

Example 12 with GaussianBlur

use of javafx.scene.effect.GaussianBlur in project OTP2_R6_svaap by JNuutinen.

the class Unit method drawShip.

/**
 * Asettaa Unitin aluksen visuaalisia piirteitä.
 * Käyttää Plarform.runLater kuvion asettamiseksi.
 * @param shape Aluksen Shape-olio.
 */
void drawShip(Shape shape) {
    this.shape = shape;
    this.shape.setEffect(new GaussianBlur(2.0));
    this.shape.setFill(Color.BLACK);
    this.shape.setStrokeWidth(5.0);
    Platform.runLater(() -> getChildren().add(this.shape));
    this.shape.setStroke(color);
}
Also used : GaussianBlur(javafx.scene.effect.GaussianBlur)

Example 13 with GaussianBlur

use of javafx.scene.effect.GaussianBlur in project OTP2_R6_svaap by JNuutinen.

the class LaserGun method buildChargingEffect.

/**
 * Rakentaa latausefektin.
 * @param color Efektin väri.
 * @return Tehty efekti.
 */
private Circle buildChargingEffect(Color color) {
    // Ammuksen muoto
    chargingEffect = new Circle();
    chargingEffect.setRadius(1);
    Bloom bloom = new Bloom(0.0);
    GaussianBlur blur = new GaussianBlur(6);
    blur.setInput(bloom);
    chargingEffect.setEffect(blur);
    chargingEffect.setFill(Color.WHITE);
    chargingEffect.setStroke(color);
    chargingEffect.setStrokeWidth(1);
    return chargingEffect;
}
Also used : Circle(javafx.scene.shape.Circle) GaussianBlur(javafx.scene.effect.GaussianBlur) Bloom(javafx.scene.effect.Bloom)

Example 14 with GaussianBlur

use of javafx.scene.effect.GaussianBlur in project OTP2_R6_svaap by JNuutinen.

the class SmallProjectile method buildProjectile.

/**
 * Rakentaa projectilen Polygonin
 * @param speed Projectilen nopeus, vaikuttaa hännän pituuteen
 * @param color Projectilen väri
 * @return Rakennettu Polygon
 */
private Polygon buildProjectile(double speed, Color color) {
    // Ammuksen muoto
    Polygon shape = new Polygon();
    shape.getPoints().addAll(-7.0, 2.5, -7.0, -2.5, 0.0, -6.0, // ammuksen hanta skaalautuu nopeuden mukaan, mutta on ainakin 7.0
    speed * 0.4 + 7.0, // ammuksen hanta skaalautuu nopeuden mukaan, mutta on ainakin 7.0
    0.0, 0.0, 6.0);
    Bloom bloom = new Bloom(0.0);
    GaussianBlur blur = new GaussianBlur(1.0);
    blur.setInput(bloom);
    // shape.setEffect(blur);
    shape.setFill(Color.WHITE);
    shape.setStroke(color);
    shape.setStrokeWidth(3.0);
    shape.getTransforms().add(new Rotate(180, 0, 0));
    return shape;
}
Also used : Rotate(javafx.scene.transform.Rotate) GaussianBlur(javafx.scene.effect.GaussianBlur) Bloom(javafx.scene.effect.Bloom) Polygon(javafx.scene.shape.Polygon)

Aggregations

GaussianBlur (javafx.scene.effect.GaussianBlur)14 Bloom (javafx.scene.effect.Bloom)5 ColorAdjust (javafx.scene.effect.ColorAdjust)4 ActionEvent (javafx.event.ActionEvent)3 Polygon (javafx.scene.shape.Polygon)3 Rotate (javafx.scene.transform.Rotate)3 Duration (javafx.util.Duration)3 FadeTransition (javafx.animation.FadeTransition)2 KeyFrame (javafx.animation.KeyFrame)2 KeyValue (javafx.animation.KeyValue)2 Timeline (javafx.animation.Timeline)2 EventHandler (javafx.event.EventHandler)2 Node (javafx.scene.Node)2 Pane (javafx.scene.layout.Pane)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 Point (java.awt.Point)1