【问题标题】:How to do a "shine" effect in CSS (see the picture below) on a button in JavaFX?如何在 JavaFX 中的按钮上使用 CSS(见下图)制作“闪耀”效果?
【发布时间】:2018-09-17 22:18:27
【问题描述】:

这是我尝试过的css:

.button {
  -fx-background-radius: 4;
  -fx-effect: dropshadow(gaussian, rgba(0, 0, 0, 0.7), 10, 0, 0, 1);
  -fx-background-insets: 0, 1;
  -fx-padding: 5 20 5 20;
}
<div class="button">Nouvea</div>

这是我想要的效果:

【问题讨论】:

  • This 过去几年对我很有帮助。

标签: css button javafx


【解决方案1】:

试试这个css:

#shinyButton{
    -fx-background-color: 
        #ECECEC,
        linear-gradient(#ECECEC 50%, #D5D5D5 100%),
        radial-gradient(center 50% -40%, radius 200%, #ECECEC 45%, #D5D5D5 50%);
    -fx-background-radius: 10;
    -fx-background-insets: 0,1,1;
    -fx-text-fill: black;
    -fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 3, 0.0 , 0 , 1 );
}

有关更多信息,请查看@Sedrick 在 cmets 中为您提供的链接。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-04
    • 2016-02-15
    • 1970-01-01
    相关资源
    最近更新 更多