javafx.scene.effect.Glow Java Examples

The following examples show how to use javafx.scene.effect.Glow. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpriteView.java    From quantumjava with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void setGlow (boolean v) {
    if (v) {
        this.imageView.setEffect(new Glow(1));
    } else {
        this.imageView.setEffect(null);
    }
}
 
Example #2
Source File: DigitalClock.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public Clock(Color onColor, Color offColor) {
    // create effect for on LEDs
    Glow onEffect = new Glow(1.7f);
    onEffect.setInput(new InnerShadow());
    // create effect for on dot LEDs
    Glow onDotEffect = new Glow(1.7f);
    onDotEffect.setInput(new InnerShadow(5,Color.BLACK));
    // create effect for off LEDs
    InnerShadow offEffect = new InnerShadow();
    // create digits
    digits = new Digit[7];
    for (int i = 0; i < 6; i++) {
        Digit digit = new Digit(onColor, offColor, onEffect, offEffect);
        digit.setLayoutX(i * 80 + ((i + 1) % 2) * 20);
        digits[i] = digit;
        getChildren().add(digit);
    }
    // create dots
    Group dots = new Group(
            new Circle(80 + 54 + 20, 44, 6, onColor),
            new Circle(80 + 54 + 17, 64, 6, onColor),
            new Circle((80 * 3) + 54 + 20, 44, 6, onColor),
            new Circle((80 * 3) + 54 + 17, 64, 6, onColor));
    dots.setEffect(onDotEffect);
    getChildren().add(dots);
    // update digits to current time and start timer to update every second
    refreshClocks();
}
 
Example #3
Source File: DigitalClock.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public Clock(Color onColor, Color offColor) {
    // create effect for on LEDs
    Glow onEffect = new Glow(1.7f);
    onEffect.setInput(new InnerShadow());
    // create effect for on dot LEDs
    Glow onDotEffect = new Glow(1.7f);
    onDotEffect.setInput(new InnerShadow(5,Color.BLACK));
    // create effect for off LEDs
    InnerShadow offEffect = new InnerShadow();
    // create digits
    digits = new Digit[7];
    for (int i = 0; i < 6; i++) {
        Digit digit = new Digit(onColor, offColor, onEffect, offEffect);
        digit.setLayoutX(i * 80 + ((i + 1) % 2) * 20);
        digits[i] = digit;
        getChildren().add(digit);
    }
    // create dots
    Group dots = new Group(
            new Circle(80 + 54 + 20, 44, 6, onColor),
            new Circle(80 + 54 + 17, 64, 6, onColor),
            new Circle((80 * 3) + 54 + 20, 44, 6, onColor),
            new Circle((80 * 3) + 54 + 17, 64, 6, onColor));
    dots.setEffect(onDotEffect);
    getChildren().add(dots);
    // update digits to current time and start timer to update every second
    refreshClocks();
}
 
Example #4
Source File: DigitalClock.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public Clock(Color onColor, Color offColor) {
    // create effect for on LEDs
    Glow onEffect = new Glow(1.7f);
    onEffect.setInput(new InnerShadow());
    // create effect for on dot LEDs
    Glow onDotEffect = new Glow(1.7f);
    onDotEffect.setInput(new InnerShadow(5,Color.BLACK));
    // create effect for off LEDs
    InnerShadow offEffect = new InnerShadow();
    // create digits
    digits = new Digit[7];
    for (int i = 0; i < 6; i++) {
        Digit digit = new Digit(onColor, offColor, onEffect, offEffect);
        digit.setLayoutX(i * 80 + ((i + 1) % 2) * 20);
        digits[i] = digit;
        getChildren().add(digit);
    }
    // create dots
    Group dots = new Group(
            new Circle(80 + 54 + 20, 44, 6, onColor),
            new Circle(80 + 54 + 17, 64, 6, onColor),
            new Circle((80 * 3) + 54 + 20, 44, 6, onColor),
            new Circle((80 * 3) + 54 + 17, 64, 6, onColor));
    dots.setEffect(onDotEffect);
    getChildren().add(dots);
    // update digits to current time and start timer to update every second
    refreshClocks();
    play();
}
 
