Java 类javafx.scene.effect.Lighting 实例源码

项目:incubator-netbeans    文件:TimelineInterpolator.java   
private Circle createMovingCircle(Interpolator interpolator) {
    //create a transparent circle
    Circle circle = new Circle(45,45, 40,  Color.web("1c89f4"));
    circle.setOpacity(0);
    //add effect
    circle.setEffect(new Lighting());

    //create a timeline for moving the circle

    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //create a keyValue for horizontal translation of circle to the position 155px with given interpolator
    KeyValue keyValue = new KeyValue(circle.translateXProperty(), 155, interpolator);

    //create a keyFrame with duration 4s
    KeyFrame keyFrame = new KeyFrame(Duration.seconds(4), keyValue);

    //add the keyframe to the timeline
    timeline.getKeyFrames().add(keyFrame);

    return circle;
}
项目:marathonv5    文件:InterpolatorSample.java   
private Circle createMovingCircle(Interpolator interpolator, Color color){
    Circle circle = new Circle(25,25,35,color);
    circle.setOpacity(0.0);
    //add effect
    circle.setEffect(new Lighting());

    //create a timeline for moving the circle

    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //create a keyValue for horizontal translation of circle to the position 155px with given interpolator
    KeyValue keyValue = new KeyValue(circle.translateXProperty(), 155, interpolator);

    //create a keyFrame with duration 4s
    KeyFrame keyFrame = new KeyFrame(Duration.seconds(4), keyValue);

    //add the keyframe to the timeline
    timeline.getKeyFrames().add(keyFrame);

    return circle;
}
项目:marathonv5    文件:TimelineSample.java   
public TimelineSample() {
    super(280,120);

    //create a circle
    final Circle circle = new Circle(25,25, 20,  Color.web("1c89f4"));
    circle.setEffect(new Lighting());

    //create a timeline for moving the circle
    timeline = new Timeline();        
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //one can start/pause/stop/play animation by
    //timeline.play();
    //timeline.pause();
    //timeline.stop();
    //timeline.playFromStart();

    //add the following keyframes to the timeline
    timeline.getKeyFrames().addAll
        (new KeyFrame(Duration.ZERO,
                      new KeyValue(circle.translateXProperty(), 0)),
         new KeyFrame(new Duration(4000),
                      new KeyValue(circle.translateXProperty(), 205)));


    getChildren().add(createNavigation());
    getChildren().add(circle);
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Timeline rate", timeline.rateProperty(), -4d, 4d)
            //TODO it is possible to do it for integer?
    );
    // END REMOVE ME
}
项目:marathonv5    文件:InterpolatorSample.java   
private Circle createMovingCircle(Interpolator interpolator, Color color){
    Circle circle = new Circle(25,25,35,color);
    circle.setOpacity(0.0);
    //add effect
    circle.setEffect(new Lighting());

    //create a timeline for moving the circle

    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //create a keyValue for horizontal translation of circle to the position 155px with given interpolator
    KeyValue keyValue = new KeyValue(circle.translateXProperty(), 155, interpolator);

    //create a keyFrame with duration 4s
    KeyFrame keyFrame = new KeyFrame(Duration.seconds(4), keyValue);

    //add the keyframe to the timeline
    timeline.getKeyFrames().add(keyFrame);

    return circle;
}
项目:marathonv5    文件:TimelineSample.java   
public TimelineSample() {
    super(280,120);

    //create a circle
    final Circle circle = new Circle(25,25, 20,  Color.web("1c89f4"));
    circle.setEffect(new Lighting());

    //create a timeline for moving the circle
    timeline = new Timeline();        
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //one can start/pause/stop/play animation by
    //timeline.play();
    //timeline.pause();
    //timeline.stop();
    //timeline.playFromStart();

    //add the following keyframes to the timeline
    timeline.getKeyFrames().addAll
        (new KeyFrame(Duration.ZERO,
                      new KeyValue(circle.translateXProperty(), 0)),
         new KeyFrame(new Duration(4000),
                      new KeyValue(circle.translateXProperty(), 205)));


    getChildren().add(createNavigation());
    getChildren().add(circle);
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Timeline rate", timeline.rateProperty(), -4d, 4d)
            //TODO it is possible to do it for integer?
    );
    // END REMOVE ME
}
项目:openjfx-8u-dev-tests    文件:CanvasEffects2App.java   
List<NamedEffect> getNamedEffectList() {
    List<NamedEffect> nes = new ArrayList<NamedEffect>();
    nes.add(new NamedEffect("default", new Lighting()));
    nes.add(new NamedEffect("distant light", new Lighting() {{
        setLight(new Distant() {{ setAzimuth(90f); setElevation(50);}});}}));
    nes.add(new NamedEffect("point light", new Lighting() {{
        setLight(new Point() {{ setX(70);setY(120);setZ(10);}});}}));
    nes.add(new NamedEffect("spot light", new Lighting() {{
        setLight(new Spot() {{
            setX(70);setY(120);setZ(50);
            setPointsAtX(150);setPointsAtY(0);setPointsAtZ(0);
        }});}}));

    nes.add(new NamedEffect("diffuse: 0.5", new Lighting() {{ setDiffuseConstant(0.5f);}}));
    nes.add(new NamedEffect("specularC: 1.5", new Lighting() {{ setSpecularConstant(1.5f);}}));
    nes.add(new NamedEffect("specularExp: 35", new Lighting() {{ setSpecularExponent(35f);}}));
    nes.add(new NamedEffect("scale: 7", new Lighting() {{ setSurfaceScale(7f);}}));
    nes.add(new NamedEffect("bump input", new Lighting() {{ setBumpInput(new DropShadow());}}));
    nes.add(new NamedEffect("content input", new Lighting() {{ setContentInput(new DropShadow());}}));

    return nes;
}
项目:kotlinfx-ensemble    文件:InterpolatorSample.java   
private Circle createMovingCircle(Interpolator interpolator, Color color){
    Circle circle = new Circle(25,25,35,color);
    circle.setOpacity(0.0);
    //add effect
    circle.setEffect(new Lighting());

    //create a timeline for moving the circle

    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //create a keyValue for horizontal translation of circle to the position 155px with given interpolator
    KeyValue keyValue = new KeyValue(circle.translateXProperty(), 155, interpolator);

    //create a keyFrame with duration 4s
    KeyFrame keyFrame = new KeyFrame(Duration.seconds(4), keyValue);

    //add the keyframe to the timeline
    timeline.getKeyFrames().add(keyFrame);

    return circle;
}
项目:sevenwonders    文件:CardGroup.java   
public CardGroup() {
    hoverBox = new Group();
    hoverBox.setLayoutX(10);
    hoverBox.setLayoutY(0);
    text = new Text();
    text.setFont(GUIManager.font);
    text.setFill(Color.BLACK);
    text.setWrappingWidth(300);
    text.setLayoutY(34);
    text.setLayoutX(10);
    if (GUIManager.enableDropShadowEffect)
        text.setEffect(new DropShadow());
    bg = new Rectangle(300, 30, Color.GOLD);
    bg.setArcHeight(10);
    bg.setArcWidth(10);
    hoverBox.getChildren().add(bg);
    hoverBox.getChildren().add(text);
    if (GUIManager.enableLightingEffect)
        bg.setEffect(new Lighting());
    hoverBox.setOpacity(0);
    getChildren().add(hoverBox);
    deltaH = 20;
    if (!LocalMessages.getLocale().equals(new Locale("zh", "CN")))
        deltaH = 35;
    // hoverBox.setOpacity(0);
}
项目:incubator-netbeans    文件:TimelineEvents.java   
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setResizable(false);
    primaryStage.setScene(new Scene(root, 260,100));
    //create a circle with effect
    final Circle circle = new Circle(20,  Color.rgb(156,216,255));
    circle.setEffect(new Lighting());
    //create a text inside a circle
    final Text text = new Text (i.toString());
    text.setStroke(Color.BLACK);
    //create a layout for circle with text inside
    final StackPane stack = new StackPane();
    stack.getChildren().addAll(circle, text);
    stack.setLayoutX(30);
    stack.setLayoutY(30);

    //create a timeline for moving the circle

    timeline = new Timeline();
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //one can add a specific action when each frame is started. There are one or more frames during
    // executing one KeyFrame depending on set Interpolator.
    timer = new AnimationTimer() {
        @Override
        public void handle(long l) {
            text.setText(i.toString());
            i++;
        }

    };

    //create a keyValue with factory: scaling the circle 2times
    KeyValue keyValueX = new KeyValue(stack.scaleXProperty(), 2);
    KeyValue keyValueY = new KeyValue(stack.scaleYProperty(), 2);

    //create a keyFrame, the keyValue is reached at time 2s
    Duration duration = Duration.seconds(2);
    //one can add a specific action when the keyframe is reached
    EventHandler<ActionEvent> onFinished = new EventHandler<ActionEvent>() {
        public void handle(ActionEvent t) {
             stack.setTranslateX(java.lang.Math.random()*200);
             //reset counter
             i = 0;
        }
    };

    KeyFrame keyFrame = new KeyFrame(duration, onFinished , keyValueX, keyValueY);

    //add the keyframe to the timeline
    timeline.getKeyFrames().add(keyFrame);

    root.getChildren().add(stack);
}
项目:incubator-netbeans    文件:StopWatch.java   
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);
}
项目:incubator-netbeans    文件:StopWatch.java   
private Rectangle createBackground(Color stroke, Color fill) {
    Rectangle background = new Rectangle(14, 17, fill);
    background.setStroke(stroke);
    background.setStrokeWidth(2);
    background.setEffect(new Lighting());
    background.setCache(true);
    return background;
}
项目:marathonv5    文件:TimelineEventsSample.java   
public TimelineEventsSample() {
    super(70,70);
    //create a circle with effect
    final Circle circle = new Circle(20,  Color.rgb(156,216,255));
    circle.setEffect(new Lighting());
    //create a text inside a circle
    final Text text = new Text (i.toString());
    text.setStroke(Color.BLACK);
    //create a layout for circle with text inside
    final StackPane stack = new StackPane();
    stack.getChildren().addAll(circle, text);
    stack.setLayoutX(30);
    stack.setLayoutY(30);

    //create a timeline for moving the circle

    timeline = new Timeline();
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //one can add a specific action when each frame is started. There are one or more frames during
    // executing one KeyFrame depending on set Interpolator.
    timer = new AnimationTimer() {
        @Override
        public void handle(long l) {
            text.setText(i.toString());
            i++;
        }

    };

    //create a keyValue with factory: scaling the circle 2times
    KeyValue keyValueX = new KeyValue(stack.scaleXProperty(), 2);
    KeyValue keyValueY = new KeyValue(stack.scaleYProperty(), 2);

    //create a keyFrame, the keyValue is reached at time 2s
    Duration duration = Duration.seconds(2);
    //one can add a specific action when the keyframe is reached
    EventHandler<ActionEvent> onFinished = new EventHandler<ActionEvent>() {
        public void handle(ActionEvent t) {
             stack.setTranslateX(java.lang.Math.random()*200-100);
             //reset counter
             i = 0;
        }
    };

    KeyFrame keyFrame = new KeyFrame(duration, onFinished , keyValueX, keyValueY);

    //add the keyframe to the timeline
    timeline.getKeyFrames().add(keyFrame);

    getChildren().add(stack);
}
项目:marathonv5    文件:StopWatchSample.java   
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);
}
项目:marathonv5    文件:StopWatchSample.java   
private Rectangle createBackground(Color stroke, Color fill) {
    Rectangle background = new Rectangle(14, 17, fill);
    background.setStroke(stroke);
    background.setStrokeWidth(2);
    background.setEffect(new Lighting());
    background.setCache(true);
    return background;
}
项目:marathonv5    文件:StageSample.java   
public StageSample() {
    //create a button for initializing our new stage
    Button button = new Button("Create a Stage");
    button.setStyle("-fx-font-size: 24;");
    button.setDefaultButton(true);
    button.setOnAction(new EventHandler<ActionEvent>() {
        @Override public void handle(ActionEvent t) {
            final Stage stage = new Stage();
            //create root node of scene, i.e. group
            Group rootGroup = new Group();
            //create scene with set width, height and color
            Scene scene = new Scene(rootGroup, 200, 200, Color.WHITESMOKE);
            //set scene to stage
            stage.setScene(scene);
            //center stage on screen
            stage.centerOnScreen();
            //show the stage
            stage.show();
            //add some node to scene
            Text text = new Text(20, 110, "JavaFX");
            text.setFill(Color.DODGERBLUE);
            text.setEffect(new Lighting());
            text.setFont(Font.font(Font.getDefault().getFamily(), 50));
            //add text to the main root group
            rootGroup.getChildren().add(text);
        }
    });
    getChildren().add(button);
}
项目:marathonv5    文件:TimelineEventsSample.java   
public TimelineEventsSample() {
    super(70,70);
    //create a circle with effect
    final Circle circle = new Circle(20,  Color.rgb(156,216,255));
    circle.setEffect(new Lighting());
    //create a text inside a circle
    final Text text = new Text (i.toString());
    text.setStroke(Color.BLACK);
    //create a layout for circle with text inside
    final StackPane stack = new StackPane();
    stack.getChildren().addAll(circle, text);
    stack.setLayoutX(30);
    stack.setLayoutY(30);

    //create a timeline for moving the circle

    timeline = new Timeline();
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //one can add a specific action when each frame is started. There are one or more frames during
    // executing one KeyFrame depending on set Interpolator.
    timer = new AnimationTimer() {
        @Override
        public void handle(long l) {
            text.setText(i.toString());
            i++;
        }

    };

    //create a keyValue with factory: scaling the circle 2times
    KeyValue keyValueX = new KeyValue(stack.scaleXProperty(), 2);
    KeyValue keyValueY = new KeyValue(stack.scaleYProperty(), 2);

    //create a keyFrame, the keyValue is reached at time 2s
    Duration duration = Duration.seconds(2);
    //one can add a specific action when the keyframe is reached
    EventHandler<ActionEvent> onFinished = new EventHandler<ActionEvent>() {
        public void handle(ActionEvent t) {
             stack.setTranslateX(java.lang.Math.random()*200-100);
             //reset counter
             i = 0;
        }
    };

    KeyFrame keyFrame = new KeyFrame(duration, onFinished , keyValueX, keyValueY);

    //add the keyframe to the timeline
    timeline.getKeyFrames().add(keyFrame);

    getChildren().add(stack);
}
项目:marathonv5    文件:StopWatchSample.java   
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);
}
项目:marathonv5    文件:StopWatchSample.java   
private Rectangle createBackground(Color stroke, Color fill) {
    Rectangle background = new Rectangle(14, 17, fill);
    background.setStroke(stroke);
    background.setStrokeWidth(2);
    background.setEffect(new Lighting());
    background.setCache(true);
    return background;
}
项目:marathonv5    文件:StageSample.java   
public StageSample() {
    //create a button for initializing our new stage
    Button button = new Button("Create a Stage");
    button.setStyle("-fx-font-size: 24;");
    button.setDefaultButton(true);
    button.setOnAction(new EventHandler<ActionEvent>() {
        @Override public void handle(ActionEvent t) {
            final Stage stage = new Stage();
            //create root node of scene, i.e. group
            Group rootGroup = new Group();
            //create scene with set width, height and color
            Scene scene = new Scene(rootGroup, 200, 200, Color.WHITESMOKE);
            //set scene to stage
            stage.setScene(scene);
            //center stage on screen
            stage.centerOnScreen();
            //show the stage
            stage.show();
            //add some node to scene
            Text text = new Text(20, 110, "JavaFX");
            text.setFill(Color.DODGERBLUE);
            text.setEffect(new Lighting());
            text.setFont(Font.font(Font.getDefault().getFamily(), 50));
            //add text to the main root group
            rootGroup.getChildren().add(text);
        }
    });
    getChildren().add(button);
}
项目:Retrospector    文件:AchievementFX.java   
public static Text trophyize(String text, Integer tier, Double size) {
    Text node = new Text(text);
    node.setFill(tierColor(tier));
    node.setFont(Font.font(fa.getFamily(), size));
    Lighting l = new Lighting();
    l.setSurfaceScale(5.0f);
    node.setEffect(l);
    return node;
}
项目:FXGraphs    文件:Place.java   
private Circle createCenterDot(double centerX, double centerY, double radius) {
    Circle centerDot = new Circle(radius * 0.2, Color.BLACK);
    centerDot.setEffect(new Lighting());
    centerDot.setOpacity(0.8);
    centerDot.setLayoutX(centerX);
    centerDot.setLayoutY(centerY);
    return centerDot;
}
项目:FXGraphs    文件:Place.java   
private Circle createOuterCircle(double centerX, double centerY, double radius) {
    Circle outerCircle = new Circle(radius, Color.GRAY);
    outerCircle.setEffect(new Lighting());
    outerCircle.setStroke(Color.BLACK);
    outerCircle.setStrokeWidth(2);
    outerCircle.setStrokeType(StrokeType.OUTSIDE);
    outerCircle.setOpacity(0.4);
    outerCircle.setLayoutX(centerX);
    outerCircle.setLayoutY(centerY);
    setConnectionBounderyNode(outerCircle);
    return outerCircle;
}
项目:FXGraphs    文件:PlaceView.java   
public PlaceView(double centerX, double centerY, double radius) {

        Circle circle = new Circle(radius + 30, Color.GRAY);
        circle.setEffect(new Lighting());
        circle.setStroke(Color.BLACK);
        circle.setStrokeWidth(2);
        circle.setStrokeType(StrokeType.OUTSIDE);
        circle.setOpacity(0.4);
        circle.setLayoutX(centerX);
        circle.setLayoutY(centerY);

        Circle circle1 = new Circle(radius + 25, Color.WHITE);
        circle1.setLayoutX(centerX);
        circle1.setLayoutY(centerY);

        Circle circle2 = new Circle(radius - 20, Color.BLACK);
        circle2.setEffect(new Lighting());
        circle2.setOpacity(0.8);
        circle2.setLayoutX(centerX);
        circle2.setLayoutY(centerY);

        Circle anchor = new Circle(10, Color.BLACK);
        anchor.setLayoutX(centerX);
        anchor.setLayoutY(centerY);

        setAnchor(anchor);
        getChildren().add(circle);
        getChildren().add(circle1);
        getChildren().add(circle2);

    }
