本文整理汇总了Java中javafx.scene.shape.Arc.setCenterY方法的典型用法代码示例。如果您正苦于以下问题:Java Arc.setCenterY方法的具体用法?Java Arc.setCenterY怎么用?Java Arc.setCenterY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.shape.Arc
的用法示例。
在下文中一共展示了Arc.setCenterY方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeBody
import javafx.scene.shape.Arc; //导入方法依赖的package包/类
/**
* Generates the body arc of the arrow.
*
* @param startAngle the starting angle of the arc, in radians
* @param radius the radius of the arc
* @param length the length of the arc, in the same unit as {@code radius}
* @param xOffset how much to offset the arc along the X-axis
*/
private static Arc makeBody(double startAngle, double radius, double length, double xOffset) {
final double angRad = length / radius; // Isn't math nice?
final double angle = Math.toDegrees(angRad);
Arc arc = new Arc();
arc.setRadiusX(radius);
arc.setRadiusY(radius);
arc.setCenterX(xOffset);
arc.setCenterY(0);
arc.setStartAngle(Math.toDegrees(startAngle));
arc.setLength(-angle); // -angle because +y is "down", but JavaFX Arc treats +y as "up"
arc.setFill(null);
arc.setStroke(Color.WHITE);
return arc;
}
示例2: drawNode
import javafx.scene.shape.Arc; //导入方法依赖的package包/类
@Override
public Node drawNode() {
Arc arc = new Arc();
arc.setCenterX(DEFAULT_ARC_X);
arc.setCenterY(DEFAULT_ARC_Y);
arc.setRadiusX(DEFAULT_ARC_RADIUS_X);
arc.setRadiusY(DEFAULT_ARC_RADIUS_Y);
arc.setStartAngle(DEFAULT_ARC_START_ANGLE);
arc.setLength(DEFAULT_ARC_LENGTH);
arc.setType(ArcType.OPEN);
arc.setStrokeLineCap(StrokeLineCap.BUTT);
Pane slot = new Pane();
effect.setEffect(arc, slot);
return slot;
}
示例3: createArc
import javafx.scene.shape.Arc; //导入方法依赖的package包/类
/**
* Kreisausschnitt für Symbol.
*
* @param radius
* Radius des Kreisausschnitts.
* @param centerX
* x-Koordinate des Kreismittelpunkts.
* @param centerY
* y-Koordinate des Kreismittelpunkts.
* @return Kreisausschnitt als 2D Objekt
*/
private Arc createArc(final double radius, final double centerX, final double centerY) {
final Arc arc = new Arc();
arc.setCenterX(centerX);
arc.setCenterY(centerY);
arc.setRadiusX(radius);
arc.setRadiusY(radius);
arc.setStartAngle(START_ANGLE);
arc.setLength(ARC_LENGTH);
arc.setType(ArcType.OPEN);
arc.setStrokeWidth(STROKE_WIDTH);
arc.setStroke(Color.web(COLOR));
arc.setFill(Color.TRANSPARENT);
return arc;
}
示例4: drawTimeSections
import javafx.scene.shape.Arc; //导入方法依赖的package包/类
private void drawTimeSections() {
if (sectionMap.isEmpty()) return;
ZonedDateTime time = tile.getTime();
DayOfWeek day = time.getDayOfWeek();
boolean isAM = time.get(ChronoField.AMPM_OF_DAY) == 0;
double offset = 90;
double angleStep = 360.0 / 60.0;
boolean highlightSections = tile.isHighlightSections();
for (TimeSection section : sectionMap.keySet()) {
LocalTime start = section.getStart();
LocalTime stop = section.getStop();
boolean isStartAM = start.get(ChronoField.AMPM_OF_DAY) == 0;
boolean isStopAM = stop.get(ChronoField.AMPM_OF_DAY) == 0;
boolean draw = isAM ? (isStartAM || isStopAM) : (!isStartAM || !isStopAM);
if (!section.getDays().contains(day)) { draw = false; }
if (!section.isActive()) { draw = false; }
if (draw) {
double sectionStartAngle = (start.getHour() % 12 * 5.0 + start.getMinute() / 12.0 + start.getSecond() / 300.0) * angleStep + 180;
double sectionAngleExtend = ((stop.getHour() - start.getHour()) % 12 * 5.0 + (stop.getMinute() - start.getMinute()) / 12.0 + (stop.getSecond() - start.getSecond()) / 300.0) * angleStep;
if (start.getHour() > stop.getHour()) { sectionAngleExtend = (360.0 - Math.abs(sectionAngleExtend)); }
Arc arc = sectionMap.get(section);
arc.setCenterX(clockSize * 0.5);
arc.setCenterY(clockSize * 0.5);
arc.setRadiusX(clockSize * 0.45);
arc.setRadiusY(clockSize * 0.45);
arc.setStartAngle(-(offset + sectionStartAngle));
arc.setLength(-sectionAngleExtend);
arc.setType(ArcType.OPEN);
arc.setStrokeWidth(clockSize * 0.04);
arc.setStrokeLineCap(StrokeLineCap.BUTT);
arc.setFill(null);
if (highlightSections) {
arc.setStroke(section.contains(time.toLocalTime()) ? section.getHighlightColor() : section.getColor());
} else {
arc.setStroke(section.getColor());
}
}
}
}
示例5: LoadingArc
import javafx.scene.shape.Arc; //导入方法依赖的package包/类
public LoadingArc() {
Arc arc = new Arc();
arc.setCenterX(25);
arc.setCenterY(25);
arc.setRadiusX(25.0f);
arc.setRadiusY(25.0f);
arc.setLength(30.0f);
arc.setStrokeWidth(5);
Stop[] stops = new Stop[] { new Stop(0, Color.WHITE), new Stop(1, Color.BLUE)};
LinearGradient lg1 = new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, stops);
arc.setStroke(lg1);
Rectangle rect = new Rectangle(50, 50);
rect.setFill(null);
rect.setStroke(Color.RED);
getChildren().addAll(rect, arc);
double time = 0.75;
Rotate r = new Rotate(0, 25, 25);
arc.getTransforms().add(r);
//arc.getTransforms().add(new Scale(-1, 1, 25, 25));
Timeline timeline = new Timeline();
KeyFrame kf2 = new KeyFrame(Duration.seconds(time), new KeyValue(r.angleProperty(), 270));
timeline.getKeyFrames().addAll(kf2);
Timeline timeline3 = new Timeline(new KeyFrame(Duration.seconds(time), new KeyValue(r.angleProperty(), 360)));
SequentialTransition st = new SequentialTransition(timeline, timeline3);
st.setCycleCount(Timeline.INDEFINITE);
st.setInterpolator(Interpolator.EASE_BOTH);
st.play();
//////////
Timeline timeline2 = new Timeline();
timeline2.setAutoReverse(true);
timeline2.setCycleCount(Timeline.INDEFINITE);
KeyFrame kf = new KeyFrame(Duration.seconds(time), new KeyValue(arc.lengthProperty(), 270, Interpolator.EASE_BOTH));
timeline2.getKeyFrames().add(kf);
timeline2.play();
}