Example #5
Source File: GameMenuDemo.java    From FXTutorials with MIT License 5 votes vote down vote up
public MenuButton(String name) {
    text = new Text(name);
    text.setFont(text.getFont().font(20));
    text.setFill(Color.WHITE);

    Rectangle bg = new Rectangle(250, 30);
    bg.setOpacity(0.6);
    bg.setFill(Color.BLACK);
    bg.setEffect(new GaussianBlur(3.5));

    setAlignment(Pos.CENTER_LEFT);
    setRotate(-0.5);
    getChildren().addAll(bg, text);

    setOnMouseEntered(event -> {
        bg.setTranslateX(10);
        text.setTranslateX(10);
        bg.setFill(Color.WHITE);
        text.setFill(Color.BLACK);
    });

    setOnMouseExited(event -> {
        bg.setTranslateX(0);
        text.setTranslateX(0);
        bg.setFill(Color.BLACK);
        text.setFill(Color.WHITE);
    });

    DropShadow drop = new DropShadow(50, Color.WHITE);
    drop.setInput(new Glow());

    setOnMousePressed(event -> setEffect(drop));
    setOnMouseReleased(event -> setEffect(null));
}
 
Example #6
Source File: OverView.java    From CrazyAlpha with GNU General Public License v2.0 4 votes vote down vote up
public OverView() {
    root = new Pane();
    Game.getInstance().resetMedia();

    GameMap map = Game.getInstance().getMapManager().getCurrentMap();
    ImageView mapIv = new ImageView(map.getMapImage());
    mapIv.setFitWidth(Game.getInstance().getWidth());
    mapIv.setFitHeight(Game.getInstance().getHeight());

    Label nameLbl = new Label("Game Over!");
    nameLbl.setTextFill(Color.WHITESMOKE);
    nameLbl.setFont(Game.getInstance().getResouceManager().getFont("Starcraft", 80));
    nameLbl.setLayoutX(50);
    nameLbl.setLayoutY(50);


    Label scoreLbl = new Label();
    scoreLbl.setTextFill(Color.WHITESMOKE);
    scoreLbl.setFont(Game.getInstance().getResouceManager().getFont("Starcraft", 60));
    scoreLbl.setLayoutX(50);
    scoreLbl.setLayoutY(map.getHeight() - scoreLbl.getHeight() - 140);
    if (Game.getInstance().getScore() > Game.getInstance().getDataManager().getHighestScore()) {
        // 刷新高分记录!
        scoreLbl.setText("New Record: " + Game.getInstance().getScore());
        Game.getInstance().getDataManager().setHighestScore(Game.getInstance().getScore());
    } else
        scoreLbl.setText("Score: " + Game.getInstance().getScore());

    Reflection reflection = new Reflection();
    reflection.setFraction(1.0);
    nameLbl.setEffect(reflection);

    ImageView homeBtn = new ImageView(Game.getInstance().getResouceManager().getControl("btn_home"));
    homeBtn.setFitWidth(165 * 1.5);
    homeBtn.setFitHeight(65 * 1.5);

    homeBtn.setLayoutX(map.getWidth() - homeBtn.getFitWidth() - 20);
    homeBtn.setLayoutY(map.getHeight() - homeBtn.getFitHeight() - 60);
    homeBtn.setEffect(reflection);
    homeBtn.setOnMouseEntered(event -> {
        homeBtn.setEffect(new Glow(0.8));
        Game.getInstance().getButtonOverMusic().play();
    });
    homeBtn.setOnMouseExited(event -> {
        homeBtn.setEffect(reflection);
        Game.getInstance().getButtonOverMusic().stop();
    });
    homeBtn.setOnMousePressed(event -> {
        homeBtn.setEffect(new GaussianBlur());
        Game.getInstance().getButtonClickMusic().play();
    });
    homeBtn.setOnMouseReleased(event -> {
        homeBtn.setEffect(new Glow(0.8));
        Game.getInstance().home();
    });

    root.getChildren().add(mapIv);
    root.getChildren().add(nameLbl);
    root.getChildren().add(scoreLbl);
    root.getChildren().add(homeBtn);

    makeFadeTransition(homeBtn, 2000, 1, 0.7);
    makeFadeTransition(mapIv, 3000, 1, 0.8);
    makeScaleTransition(mapIv, 10000, 0.25, 0.25);
}
 
