javafx.scene.effect.Light Java Examples

The following examples show how to use javafx.scene.effect.Light. 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: StopWatchSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private void configureEffect() {
    handEffect.setOffsetX(radius / 40);
    handEffect.setOffsetY(radius / 40);
    handEffect.setRadius(6);
    handEffect.setColor(Color.web("#000000"));

    Lighting lighting = new Lighting();
    Light.Distant light = new Light.Distant();
    light.setAzimuth(225);
    lighting.setLight(light);
    handEffect.setInput(lighting);

    handEffectGroup.setEffect(handEffect);
}
 
Example #2
Source File: StopWatchSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private void configureEffect() {
    handEffect.setOffsetX(radius / 40);
    handEffect.setOffsetY(radius / 40);
    handEffect.setRadius(6);
    handEffect.setColor(Color.web("#000000"));

    Lighting lighting = new Lighting();
    Light.Distant light = new Light.Distant();
    light.setAzimuth(225);
    lighting.setLight(light);
    handEffect.setInput(lighting);

    handEffectGroup.setEffect(handEffect);
}
 
Example #3
Source File: StopWatch.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void configureEffect() {
    handEffect.setOffsetX(radius / 40);
    handEffect.setOffsetY(radius / 40);
    handEffect.setRadius(6);
    handEffect.setColor(Color.web("#000000"));

    Lighting lighting = new Lighting();
    Light.Distant light = new Light.Distant();
    light.setAzimuth(225);
    lighting.setLight(light);
    handEffect.setInput(lighting);

    handEffectGroup.setEffect(handEffect);
}
 
Example #4
Source File: Connect4App.java    From FXTutorials with MIT License 5 votes vote down vote up
private Shape makeGrid() {
    Shape shape = new Rectangle((COLUMNS + 1) * TILE_SIZE, (ROWS + 1) * TILE_SIZE);

    for (int y = 0; y < ROWS; y++) {
        for (int x = 0; x < COLUMNS; x++) {
            Circle circle = new Circle(TILE_SIZE / 2);
            circle.setCenterX(TILE_SIZE / 2);
            circle.setCenterY(TILE_SIZE / 2);
            circle.setTranslateX(x * (TILE_SIZE + 5) + TILE_SIZE / 4);
            circle.setTranslateY(y * (TILE_SIZE + 5) + TILE_SIZE / 4);

            shape = Shape.subtract(shape, circle);
        }
    }

    Light.Distant light = new Light.Distant();
    light.setAzimuth(45.0);
    light.setElevation(30.0);

    Lighting lighting = new Lighting();
    lighting.setLight(light);
    lighting.setSurfaceScale(5.0);

    shape.setFill(Color.BLUE);
    shape.setEffect(lighting);

    return shape;
}
 
Example #5
Source File: AudioClipSample.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
public static Node createIconContent() {
    Group rectangleGroup = new Group();

    double xStart = 5.0;
    double xOffset = 30.0;
    double yPos = 230.0;
    double barWidth = 22.0;
    double barDepth = 7.0;

    Group base1Group = createRectangle(new Color(0.2, 0.12, 0.1, 1.0), 
                                       xStart + 135, yPos + 20.0, barWidth*11.5, 10.0);
    Group base2Group = createRectangle(new Color(0.2, 0.12, 0.1, 1.0), 
                                       xStart + 135, yPos - 20.0, barWidth*11.5, 10.0);
    Group bar1Group = createRectangle(Color.PURPLE, 
                                      xStart + 1*xOffset, yPos, barWidth, 100.0);
    Group bar2Group = createRectangle(Color.BLUEVIOLET,
                                      xStart + 2*xOffset, yPos, barWidth, 95.0);
    Group bar3Group = createRectangle(Color.BLUE,
                                      xStart + 3*xOffset, yPos, barWidth, 90.0);
    Group bar4Group = createRectangle(Color.GREEN,
                                      xStart + 4*xOffset, yPos, barWidth, 85.0);
    Group bar5Group = createRectangle(Color.GREENYELLOW,
                                      xStart + 5*xOffset, yPos, barWidth, 80.0);
    Group bar6Group = createRectangle(Color.YELLOW,
                                      xStart + 6*xOffset, yPos, barWidth, 75.0);
    Group bar7Group = createRectangle(Color.ORANGE,
                                      xStart + 7*xOffset, yPos, barWidth, 70.0);
    Group bar8Group = createRectangle(Color.RED,
                                      xStart + 8*xOffset, yPos, barWidth, 65.0);

    Light.Point light = new Light.Point();
    light.setX(-20);
    light.setY(-20);
    light.setZ(100);

    Lighting l = new Lighting();
    l.setLight(light);
    l.setSurfaceScale(1.0f);

    bar1Group.setEffect(l);
    bar2Group.setEffect(l);
    bar3Group.setEffect(l);
    bar4Group.setEffect(l);
    bar5Group.setEffect(l);
    bar6Group.setEffect(l);
    bar7Group.setEffect(l);
    bar8Group.setEffect(l);

    rectangleGroup.getChildren().add(base1Group);
    rectangleGroup.getChildren().add(base2Group);
    rectangleGroup.getChildren().add(bar1Group);
    rectangleGroup.getChildren().add(bar2Group);
    rectangleGroup.getChildren().add(bar3Group);
    rectangleGroup.getChildren().add(bar4Group);
    rectangleGroup.getChildren().add(bar5Group);
    rectangleGroup.getChildren().add(bar6Group);
    rectangleGroup.getChildren().add(bar7Group);
    rectangleGroup.getChildren().add(bar8Group);
    rectangleGroup.setScaleX(0.4);
    rectangleGroup.setScaleY(0.4);

    return rectangleGroup;
}
 
