javafx.scene.effect.Reflection Java Examples
The following examples show how to use
javafx.scene.effect.Reflection.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReflectionSample.java From marathonv5 with Apache License 2.0 | 6 votes |
public ReflectionSample() { super(100,200); ImageView sample = new ImageView(BOAT); sample.setPreserveRatio(true); sample.setFitHeight(100); final Reflection reflection = new Reflection(); sample.setEffect(reflection); getChildren().add(sample); // REMOVE ME setControls( new SimplePropertySheet.PropDesc("Reflection Bottom Opacity", reflection.bottomOpacityProperty(), 0d, 1d), new SimplePropertySheet.PropDesc("Reflection Top Opacity", reflection.topOpacityProperty(), 0d, 1d), new SimplePropertySheet.PropDesc("Reflection Fraction", reflection.fractionProperty(), 0d, 1d), new SimplePropertySheet.PropDesc("Reflection Top Offset", reflection.topOffsetProperty(), -10d, 10d) ); // END REMOVE ME }
Example #2
Source File: ReflectionSample.java From marathonv5 with Apache License 2.0 | 6 votes |
public ReflectionSample() { super(100,200); ImageView sample = new ImageView(BOAT); sample.setPreserveRatio(true); sample.setFitHeight(100); final Reflection reflection = new Reflection(); sample.setEffect(reflection); getChildren().add(sample); // REMOVE ME setControls( new SimplePropertySheet.PropDesc("Reflection Bottom Opacity", reflection.bottomOpacityProperty(), 0d, 1d), new SimplePropertySheet.PropDesc("Reflection Top Opacity", reflection.topOpacityProperty(), 0d, 1d), new SimplePropertySheet.PropDesc("Reflection Fraction", reflection.fractionProperty(), 0d, 1d), new SimplePropertySheet.PropDesc("Reflection Top Offset", reflection.topOffsetProperty(), -10d, 10d) ); // END REMOVE ME }
Example #3
Source File: FXInSwing.java From mars-sim with GNU General Public License v3.0 | 6 votes |
public FXInSwing(){ panel = new JFXPanel(); Platform.runLater(new Runnable(){ @Override public void run() { stack = new StackPane(); scene = new Scene(stack,300,300); hello = new Text("Hello"); scene.setFill(Color.BLACK); hello.setFill(Color.WHEAT); hello.setEffect(new Reflection()); panel.setScene(scene); stack.getChildren().add(hello); wait = false; } }); this.getContentPane().add(panel); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setSize(300, 300); this.setVisible(true); }
Example #4
Source File: ReflectionSample.java From marathonv5 with Apache License 2.0 | 5 votes |
public static Node createIconContent() { Text sample = new Text("FX"); sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,60)); sample.setStyle("-fx-font-size: 80px;"); sample.setFill(Color.web("#333333")); final Reflection reflection = new Reflection(); reflection.setTopOffset(-28d); reflection.setFraction(0.5); sample.setEffect(reflection); return sample; }
Example #5
Source File: ReflectionSample.java From marathonv5 with Apache License 2.0 | 5 votes |
public static Node createIconContent() { Text sample = new Text("FX"); sample.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD,60)); sample.setStyle("-fx-font-size: 80px;"); sample.setFill(Color.web("#333333")); final Reflection reflection = new Reflection(); reflection.setTopOffset(-28d); reflection.setFraction(0.5); sample.setEffect(reflection); return sample; }
Example #6
Source File: OverView.java From CrazyAlpha with GNU General Public License v2.0 | 4 votes |
public OverView() { root = new Pane(); Game.getInstance().resetMedia(); GameMap map = Game.getInstance().getMapManager().getCurrentMap(); ImageView mapIv = new ImageView(map.getMapImage()); mapIv.setFitWidth(Game.getInstance().getWidth()); mapIv.setFitHeight(Game.getInstance().getHeight()); Label nameLbl = new Label("Game Over!"); nameLbl.setTextFill(Color.WHITESMOKE); nameLbl.setFont(Game.getInstance().getResouceManager().getFont("Starcraft", 80)); nameLbl.setLayoutX(50); nameLbl.setLayoutY(50); Label scoreLbl = new Label(); scoreLbl.setTextFill(Color.WHITESMOKE); scoreLbl.setFont(Game.getInstance().getResouceManager().getFont("Starcraft", 60)); scoreLbl.setLayoutX(50); scoreLbl.setLayoutY(map.getHeight() - scoreLbl.getHeight() - 140); if (Game.getInstance().getScore() > Game.getInstance().getDataManager().getHighestScore()) { // 刷新高分记录! scoreLbl.setText("New Record: " + Game.getInstance().getScore()); Game.getInstance().getDataManager().setHighestScore(Game.getInstance().getScore()); } else scoreLbl.setText("Score: " + Game.getInstance().getScore()); Reflection reflection = new Reflection(); reflection.setFraction(1.0); nameLbl.setEffect(reflection); ImageView homeBtn = new ImageView(Game.getInstance().getResouceManager().getControl("btn_home")); homeBtn.setFitWidth(165 * 1.5); homeBtn.setFitHeight(65 * 1.5); homeBtn.setLayoutX(map.getWidth() - homeBtn.getFitWidth() - 20); homeBtn.setLayoutY(map.getHeight() - homeBtn.getFitHeight() - 60); homeBtn.setEffect(reflection); homeBtn.setOnMouseEntered(event -> { homeBtn.setEffect(new Glow(0.8)); Game.getInstance().getButtonOverMusic().play(); }); homeBtn.setOnMouseExited(event -> { homeBtn.setEffect(reflection); Game.getInstance().getButtonOverMusic().stop(); }); homeBtn.setOnMousePressed(event -> { homeBtn.setEffect(new GaussianBlur()); Game.getInstance().getButtonClickMusic().play(); }); homeBtn.setOnMouseReleased(event -> { homeBtn.setEffect(new Glow(0.8)); Game.getInstance().home(); }); root.getChildren().add(mapIv); root.getChildren().add(nameLbl); root.getChildren().add(scoreLbl); root.getChildren().add(homeBtn); makeFadeTransition(homeBtn, 2000, 1, 0.7); makeFadeTransition(mapIv, 3000, 1, 0.8); makeScaleTransition(mapIv, 10000, 0.25, 0.25); }
Example #7
Source File: PauseView.java From CrazyAlpha with GNU General Public License v2.0 | 4 votes |
public PauseView() { root = new Pane(); Game.getInstance().resetMedia(); map = Game.getInstance().getMapManager().getCurrentMap(); mapIv = new ImageView(map.getMapImage()); mapIv.setFitWidth(Game.getInstance().getWidth()); mapIv.setFitHeight(Game.getInstance().getHeight()); nameLbl = new Label("CrazyAlpha!"); nameLbl.setTextFill(Color.WHITESMOKE); nameLbl.setFont(Game.getInstance().getResouceManager().getFont("Starcraft", 120)); nameLbl.setLayoutX(50); nameLbl.setLayoutY(50); Reflection reflection1 = new Reflection(); reflection1.setFraction(1.0); nameLbl.setEffect(reflection1); Reflection reflection02 = new Reflection(); reflection02.setFraction(0.4); resumeBtn = new ImageView(Game.getInstance().getResouceManager().getControl("btn_resume")); resumeBtn.setFitWidth(165 * 1.5); resumeBtn.setFitHeight(65 * 1.5); exitBtn = new ImageView(Game.getInstance().getResouceManager().getControl("btn_exit")); exitBtn.setFitWidth(165 * 1.5); exitBtn.setFitHeight(65 * 1.5); resumeBtn.setLayoutX(map.getWidth() - resumeBtn.getFitWidth() - 20); resumeBtn.setLayoutY(map.getHeight() - resumeBtn.getFitHeight() - exitBtn.getFitHeight() - 120); resumeBtn.setEffect(reflection02); resumeBtn.setOnMouseEntered(event -> { resumeBtn.setEffect(new Glow(0.8)); Game.getInstance().getButtonOverMusic().play(); }); resumeBtn.setOnMouseExited(event -> { resumeBtn.setEffect(reflection02); Game.getInstance().getButtonClickMusic().stop(); }); resumeBtn.setOnMousePressed(event -> { resumeBtn.setEffect(new GaussianBlur()); Game.getInstance().getButtonClickMusic().play(); Game.getInstance().resume(); }); resumeBtn.setOnMouseReleased(event -> { resumeBtn.setEffect(new Glow(0.8)); }); exitBtn.setLayoutX(map.getWidth() - exitBtn.getFitWidth() - 20); exitBtn.setLayoutY(map.getHeight() - exitBtn.getFitHeight() - 60); exitBtn.setEffect(reflection02); exitBtn.setOnMouseEntered(event -> { exitBtn.setEffect(new Glow(0.8)); Game.getInstance().getButtonOverMusic().play(); }); exitBtn.setOnMouseExited(event -> { exitBtn.setEffect(reflection02); Game.getInstance().getButtonOverMusic().stop(); }); exitBtn.setOnMousePressed(event -> { exitBtn.setEffect(new GaussianBlur()); Game.getInstance().getButtonClickMusic().play(); }); exitBtn.setOnMouseReleased(event -> { exitBtn.setEffect(new Glow(0.8)); Game.getInstance().exit(); }); root.getChildren().add(mapIv); root.getChildren().add(nameLbl); root.getChildren().add(resumeBtn); root.getChildren().add(exitBtn); makeFadeTransition(resumeBtn, 2000, 1, 0.7); makeFadeTransition(exitBtn, 2000, 1, 0.7); makeFadeTransition(mapIv, 3000, 1, 0.8); makeScaleTransition(mapIv, 10000, 0.25, 0.25); }
Example #8
Source File: FireworksSample.java From marathonv5 with Apache License 2.0 | 4 votes |
public SanFranciscoFireworks() { // create a color palette of 180 colors colors = new Paint[181]; colors[0] = new RadialGradient(0, 0, 0.5, 0.5, 0.5, true, CycleMethod.NO_CYCLE, new Stop(0, Color.WHITE), new Stop(0.2, Color.hsb(59, 0.38, 1)), new Stop(0.6, Color.hsb(59, 0.38, 1,0.1)), new Stop(1, Color.hsb(59, 0.38, 1,0)) ); for (int h=0;h<360;h+=2) { colors[1+(h/2)] = new RadialGradient(0, 0, 0.5, 0.5, 0.5, true, CycleMethod.NO_CYCLE, new Stop(0, Color.WHITE), new Stop(0.2, Color.hsb(h, 1, 1)), new Stop(0.6, Color.hsb(h, 1, 1,0.1)), new Stop(1, Color.hsb(h, 1, 1,0)) ); } // create canvas canvas = new Canvas(1024, 500); canvas.setBlendMode(BlendMode.ADD); canvas.setEffect(new Reflection(0,0.4,0.15,0)); background = new ImageView(getClass().getResource("sf.jpg").toExternalForm()); getChildren().addAll(background,canvas); // create animation timer that will be called every frame // final AnimationTimer timer = new AnimationTimer() { timer = new AnimationTimer() { @Override public void handle(long now) { GraphicsContext gc = canvas.getGraphicsContext2D(); // clear area with transparent black gc.setFill(Color.rgb(0, 0, 0, 0.2)); gc.fillRect(0, 0, 1024, 708); // draw fireworks drawFireworks(gc); // countdown to launching the next firework if (countDownTillNextFirework == 0) { countDownTillNextFirework = 10 + (int)(Math.random()*30); fireParticle(); } countDownTillNextFirework --; } }; }
Example #9
Source File: FireworksSample.java From marathonv5 with Apache License 2.0 | 4 votes |
public SanFranciscoFireworks() { // create a color palette of 180 colors colors = new Paint[181]; colors[0] = new RadialGradient(0, 0, 0.5, 0.5, 0.5, true, CycleMethod.NO_CYCLE, new Stop(0, Color.WHITE), new Stop(0.2, Color.hsb(59, 0.38, 1)), new Stop(0.6, Color.hsb(59, 0.38, 1,0.1)), new Stop(1, Color.hsb(59, 0.38, 1,0)) ); for (int h=0;h<360;h+=2) { colors[1+(h/2)] = new RadialGradient(0, 0, 0.5, 0.5, 0.5, true, CycleMethod.NO_CYCLE, new Stop(0, Color.WHITE), new Stop(0.2, Color.hsb(h, 1, 1)), new Stop(0.6, Color.hsb(h, 1, 1,0.1)), new Stop(1, Color.hsb(h, 1, 1,0)) ); } // create canvas canvas = new Canvas(1024, 500); canvas.setBlendMode(BlendMode.ADD); canvas.setEffect(new Reflection(0,0.4,0.15,0)); background = new ImageView(getClass().getResource("sf.jpg").toExternalForm()); getChildren().addAll(background,canvas); // create animation timer that will be called every frame // final AnimationTimer timer = new AnimationTimer() { timer = new AnimationTimer() { @Override public void handle(long now) { GraphicsContext gc = canvas.getGraphicsContext2D(); // clear area with transparent black gc.setFill(Color.rgb(0, 0, 0, 0.2)); gc.fillRect(0, 0, 1024, 708); // draw fireworks drawFireworks(gc); // countdown to launching the next firework if (countDownTillNextFirework == 0) { countDownTillNextFirework = 10 + (int)(Math.random()*30); fireParticle(); } countDownTillNextFirework --; } }; }
Example #10
Source File: CreationMenuOnClickHandler.java From gef with Eclipse Public License 2.0 | 4 votes |
private static Reflection createDropShadowReflectionEffect(double effectRadius, Color color) { DropShadow dropShadow = new DropShadow(effectRadius, color); Reflection reflection = new Reflection(); reflection.setInput(dropShadow); return reflection; }