Example #7
Source File: PauseView.java    From CrazyAlpha with GNU General Public License v2.0 4 votes vote down vote up
public PauseView() {
    root = new Pane();
    Game.getInstance().resetMedia();

    map = Game.getInstance().getMapManager().getCurrentMap();
    mapIv = new ImageView(map.getMapImage());
    mapIv.setFitWidth(Game.getInstance().getWidth());
    mapIv.setFitHeight(Game.getInstance().getHeight());

    nameLbl = new Label("CrazyAlpha!");
    nameLbl.setTextFill(Color.WHITESMOKE);
    nameLbl.setFont(Game.getInstance().getResouceManager().getFont("Starcraft", 120));
    nameLbl.setLayoutX(50);
    nameLbl.setLayoutY(50);

    Reflection reflection1 = new Reflection();
    reflection1.setFraction(1.0);
    nameLbl.setEffect(reflection1);

    Reflection reflection02 = new Reflection();
    reflection02.setFraction(0.4);

    resumeBtn = new ImageView(Game.getInstance().getResouceManager().getControl("btn_resume"));
    resumeBtn.setFitWidth(165 * 1.5);
    resumeBtn.setFitHeight(65 * 1.5);
    exitBtn = new ImageView(Game.getInstance().getResouceManager().getControl("btn_exit"));
    exitBtn.setFitWidth(165 * 1.5);
    exitBtn.setFitHeight(65 * 1.5);

    resumeBtn.setLayoutX(map.getWidth() - resumeBtn.getFitWidth() - 20);
    resumeBtn.setLayoutY(map.getHeight() - resumeBtn.getFitHeight() - exitBtn.getFitHeight() - 120);
    resumeBtn.setEffect(reflection02);
    resumeBtn.setOnMouseEntered(event -> {
        resumeBtn.setEffect(new Glow(0.8));
        Game.getInstance().getButtonOverMusic().play();
    });
    resumeBtn.setOnMouseExited(event -> {
        resumeBtn.setEffect(reflection02);
        Game.getInstance().getButtonClickMusic().stop();
    });
    resumeBtn.setOnMousePressed(event -> {
        resumeBtn.setEffect(new GaussianBlur());
        Game.getInstance().getButtonClickMusic().play();
        Game.getInstance().resume();
    });
    resumeBtn.setOnMouseReleased(event -> {
        resumeBtn.setEffect(new Glow(0.8));
    });

    exitBtn.setLayoutX(map.getWidth() - exitBtn.getFitWidth() - 20);
    exitBtn.setLayoutY(map.getHeight() - exitBtn.getFitHeight() - 60);
    exitBtn.setEffect(reflection02);
    exitBtn.setOnMouseEntered(event -> {
        exitBtn.setEffect(new Glow(0.8));
        Game.getInstance().getButtonOverMusic().play();
    });
    exitBtn.setOnMouseExited(event -> {
        exitBtn.setEffect(reflection02);
        Game.getInstance().getButtonOverMusic().stop();
    });
    exitBtn.setOnMousePressed(event -> {
        exitBtn.setEffect(new GaussianBlur());
        Game.getInstance().getButtonClickMusic().play();
    });
    exitBtn.setOnMouseReleased(event -> {
        exitBtn.setEffect(new Glow(0.8));
        Game.getInstance().exit();
    });


    root.getChildren().add(mapIv);
    root.getChildren().add(nameLbl);
    root.getChildren().add(resumeBtn);
    root.getChildren().add(exitBtn);

    makeFadeTransition(resumeBtn, 2000, 1, 0.7);
    makeFadeTransition(exitBtn, 2000, 1, 0.7);
    makeFadeTransition(mapIv, 3000, 1, 0.8);
    makeScaleTransition(mapIv, 10000, 0.25, 0.25);
}