项目:FXTutorials    文件:Connect4App.java   
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;
}
项目:kotlinfx-ensemble    文件:TimelineSample.java   
public TimelineSample() {
    super(280,120);

    //create a circle
    final Circle circle = new Circle(25,25, 20,  Color.web("1c89f4"));
    circle.setEffect(new Lighting());

    //create a timeline for moving the circle
    timeline = new Timeline();        
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //one can start/pause/stop/play animation by
    //timeline.play();
    //timeline.pause();
    //timeline.stop();
    //timeline.playFromStart();

    //add the following keyframes to the timeline
    timeline.getKeyFrames().addAll
        (new KeyFrame(Duration.ZERO,
                      new KeyValue(circle.translateXProperty(), 0)),
         new KeyFrame(new Duration(4000),
                      new KeyValue(circle.translateXProperty(), 205)));


    getChildren().add(createNavigation());
    getChildren().add(circle);
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Timeline rate", timeline.rateProperty(), -4d, 4d)
            //TODO it is possible to do it for integer?
    );
    // END REMOVE ME
}
项目:kotlinfx-ensemble    文件:StopWatchSample.java   
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);
}
项目:kotlinfx-ensemble    文件:StopWatchSample.java   
private Rectangle createBackground(Color stroke, Color fill) {
    Rectangle background = new Rectangle(14, 17, fill);
    background.setStroke(stroke);
    background.setStrokeWidth(2);
    background.setEffect(new Lighting());
    background.setCache(true);
    return background;
}
项目:kotlinfx-ensemble    文件:StageSample.java   
public StageSample() {
    //create a button for initializing our new stage
    Button button = new Button("Create a Stage");
    button.setStyle("-fx-font-size: 24;");
    button.setDefaultButton(true);
    button.setOnAction(new EventHandler<ActionEvent>() {
        @Override public void handle(ActionEvent t) {
            final Stage stage = new Stage();
            //create root node of scene, i.e. group
            Group rootGroup = new Group();
            //create scene with set width, height and color
            Scene scene = new Scene(rootGroup, 200, 200, Color.WHITESMOKE);
            //set scene to stage
            stage.setScene(scene);
            //center stage on screen
            stage.centerOnScreen();
            //show the stage
            stage.show();
            //add some node to scene
            Text text = new Text(20, 110, "JavaFX");
            text.setFill(Color.DODGERBLUE);
            text.setEffect(new Lighting());
            text.setFont(Font.font(Font.getDefault().getFamily(), 50));
            //add text to the main root group
            rootGroup.getChildren().add(text);
        }
    });
    getChildren().add(button);
}
项目:marathonv5    文件:AudioClipSample.java   
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;
}
项目:marathonv5    文件:AudioClipSample.java   
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;
}
项目:javafx-demos    文件:TimelineEvents.java   
@Override public void start(Stage stage) {
        Group p = new Group();
        Scene scene = new Scene(p);
        stage.setScene(scene);
        stage.setWidth(500);
        stage.setHeight(500);
        p.setTranslateX(80);
        p.setTranslateY(80);

        //create a circle with effect
        final Circle circle = new Circle(20,  Color.rgb(156,216,255));
        circle.setEffect(new Lighting());
        //create a text inside a circle
        final Text text = new Text (i.toString());
        text.setStroke(Color.BLACK);
        //create a layout for circle with text inside
        final StackPane stack = new StackPane();
        stack.getChildren().addAll(circle, text);
        stack.setLayoutX(30);
        stack.setLayoutY(30);

        p.getChildren().add(stack);
        stage.show();

        //create a timeline for moving the circle
        timeline = new Timeline();
        timeline.setCycleCount(Timeline.INDEFINITE);
        timeline.setAutoReverse(true);

//You can add a specific action when each frame is started.
        timer = new AnimationTimer() {
            @Override
            public void handle(long l) {
                text.setText(i.toString());
                i++;
            }

        };

        //create a keyValue with factory: scaling the circle 2times
        KeyValue keyValueX = new KeyValue(stack.scaleXProperty(), 2);
        KeyValue keyValueY = new KeyValue(stack.scaleYProperty(), 2);

        //create a keyFrame, the keyValue is reached at time 2s
        Duration duration = Duration.valueOf("2000ms");
        //one can add a specific action when the keyframe is reached
        EventHandler onFinished = new EventHandler<ActionEvent>() {
            public void handle(ActionEvent t) {
                 stack.setTranslateX(java.lang.Math.random()*200-100);
                 //reset counter
                 i = 0;
            }
        };

  KeyFrame keyFrame = new KeyFrame(duration, onFinished , keyValueX, keyValueY);

        //add the keyframe to the timeline
        timeline.getKeyFrames().add(keyFrame);

        timeline.play();
        timer.start();
    }
