下面列出了javafx.scene.shape.Line#endYProperty ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@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();
}
@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();
}
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())
)
);
}
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())
)
);
}