List of usage examples for javafx.scene.paint Color Color
public Color(@NamedArg("red") double red, @NamedArg("green") double green, @NamedArg("blue") double blue, @NamedArg(value = "opacity", defaultValue = "1") double opacity)
From source file:edu.kit.trufflehog.model.configdata.FilterDataModelTest.java
/** * <p>//from w w w. j a v a2 s . c o m * Randomly updates an existing FilterInput object. That means the color and the rules change, but the name * stays the same. * </p> * * @param filterInput The filterInput to update. * @return the updated filterInput object. */ private FilterInput updateFilterInput(FilterInput filterInput) { // Generate Rules List<String> rules = new ArrayList<>(); int limit = (int) (Math.random() * 100); for (int i = 0; i < limit; i++) { int ruleSize = (int) (Math.random() * 1000); rules.add(randomString(ruleSize)); } // Generate color; double color_r = Math.random(); double color_g = Math.random(); double color_b = Math.random(); double color_a = Math.random(); Color color = new Color(color_r, color_g, color_b, color_a); int priority = (int) (Math.random() * 1000); return new FilterInput(filterInput.getName(), SelectionModel.SELECTION, FilterType.MAC, rules, color, false, priority); }
From source file:com.github.vatbub.tictactoe.view.Main.java
private void showWinner(Board.WinnerInfo winnerInfo) { guiAnimationQueue.submitWaitForUnlock( () -> addWinLineOnWin(winnerInfo, new Color(1.0, 145.0 / 255.0, 30.0 / 255.0, 1.0), () -> { winnerText.setText(winnerInfo.winningPlayer.getName() + " won :)"); double endX = winningGirl.getX(); double endY = winningGirl.getY(); double confettiOffset = 30; double confettiX = confetti.getX(); double confettiY = confetti.getY(); AnchorPane.clearConstraints(winningGirl); winningGirl.setX(endX);//from www . j ava 2s. c o m winningGirl.setY(root.getHeight() + 140); blurGamePane(); winMessage.setOpacity(0); confetti.setOpacity(0); winPane.setOpacity(1); winPane.setVisible(true); winningGirl.setVisible(true); Timeline timeline = new Timeline(); double S4 = 1.45; double x0 = 0.33; KeyValue confettiKeyValue1x = new KeyValue(confetti.xProperty(), confettiX); KeyValue confettiKeyValue1y = new KeyValue(confetti.yProperty(), confettiY - confettiOffset); KeyValue confettiKeyValue1opacity = new KeyValue(confetti.opacityProperty(), 0); KeyFrame confettiKeyFrame1 = new KeyFrame(Duration.seconds(0), confettiKeyValue1x, confettiKeyValue1y, confettiKeyValue1opacity); KeyValue confettiKeyValue2x = new KeyValue(confetti.xProperty(), confettiX); KeyValue confettiKeyValue2y = new KeyValue(confetti.yProperty(), confettiY - confettiOffset); KeyValue confettiKeyValue2opacity = new KeyValue(confetti.opacityProperty(), 0); KeyFrame confettiKeyFrame2 = new KeyFrame(Duration.millis(500), confettiKeyValue2x, confettiKeyValue2y, confettiKeyValue2opacity); KeyValue confettiKeyValue3x = new KeyValue(confetti.xProperty(), confettiX, new CustomEaseOutInterpolator(S4, x0)); KeyValue confettiKeyValue3y = new KeyValue(confetti.yProperty(), confettiY, new CustomEaseOutInterpolator(S4, x0)); KeyValue confettiKeyValue3opacity = new KeyValue(confetti.opacityProperty(), 1); KeyFrame confettiKeyFrame3 = new KeyFrame(Duration.millis(1100), confettiKeyValue3x, confettiKeyValue3y, confettiKeyValue3opacity); KeyValue winningGirlKeyValue1x = new KeyValue(winningGirl.xProperty(), endX, new CustomEaseOutInterpolator(S4, x0)); KeyValue winningGirlKeyValue1y = new KeyValue(winningGirl.yProperty(), endY, new CustomEaseOutInterpolator(S4, x0)); KeyFrame winningGirlKeyFrame1 = new KeyFrame(Duration.seconds(1), winningGirlKeyValue1x, winningGirlKeyValue1y); timeline.getKeyFrames().addAll(winningGirlKeyFrame1, confettiKeyFrame1, confettiKeyFrame2, confettiKeyFrame3); timeline.setOnFinished((event) -> fadeNode(winMessage, 1, () -> { AnchorPane.setRightAnchor(winningGirl, 0.0); AnchorPane.setBottomAnchor(winningGirl, 0.0); })); timeline.play(); })); }