Guest User

Untitled

a guest
Jun 22nd, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. import javafx.application.Application;
  2. import javafx.scene.Scene;
  3. import javafx.scene.layout.Pane;
  4. import javafx.scene.paint.Color;
  5. import javafx.scene.paint.CycleMethod;
  6. import javafx.scene.paint.RadialGradient;
  7. import javafx.scene.paint.Stop;
  8. import javafx.scene.shape.Circle;
  9. import javafx.stage.Stage;
  10.  
  11. public class MaskTest extends Application {
  12.  
  13. public static void main(String[] args) {
  14. Application.launch(args);
  15. }
  16.  
  17. public void start(Stage stage) {
  18. Pane layout = new Pane();
  19. Circle red = new Circle();
  20. red.setCenterX(200);
  21. red.setCenterY(200);
  22. red.setRadius(50);
  23. red.setFill(Color.RED);
  24. layout.getChildren().addAll(red);
  25.  
  26. Circle mask = new Circle();
  27. mask.setCenterX(200);
  28. mask.setCenterY(200);
  29. mask.setRadius(50);
  30. mask.setFill(new RadialGradient(0, .1, 200, 200, 20, false, CycleMethod.NO_CYCLE, new Stop(0, Color.BLACK), new Stop(1, Color.TRANSPARENT)));
  31.  
  32. red.setClip(mask);
  33.  
  34. Scene scene = new Scene(layout);
  35. stage.setScene(scene);
  36. stage.show();
  37. }
  38. }
Add Comment
Please, Sign In to add comment