本文整理汇总了Java中javafx.scene.paint.CycleMethod类的典型用法代码示例。如果您正苦于以下问题:Java CycleMethod类的具体用法?Java CycleMethod怎么用?Java CycleMethod使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CycleMethod类属于javafx.scene.paint包,在下文中一共展示了CycleMethod类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: RadialGradientSample
import javafx.scene.paint.CycleMethod; //导入依赖的package包/类
public RadialGradientSample() {
//create simple radial gradient
RadialGradient gradient1 = new RadialGradient(0, 0, 0.5, 0.5, 1, true, CycleMethod.NO_CYCLE, new Stop[] {
new Stop(0, Color.DODGERBLUE),
new Stop(1, Color.BLACK)
});
Circle circle1 = new Circle(45, 45, 40, gradient1);
//create complex radial gradient
RadialGradient gradient2 = new RadialGradient(20, 1, 0.5, 0.5, 0.6, true, CycleMethod.NO_CYCLE, new Stop[] {
new Stop(0, Color.TRANSPARENT),
new Stop(0.5, Color.DARKGRAY),
new Stop(0.64, Color.WHITESMOKE),
new Stop(0.65, Color.YELLOW),
new Stop(1, Color.GOLD)
});
Circle circle2 = new Circle(145, 45, 40, gradient2);
HBox hb = new HBox(10);
hb.getChildren().addAll(circle1, circle2);
// show the circles
getChildren().addAll(hb);
}
示例2: draw
import javafx.scene.paint.CycleMethod; //导入依赖的package包/类
private void draw(final int LIMIT, final double RESOLUTION) {
int limit = LIMIT > points.size() ? points.size() : LIMIT + 1;
double pixelSize = 2 * RESOLUTION;
ctx.clearRect(0, 0, width, height);
for (double y = 0 ; y < height ; y += RESOLUTION) {
for (double x = 0 ; x < width ; x += RESOLUTION) {
double value = getValueAt(limit, x, y);
if (value != -255) {
Color color = getUseColorMapping() ? getColorForValue(value) : getColorForValue(value, isDiscreteColors());
RadialGradient gradient = new RadialGradient(0, 0, x, y, RESOLUTION,
false, CycleMethod.NO_CYCLE,
new Stop(0, Color.color(color.getRed(), color.getGreen(), color.getBlue(), getHeatMapOpacity())),
new Stop(1, Color.color(color.getRed(), color.getGreen(), color.getBlue(), 0.0)));
ctx.setFill(gradient);
ctx.fillOval(x - RESOLUTION, y - RESOLUTION, pixelSize, pixelSize);
}
}
}
}
示例3: initBackground
import javafx.scene.paint.CycleMethod; //导入依赖的package包/类
private void initBackground() {
Rectangle bg0 = new Rectangle(getWidth(), getHeight(),
new LinearGradient(getWidth() / 2, 0, getWidth() / 2, getHeight(),
false, CycleMethod.NO_CYCLE,
new Stop(0.2, Color.AQUA), new Stop(0.8, Color.BLACK)));
Rectangle bg1 = new Rectangle(getWidth(), getHeight(), Color.color(0, 0, 0, 0.2));
bg1.setBlendMode(BlendMode.DARKEN);
EntityView bg = new EntityView(RenderLayer.BACKGROUND);
bg.addNode(bg0);
bg.addNode(bg1);
// we add IrremovableComponent because regardless of the level
// the background and screen bounds stay in the game world
Entities.builder()
.viewFromNode(bg)
.with(new IrremovableComponent())
.buildAndAttach(getGameWorld());
Entity screenBounds = Entities.makeScreenBounds(40);
screenBounds.addComponent(new IrremovableComponent());
getGameWorld().addEntity(screenBounds);
}
示例4: drawNode
import javafx.scene.paint.CycleMethod; //导入依赖的package包/类
@Override
public Node drawNode() {
Group group = new Group();
final Canvas canvas = new Canvas(120, 120);
GraphicsContext gc = canvas.getGraphicsContext2D();
group.getChildren().add(canvas);
gc.setFill(Color.GREEN);
gc.fillRect(10,10, 70, 70);
ColorInput effect = new ColorInput();
effect.setPaint(new LinearGradient(0, 0, 0.5f, 0.1f, true, CycleMethod.REPEAT, new Stop[] {
new Stop(0, Color.RED),
new Stop(1, Color.GREEN),
}));
effect.setX(15);
effect.setY(15);
effect.setWidth(70);
effect.setHeight(70);
gc.applyEffect(effect);
return group;
}
示例5: createNeedle
import javafx.scene.paint.CycleMethod; //导入依赖的package包/类
private void createNeedle() {
double needleWidth = size * 0.04;
double needleHeight = size * 0.4675;
needle.getElements().clear();
needle.getElements().add(new MoveTo(0.3125 * needleWidth, 0.015957446808510637 * needleHeight));
needle.getElements().add(new CubicCurveTo(0.3125 * needleWidth, 0.005319148936170213 * needleHeight,
0.4375 * needleWidth, 0.0,
0.5 * needleWidth, 0.0));
needle.getElements().add(new CubicCurveTo(0.5625 * needleWidth, 0.0,
0.6875 * needleWidth, 0.005319148936170213 * needleHeight,
0.6875 * needleWidth, 0.015957446808510637 * needleHeight));
needle.getElements().add(new CubicCurveTo(0.6875 * needleWidth, 0.015957446808510637 * needleHeight,
needleWidth, 0.9946808510638298 * needleHeight,
needleWidth, 0.9946808510638298 * needleHeight));
needle.getElements().add(new LineTo(0.0, 0.9946808510638298 * needleHeight));
needle.getElements().add(new CubicCurveTo(0.0, 0.9946808510638298 * needleHeight,
0.3125 * needleWidth, 0.015957446808510637 * needleHeight,
0.3125 * needleWidth, 0.015957446808510637 * needleHeight));
needle.getElements().add(new ClosePath());
needle.setFill(new LinearGradient(needle.getLayoutBounds().getMinX(), 0,
needle.getLayoutBounds().getMaxX(), 0,
false, CycleMethod.NO_CYCLE,
new Stop(0.0, gauge.getNeedleColor().darker()),
new Stop(0.5, gauge.getNeedleColor()),
new Stop(1.0, gauge.getNeedleColor().darker())));
}
示例6: redraw
import javafx.scene.paint.CycleMethod; //导入依赖的package包/类
@Override protected void redraw() {
sectionsVisible = gauge.getSectionsVisible();
drawSections();
needle.setFill(new LinearGradient(needle.getLayoutBounds().getMinX(), 0,
needle.getLayoutBounds().getMaxX(), 0,
false, CycleMethod.NO_CYCLE,
new Stop(0.0, gauge.getNeedleColor().darker()),
new Stop(0.5, gauge.getNeedleColor()),
new Stop(1.0, gauge.getNeedleColor().darker())));
titleText.setFill(gauge.getTitleColor());
valueText.setFill(gauge.getValueColor());
mask.setFill(gauge.getBackgroundPaint());
knob.setFill(gauge.getKnobColor());
titleText.setText(gauge.getTitle());
resizeText();
}
示例7: handleMouseEvent
import javafx.scene.paint.CycleMethod; //导入依赖的package包/类
public void handleMouseEvent(final MouseEvent EVENT) {
if (gauge.isDisabled()) return;
final EventType TYPE = EVENT.getEventType();
if (MouseEvent.MOUSE_PRESSED.equals(TYPE)) {
gauge.fireEvent(gauge.BTN_PRESSED_EVENT);
centerKnob.setFill(new LinearGradient(0.5 * size, 0.2708333333333333 * size,
0.5 * size, 0.7291666666666666 * size,
false, CycleMethod.NO_CYCLE,
new Stop(0.0, Color.rgb(31, 31, 31)),
new Stop(1.0, Color.rgb(69, 70, 73))));
valueText.setTranslateY(size * 0.501);
subTitleText.setTranslateY(size * 0.3525);
unitText.setTranslateY(size * 0.6675);
} else if (MouseEvent.MOUSE_RELEASED.equals(TYPE)) {
gauge.fireEvent(gauge.BTN_RELEASED_EVENT);
centerKnob.setFill(new LinearGradient(0.5 * size, 0.2708333333333333 * size,
0.5 * size, 0.7291666666666666 * size,
false, CycleMethod.NO_CYCLE,
new Stop(0.0, Color.rgb(69, 70, 73)),
new Stop(1.0, Color.rgb(31, 31, 31))));
valueText.setTranslateY(size * 0.5);
subTitleText.setTranslateY(size * 0.35);
unitText.setTranslateY(size * 0.67);
}
}
示例8: Player
import javafx.scene.paint.CycleMethod; //导入依赖的package包/类
/**
* Constructor without cards
* @param name the name of the player
* @param role the role of the player
*/
public Player(String name, Role role) {
this.name = name;
this.role = role;
color = role.roleToColor();
hand = new LinkedList<>();
handDeck = null;
pane = new Pane();
pane.setBackground(new Background(new BackgroundFill(new RadialGradient(0, 0, .5, .5, .8, true, CycleMethod.NO_CYCLE, new Stop(0, color.deriveColor(0,1,1,.25)), new Stop(1, color.deriveColor(0,1,.5,.25))), new CornerRadii(5), new Insets(0))));
Label description = new Label(role.roleToDescription());
description.setTextFill(role.roleToColor().brighter());
pane.getChildren().add(description);
nameLabel = new Label(name);
nameLabel.setTextFill(role.roleToColor().brighter());
nameLabel.setLayoutX(350);
nameLabel.setLayoutY(20);
pane.getChildren().add(nameLabel);
pawn = new Pawn(this);
}
示例9: createTopHighlightBorder
import javafx.scene.paint.CycleMethod; //导入依赖的package包/类
private void createTopHighlightBorder() {
Stop[] stops = new Stop[] {
new Stop(0, Color.WHITE),
new Stop(.3, Color.LIGHTGRAY),
new Stop(1, Color.TRANSPARENT)
};
LinearGradient lg1 = new LinearGradient(0, 0, 0, 1, true, CycleMethod.NO_CYCLE, stops);
topHighlightBorder =
new Border(new BorderStroke(
lg1, null, null, null,
BorderStrokeStyle.SOLID, BorderStrokeStyle.NONE, BorderStrokeStyle.NONE, BorderStrokeStyle.NONE,
CornerRadii.EMPTY,
new BorderWidths( 8.0d ),
null
));
}
示例10: Thermo
import javafx.scene.paint.CycleMethod; //导入依赖的package包/类
Thermo(Color color)
{
setFill(color);
fill.setArcHeight(6);
fill.setArcWidth(6);
fill.setManaged(false);
border.setFill(new LinearGradient(.3, 0, .7, 0, true, CycleMethod.NO_CYCLE,
new Stop(0, Color.LIGHTGRAY),
new Stop(.3, Color.WHITESMOKE),
new Stop(1, Color.LIGHTGRAY)));
border.setStroke(Color.BLACK);
arc.setLargeArcFlag(true);
rightcorner.setY(0);
getChildren().add(border);
getChildren().add(fill);
getChildren().add(ellipse);
setBorder(new Border(
new BorderStroke(Color.BLACK, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT)));
}
示例11: Thermo
import javafx.scene.paint.CycleMethod; //导入依赖的package包/类
Thermo(Color color)
{
setFill(color);
fill.setArcHeight(3);
fill.setArcWidth(3);
fill.setManaged(false);
border.setFill(new LinearGradient(.3, 0, .7, 0, true, CycleMethod.NO_CYCLE,
new Stop(0, Color.LIGHTGRAY),
new Stop(.3, Color.WHITESMOKE),
new Stop(1, Color.LIGHTGRAY)));
border.setStroke(Color.BLACK);
arc.setLargeArcFlag(true);
getChildren().add(border);
getChildren().add(fill);
getChildren().add(ellipse);
setBorder(new Border(
new BorderStroke(Color.BLACK, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT)));
}
示例12: createAlphaMaskedBall
import javafx.scene.paint.CycleMethod; //导入依赖的package包/类
/**
* Create an alpha masked ball with gradient colors from White to Black/Transparent. Used e. g. for particles.
* May only be visible when you have a background other than white, ie use black
*
* @param radius
* @return
*/
public static Node createAlphaMaskedBall( double radius) {
Circle ball = new Circle(radius);
RadialGradient gradient1 = new RadialGradient(0,
.1,
0,
0,
radius,
false,
CycleMethod.NO_CYCLE,
new Stop(0, Color.WHITE.deriveColor(1,1,1,1)),
new Stop(1, Color.BLACK.deriveColor(1,1,1,0)));
ball.setFill(gradient1);
return ball;
}
示例13: drawLeftImage
import javafx.scene.paint.CycleMethod; //导入依赖的package包/类
protected void drawLeftImage() {
AnchorPane pane = new AnchorPane();
pane.setPrefWidth(187);
Stop[] stops = new Stop[] { new Stop(0, Color.web("#3c79b2")), new Stop(1, Color.web("#2d5d8b")) };
RadialGradient gradient = new RadialGradient(0, 0, 0.5, 0.5, 1, true, CycleMethod.NO_CYCLE, stops);
Background background = new Background(new BackgroundFill(gradient, null, null));
pane.setBackground(background);
Text text = new Text(this.parent.getLeftImageText());
text.setFill(Color.WHITE);
text.setFont(Font.font("Maven Pro", 50));
text.setRotate(-90);
pane.setPadding(new Insets(-50));
pane.getChildren().add(text);
AnchorPane.setBottomAnchor(text, 160.0);
AnchorPane.setRightAnchor(text, -40.0);
getParent().getRoot().setLeft(pane);
}
示例14: Banner
import javafx.scene.paint.CycleMethod; //导入依赖的package包/类
public Banner(String message) {
Rectangle rectangle = RectangleBuilder
.create()
.x(0)
.y(0)
.width(W)
.height(H)
.fill(LinearGradientBuilder
.create()
.startX(0.0)
.startY(0.0)
.endX(10.0)
.endY(0.0)
.proportional(false)
.cycleMethod(CycleMethod.REFLECT)
.stops(StopBuilder.create().offset(0.0).color(Color.BLUE).build(),
StopBuilder.create().offset(1.0).color(Color.LIGHTBLUE).build()).build()).build();
Text text = TextBuilder.create().x(25).y(H / 16).text(message).fill(Color.YELLOW).font(Font.font(null, FontWeight.BOLD, 36))
.build();
getChildren().addAll(rectangle, text);
}
示例15: changeGradient2Color
import javafx.scene.paint.CycleMethod; //导入依赖的package包/类
private void changeGradient2Color(int index, Color color)
{
if (index == 0)
{
stopsInner[index] = new Stop (0, color);
} else if (index == 1)
{
stopsInner[index] = new Stop (.1, color);
} else if (index == 2)
{
stopsInner[index] = new Stop (.8, color);
} else if (index == 3)
{
stopsInner[index] = new Stop (1, color);
}
// reset the gradient containing the given color
lg2 = new LinearGradient (0, 0, 0, .5, true, CycleMethod.REFLECT,
stopsInner);
}