Java Code Examples for javafx.scene.shape.Line#endYProperty()

The following examples show how to use javafx.scene.shape.Line#endYProperty() . 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: TicTacToeApp.java    From FXGLGames with MIT License 6 votes vote down vote up
@Override
protected void initUI() {
    Line line1 = new Line(getAppWidth() / 3, 0, getAppWidth() / 3, 0);
    Line line2 = new Line(getAppWidth() / 3 * 2, 0, getAppWidth() / 3 * 2, 0);
    Line line3 = new Line(0, getAppHeight() / 3, 0, getAppHeight() / 3);
    Line line4 = new Line(0, getAppHeight() / 3 * 2, 0, getAppHeight() / 3 * 2);

    getGameScene().addUINodes(line1, line2, line3, line4);

    // animation
    KeyFrame frame1 = new KeyFrame(Duration.seconds(0.5),
            new KeyValue(line1.endYProperty(), getAppHeight()));

    KeyFrame frame2 = new KeyFrame(Duration.seconds(1),
            new KeyValue(line2.endYProperty(), getAppHeight()));

    KeyFrame frame3 = new KeyFrame(Duration.seconds(0.5),
            new KeyValue(line3.endXProperty(), getAppWidth()));

    KeyFrame frame4 = new KeyFrame(Duration.seconds(1),
            new KeyValue(line4.endXProperty(), getAppWidth()));

    Timeline timeline = new Timeline(frame1, frame2, frame3, frame4);
    timeline.play();
}
 
Example 2
Source File: TicTacToeApp.java    From FXGLGames with MIT License 6 votes vote down vote up
@Override
protected void initUI() {
    Line line1 = new Line(getAppWidth() / 3, 0, getAppWidth() / 3, 0);
    Line line2 = new Line(getAppWidth() / 3 * 2, 0, getAppWidth() / 3 * 2, 0);
    Line line3 = new Line(0, getAppHeight() / 3, 0, getAppHeight() / 3);
    Line line4 = new Line(0, getAppHeight() / 3 * 2, 0, getAppHeight() / 3 * 2);

    getGameScene().addUINodes(line1, line2, line3, line4);

    // animation
    KeyFrame frame1 = new KeyFrame(Duration.seconds(0.5),
            new KeyValue(line1.endYProperty(), getAppHeight()));

    KeyFrame frame2 = new KeyFrame(Duration.seconds(1),
            new KeyValue(line2.endYProperty(), getAppHeight()));

    KeyFrame frame3 = new KeyFrame(Duration.seconds(0.5),
            new KeyValue(line3.endXProperty(), getAppWidth()));

    KeyFrame frame4 = new KeyFrame(Duration.seconds(1),
            new KeyValue(line4.endXProperty(), getAppWidth()));

    Timeline timeline = new Timeline(frame1, frame2, frame3, frame4);
    timeline.play();
}
 
Example 3
Source File: Callout.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
protected Animation buildBeginLeaderLineAnim(Line firstLeaderLine) {
    return new Timeline(
            new KeyFrame(Duration.millis(1),
                    new KeyValue(firstLeaderLine.visibleProperty(), true)), // show
            new KeyFrame(Duration.millis(300),
                    new KeyValue(firstLeaderLine.endXProperty(), getLeaderLineToPoint().getX()),
                    new KeyValue(firstLeaderLine.endYProperty(), getLeaderLineToPoint().getY())
            )
    );
}
 
Example 4
Source File: Callout.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
protected Animation buildEndLeaderLineAnim(Line endLeaderLine) {
    return new Timeline(
            new KeyFrame(Duration.millis(1),
                    new KeyValue(endLeaderLine.visibleProperty(), true)), // show
            new KeyFrame(Duration.millis(200),
                    new KeyValue(endLeaderLine.endXProperty(),
                            calcEndPointOfLeaderLine().getX()),
                    new KeyValue(endLeaderLine.endYProperty(), getLeaderLineToPoint().getY())
            )
    );
}