项目:kotlinfx-ensemble    文件:TimelineEventsSample.java   
public TimelineEventsSample() {
    super(70,70);
    //create a circle with effect
    final Circle circle = new Circle(20,  Color.rgb(156,216,255));
    circle.setEffect(new Lighting());
    //create a text inside a circle
    final Text text = new Text (i.toString());
    text.setStroke(Color.BLACK);
    //create a layout for circle with text inside
    final StackPane stack = new StackPane();
    stack.getChildren().addAll(circle, text);
    stack.setLayoutX(30);
    stack.setLayoutY(30);

    //create a timeline for moving the circle

    timeline = new Timeline();
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //one can add a specific action when each frame is started. There are one or more frames during
    // executing one KeyFrame depending on set Interpolator.
    timer = new AnimationTimer() {
        @Override
        public void handle(long l) {
            text.setText(i.toString());
            i++;
        }

    };

    //create a keyValue with factory: scaling the circle 2times
    KeyValue keyValueX = new KeyValue(stack.scaleXProperty(), 2);
    KeyValue keyValueY = new KeyValue(stack.scaleYProperty(), 2);

    //create a keyFrame, the keyValue is reached at time 2s
    Duration duration = Duration.seconds(2);
    //one can add a specific action when the keyframe is reached
    EventHandler<ActionEvent> onFinished = new EventHandler<ActionEvent>() {
        public void handle(ActionEvent t) {
             stack.setTranslateX(java.lang.Math.random()*200-100);
             //reset counter
             i = 0;
        }
    };

    KeyFrame keyFrame = new KeyFrame(duration, onFinished , keyValueX, keyValueY);

    //add the keyframe to the timeline
    timeline.getKeyFrames().add(keyFrame);

    getChildren().add(stack);
}
项目:kotlinfx-ensemble    文件:AudioClipSample.java   
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;
}