Example #6
Source File: AudioClipSample.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
public static Node createIconContent() {
    Group rectangleGroup = new Group();

    double xStart = 5.0;
    double xOffset = 30.0;
    double yPos = 230.0;
    double barWidth = 22.0;
    double barDepth = 7.0;

    Group base1Group = createRectangle(new Color(0.2, 0.12, 0.1, 1.0), 
                                       xStart + 135, yPos + 20.0, barWidth*11.5, 10.0);
    Group base2Group = createRectangle(new Color(0.2, 0.12, 0.1, 1.0), 
                                       xStart + 135, yPos - 20.0, barWidth*11.5, 10.0);
    Group bar1Group = createRectangle(Color.PURPLE, 
                                      xStart + 1*xOffset, yPos, barWidth, 100.0);
    Group bar2Group = createRectangle(Color.BLUEVIOLET,
                                      xStart + 2*xOffset, yPos, barWidth, 95.0);
    Group bar3Group = createRectangle(Color.BLUE,
                                      xStart + 3*xOffset, yPos, barWidth, 90.0);
    Group bar4Group = createRectangle(Color.GREEN,
                                      xStart + 4*xOffset, yPos, barWidth, 85.0);
    Group bar5Group = createRectangle(Color.GREENYELLOW,
                                      xStart + 5*xOffset, yPos, barWidth, 80.0);
    Group bar6Group = createRectangle(Color.YELLOW,
                                      xStart + 6*xOffset, yPos, barWidth, 75.0);
    Group bar7Group = createRectangle(Color.ORANGE,
                                      xStart + 7*xOffset, yPos, barWidth, 70.0);
    Group bar8Group = createRectangle(Color.RED,
                                      xStart + 8*xOffset, yPos, barWidth, 65.0);

    Light.Point light = new Light.Point();
    light.setX(-20);
    light.setY(-20);
    light.setZ(100);

    Lighting l = new Lighting();
    l.setLight(light);
    l.setSurfaceScale(1.0f);

    bar1Group.setEffect(l);
    bar2Group.setEffect(l);
    bar3Group.setEffect(l);
    bar4Group.setEffect(l);
    bar5Group.setEffect(l);
    bar6Group.setEffect(l);
    bar7Group.setEffect(l);
    bar8Group.setEffect(l);

    rectangleGroup.getChildren().add(base1Group);
    rectangleGroup.getChildren().add(base2Group);
    rectangleGroup.getChildren().add(bar1Group);
    rectangleGroup.getChildren().add(bar2Group);
    rectangleGroup.getChildren().add(bar3Group);
    rectangleGroup.getChildren().add(bar4Group);
    rectangleGroup.getChildren().add(bar5Group);
    rectangleGroup.getChildren().add(bar6Group);
    rectangleGroup.getChildren().add(bar7Group);
    rectangleGroup.getChildren().add(bar8Group);
    rectangleGroup.setScaleX(0.4);
    rectangleGroup.setScaleY(0.4);

    return rectangleGroup;
}