本文整理汇总了Java中javafx.scene.shape.QuadCurve类的典型用法代码示例。如果您正苦于以下问题:Java QuadCurve类的具体用法?Java QuadCurve怎么用?Java QuadCurve使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QuadCurve类属于javafx.scene.shape包,在下文中一共展示了QuadCurve类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createIconContent
import javafx.scene.shape.QuadCurve; //导入依赖的package包/类
public static Node createIconContent() {
QuadCurve quadCurve = new QuadCurve();
quadCurve.setStartX(0);
quadCurve.setStartY(50);
quadCurve.setControlX(20);
quadCurve.setControlY(0);
quadCurve.setEndX(80);
quadCurve.setEndY(50);
quadCurve.setStroke(Color.web("#b9c0c5"));
quadCurve.setStrokeWidth(5);
quadCurve.getStrokeDashArray().addAll(15d,15d);
quadCurve.setFill(null);
javafx.scene.effect.InnerShadow effect = new javafx.scene.effect.InnerShadow();
effect.setOffsetX(1);
effect.setOffsetY(1);
effect.setRadius(3);
effect.setColor(Color.rgb(0,0,0,0.6));
quadCurve.setEffect(effect);
return quadCurve;
}
示例2: convertQuadCurve
import javafx.scene.shape.QuadCurve; //导入依赖的package包/类
public static String convertQuadCurve(final QuadCurve QUAD_CURVE) {
final StringBuilder fxPath = new StringBuilder();
fxPath
.append("M ")
.append(QUAD_CURVE.getStartX())
.append(" ")
.append(QUAD_CURVE.getStartY())
.append(" ")
.append("Q ")
.append(QUAD_CURVE.getControlX())
.append(" ")
.append(QUAD_CURVE.getControlY())
.append(QUAD_CURVE.getEndX())
.append(" ")
.append(QUAD_CURVE.getEndY());
return fxPath.toString();
}
示例3: buildArc
import javafx.scene.shape.QuadCurve; //导入依赖的package包/类
private Node buildArc(Point2D point, Node n1, Node n2, boolean bigDestination, boolean bigSource) {
final int sourceRadius = bigSource ? BIG_RADIUS : SMALL_RADIUS;
final int destRadius = bigDestination ? BIG_RADIUS : SMALL_RADIUS;
final QuadCurve cubic = new QuadCurve();
cubic.startXProperty().bind(n1.layoutXProperty().add(destRadius));
cubic.startYProperty().bind(n1.layoutYProperty().add(destRadius));
cubic.endXProperty().bind(n2.layoutXProperty().add(sourceRadius));
cubic.endYProperty().bind(n2.layoutYProperty().add(sourceRadius));
cubic.setControlX(point.getX());
cubic.setControlY(0);
cubic.setFill(Color.TRANSPARENT);
cubic.setStrokeWidth(4);
cubic.setStroke(Color.WHITE);
// cubic.setEffect(getDropShadow());
cubic.setOpacity(0.0);
linkLayer.getChildren().add(cubic);
return cubic;
}
示例4: QuadCurveSample
import javafx.scene.shape.QuadCurve; //导入依赖的package包/类
public QuadCurveSample() {
super(180,90);
// Create quadCurve shape
QuadCurve quadCurve = new QuadCurve();
quadCurve.setStartX(0);
quadCurve.setStartY(45);
quadCurve.setControlX(50);
quadCurve.setControlY(10);
quadCurve.setEndX(180);
quadCurve.setEndY(45);
quadCurve.setStroke(Color.RED);
quadCurve.setFill(Color.ROSYBROWN);
quadCurve.setStrokeWidth(2d);
// show the quadCurve shape;
getChildren().add(quadCurve);
// REMOVE ME
setControls(
new SimplePropertySheet.PropDesc("Cubic Curve Fill", quadCurve.fillProperty()),
new SimplePropertySheet.PropDesc("Cubic Curve Stroke", quadCurve.strokeProperty()),
new SimplePropertySheet.PropDesc("Cubic Curve Start X", quadCurve.startXProperty(), 0d, 170d),
new SimplePropertySheet.PropDesc("Cubic Curve Start Y", quadCurve.startYProperty(), 10d, 80d),
new SimplePropertySheet.PropDesc("Cubic Curve Control X1", quadCurve.controlXProperty(), 0d, 180d),
new SimplePropertySheet.PropDesc("Cubic Curve Control Y1", quadCurve.controlYProperty(), 0d, 90d),
new SimplePropertySheet.PropDesc("Cubic Curve End X", quadCurve.endXProperty(), 10d, 180d),
new SimplePropertySheet.PropDesc("Cubic Curve End Y", quadCurve.endYProperty(), 10d, 80d)
);
// END REMOVE ME
}
示例5: initUI
import javafx.scene.shape.QuadCurve; //导入依赖的package包/类
@Override
protected void initUI() {
Text text = getUIFactory().newText("Level 1", Color.WHITE, 48);
getGameScene().addUINode(text);
QuadCurve curve = new QuadCurve(-100, 0, getWidth() / 2, getHeight(), getWidth() + 100, 0);
PathTransition transition = new PathTransition(Duration.seconds(4), curve, text);
transition.setOnFinished(e -> {
getGameScene().removeUINode(text);
getBallControl().release();
});
transition.play();
}
示例6: init
import javafx.scene.shape.QuadCurve; //导入依赖的package包/类
@Override
public void init() {
double t = 0;
for (int y = 0; y < ENEMY_ROWS; y++) {
for (int x = 0; x < ENEMIES_PER_ROW; x++) {
final int finalY = y;
FXGL.getMasterTimer().runOnceAfter(() -> {
Entity enemy = spawnEnemy(50, 50 + finalY*50);
QuadCurve path = new QuadCurve(50, 50 + finalY*50, 250, 200 + finalY * 20, Config.WIDTH - 50 - 40, 50 + finalY*50);
Animation<?> anim = Entities.animationBuilder()
.autoReverse(true)
.interpolator(Interpolators.BACK.EASE_IN_OUT())
.duration(Duration.seconds(3))
.repeat(Integer.MAX_VALUE)
.translate(enemy)
.alongPath(path)
.buildAndPlay();
animations.add(anim);
}, Duration.seconds(t));
t += 0.3;
}
}
}
示例7: initGame
import javafx.scene.shape.QuadCurve; //导入依赖的package包/类
@Override
protected void initGame() {
player = Entities.builder()
.at(100, 100)
.viewFromNode(new Rectangle(40, 40))
.buildAndAttach(getGameWorld());
Animation<?> animation = Entities.animationBuilder()
.duration(Duration.seconds(1))
.repeat(1)
.rotate(player)
.rotateTo(360)
.build();
animation.setCycleCount(2);
animation.setAutoReverse(true);
animation.startInPlayState();
Entities.animationBuilder()
.duration(Duration.seconds(3))
.repeat(2)
.delay(Duration.millis(1002))
.interpolator(Interpolator.EASE_OUT)
.translate(player)
.alongPath(new QuadCurve(33, 33, 450, 544, 750, 4))
.buildAndPlay();
}
示例8: shapeToSvgString
import javafx.scene.shape.QuadCurve; //导入依赖的package包/类
public static String shapeToSvgString(final Shape SHAPE) {
final StringBuilder fxPath = new StringBuilder();
if (Line.class.equals(SHAPE.getClass())) {
fxPath.append(convertLine((Line) SHAPE));
} else if (Arc.class.equals(SHAPE.getClass())) {
fxPath.append(convertArc((Arc) SHAPE));
} else if (QuadCurve.class.equals(SHAPE.getClass())) {
fxPath.append(convertQuadCurve((QuadCurve) SHAPE));
} else if (CubicCurve.class.equals(SHAPE.getClass())) {
fxPath.append(convertCubicCurve((CubicCurve) SHAPE));
} else if (Rectangle.class.equals(SHAPE.getClass())) {
fxPath.append(convertRectangle((Rectangle) SHAPE));
} else if (Circle.class.equals(SHAPE.getClass())) {
fxPath.append(convertCircle((Circle) SHAPE));
} else if (Ellipse.class.equals(SHAPE.getClass())) {
fxPath.append(convertEllipse((Ellipse) SHAPE));
} else if (Text.class.equals(SHAPE.getClass())) {
Path path = (Path)(Shape.subtract(SHAPE, new Rectangle(0, 0)));
fxPath.append(convertPath(path));
} else if (Path.class.equals(SHAPE.getClass())) {
fxPath.append(convertPath((Path) SHAPE));
} else if (Polygon.class.equals(SHAPE.getClass())) {
fxPath.append(convertPolygon((Polygon) SHAPE));
} else if (Polyline.class.equals(SHAPE.getClass())) {
fxPath.append(convertPolyline((Polyline) SHAPE));
} else if (SVGPath.class.equals(SHAPE.getClass())) {
fxPath.append(((SVGPath) SHAPE).getContent());
}
return fxPath.toString();
}
示例9: convertQuadCurve
import javafx.scene.shape.QuadCurve; //导入依赖的package包/类
public static String convertQuadCurve(final QuadCurve QUAD_CURVE) {
final StringBuilder fxPath = new StringBuilder();
fxPath.append("M ").append(QUAD_CURVE.getStartX()).append(" ").append(QUAD_CURVE.getStartY()).append(" ")
.append("Q ").append(QUAD_CURVE.getControlX()).append(" ").append(QUAD_CURVE.getControlY())
.append(QUAD_CURVE.getEndX()).append(" ").append(QUAD_CURVE.getEndY());
return fxPath.toString();
}
示例10: testGetQuadCurveAdjuster
import javafx.scene.shape.QuadCurve; //导入依赖的package包/类
@Test
public void testGetQuadCurveAdjuster() {
Adjuster adjuster = Adjuster.getAdjuster(QuadCurve.class);
assertThat(adjuster, is(instanceOf(QuadCurveAdjuster.class)));
assertThat(adjuster.getNodeClass(), is(sameInstance(QuadCurve.class)));
}
示例11: getLine
import javafx.scene.shape.QuadCurve; //导入依赖的package包/类
@Override
public QuadCurve getLine() {
return line;
}
示例12: getNodeClass
import javafx.scene.shape.QuadCurve; //导入依赖的package包/类
@Override
public Class<? extends Node> getNodeClass() {
return QuadCurve.class;
}
示例13: getLine
import javafx.scene.shape.QuadCurve; //导入依赖的package包/类
QuadCurve getLine();