Search in sources :

Example 1 with BoxBlur

use of javafx.scene.effect.BoxBlur in project TestFX by TestFX.

the class BoundsQueryUtilsTest method setupShape.

private static void setupShape() {
    // nodeBounds()
    shape = new Rectangle(0, 0, SHAPE_WIDTH, 0);
    // nodeBoundsInLocal()
    shape.setClip(new Rectangle(0, 0, CLIP_WIDTH, 0));
    // nodeBoundsInParent()
    shape.getTransforms().add(new Translate(TRANSLATE_X, 0));
    // nodeBounds()
    Shape altShape = new Rectangle(0, 0, SHAPE_WIDTH, 0);
    altShape.setFill(Color.GREEN);
    altShape.setStroke(Color.BLACK);
    altShape.setStrokeType(StrokeType.OUTSIDE);
    // nodeBounds(), nodeBoundsInParent()
    altShape.setStrokeWidth(5);
    // nodeBoundsInLocal()
    altShape.setEffect(new BoxBlur(10, 10, 1));
}
Also used : Shape(javafx.scene.shape.Shape) Rectangle(javafx.scene.shape.Rectangle) Translate(javafx.scene.transform.Translate) BoxBlur(javafx.scene.effect.BoxBlur)

Example 2 with BoxBlur

use of javafx.scene.effect.BoxBlur in project JavaFXLibrary by eficode.

the class TestPointLocationController method initialize.

@Override
public void initialize(URL location, ResourceBundle resources) {
    locationLabel.setText("- | -");
    textTransition = new SequentialTransition();
    textTransition.getChildren().addAll(zoomIn(), zoomOut());
    blur = new BoxBlur(5.0, 5.0, 1);
}
Also used : BoxBlur(javafx.scene.effect.BoxBlur)

Example 3 with BoxBlur

use of javafx.scene.effect.BoxBlur in project JavaFXLibrary by eficode.

the class TestPointLocationController method mouseListener.

public void mouseListener(MouseEvent event) {
    int x = (int) event.getSceneX();
    int y = (int) event.getSceneY();
    locationLabel.setText(x + " | " + y);
    if (textTransition.getStatus() != Animation.Status.RUNNING)
        textTransition.play();
    locationLabel.setEffect(blur);
    blurAmount = 5.0;
    AnimationTimer timer = new AnimationTimer() {

        @Override
        public void handle(long now) {
            blurAmount -= 0.01;
            locationLabel.setEffect(new BoxBlur(blurAmount, blurAmount, 1));
            if (blurAmount <= 0.0) {
                stop();
            }
        }
    };
    timer.start();
}
Also used : BoxBlur(javafx.scene.effect.BoxBlur)

Example 4 with BoxBlur

use of javafx.scene.effect.BoxBlur in project FXGL by AlmasB.

the class ParticleDigitsSample method initParticles.

private void initParticles() {
    // blur particle pane to smooth out edges
    var particlePane = new Pane();
    particlePane.setEffect(new BoxBlur(2, 2, 3));
    addUINode(particlePane);
    int max = 0;
    for (char c : DIGITS_STRING.toCharArray()) {
        // shape of each digit
        var text = getUIFactoryService().newText(c + "", Color.WHITE, 256);
        var digitPixels = toPixels(toImage(text)).stream().filter(p -> !p.getColor().equals(Color.TRANSPARENT)).collect(Collectors.toList());
        max = Math.max(max, digitPixels.size());
        digits.add(new ParticleDigit(digitPixels));
    }
    for (int i = 0; i < max; i++) {
        // shape of each particle
        var particle = new Circle(3, 3, 3, Color.WHITE);
        particles.add(particle);
        particlePane.getChildren().add(particle);
    }
}
Also used : Color(javafx.scene.paint.Color) CubicCurve(javafx.scene.shape.CubicCurve) Pixel(com.almasb.fxgl.texture.Pixel) IntegerProperty(javafx.beans.property.IntegerProperty) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) ImagesKt.toPixels(com.almasb.fxgl.texture.ImagesKt.toPixels) Duration(javafx.util.Duration) List(java.util.List) BoxBlur(javafx.scene.effect.BoxBlur) Interpolators(com.almasb.fxgl.animation.Interpolators) SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty) GameSettings(com.almasb.fxgl.app.GameSettings) Point2D(javafx.geometry.Point2D) ImagesKt.toImage(com.almasb.fxgl.texture.ImagesKt.toImage) Circle(javafx.scene.shape.Circle) Comparator(java.util.Comparator) GameApplication(com.almasb.fxgl.app.GameApplication) Shape(javafx.scene.shape.Shape) FXGL(com.almasb.fxgl.dsl.FXGL) Pane(javafx.scene.layout.Pane) Circle(javafx.scene.shape.Circle) Pane(javafx.scene.layout.Pane) BoxBlur(javafx.scene.effect.BoxBlur)

Example 5 with BoxBlur

use of javafx.scene.effect.BoxBlur in project jgnash by ccavanaugh.

the class BusyPane method getImageView.

private ImageView getImageView() {
    ImageView imageView = new ImageView();
    imageView.setFocusTraversable(false);
    imageView.setEffect(new BoxBlur(4, 4, 2));
    imageView.setImage(getScene().getRoot().snapshot(null, null));
    return imageView;
}
Also used : ImageView(javafx.scene.image.ImageView) BoxBlur(javafx.scene.effect.BoxBlur)

Aggregations

BoxBlur (javafx.scene.effect.BoxBlur)5 Shape (javafx.scene.shape.Shape)2 Interpolators (com.almasb.fxgl.animation.Interpolators)1 GameApplication (com.almasb.fxgl.app.GameApplication)1 GameSettings (com.almasb.fxgl.app.GameSettings)1 FXGL (com.almasb.fxgl.dsl.FXGL)1 ImagesKt.toImage (com.almasb.fxgl.texture.ImagesKt.toImage)1 ImagesKt.toPixels (com.almasb.fxgl.texture.ImagesKt.toPixels)1 Pixel (com.almasb.fxgl.texture.Pixel)1 ArrayList (java.util.ArrayList)1 Comparator (java.util.Comparator)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 IntegerProperty (javafx.beans.property.IntegerProperty)1 SimpleIntegerProperty (javafx.beans.property.SimpleIntegerProperty)1 Point2D (javafx.geometry.Point2D)1 ImageView (javafx.scene.image.ImageView)1 Pane (javafx.scene.layout.Pane)1 Color (javafx.scene.paint.Color)1 Circle (javafx.scene.shape.Circle)1