JavaFX CSS 参考指南中的文档是这样说的:
<effect>
JavaFX CSS 当前支持来自 JavaFX 平台的DropShadow
和效果。有关各种效果参数的语义的更多详细信息,InnerShadow
请参阅中的类文档。javafx.scene.effect
投影
在内容后面呈现给定内容的阴影的高级效果。
dropshadow( <blur-type> , <color> , <number> , <number> , <number> , <number> )
<blur-type>
=[ gaussian | one-pass-box | three-pass-box | two-pass-box ]
<color>
阴影颜色。
<number>
阴影模糊内核的半径。在范围内[0.0 ... 127.0]
,典型值10
。
<number>
阴影的蔓延。散布是源材料贡献的半径部分100%
。半径的剩余部分将具有由模糊内核控制的贡献。的扩散0.0
将导致完全由模糊算法确定的阴影分布。的扩展1.0
将导致源材料不透明度向外稳定增长到半径的极限,在半径处对透明度有一个非常尖锐的截止。值应在范围内[0.0 ... 1.0]
。
<number>
x 方向上的阴影偏移量,以像素为单位。
<number>
y 方向上的阴影偏移量,以像素为单位。
内心的阴影
A high-level effect that renders a shadow inside the edges of the given content.
innershadow( <blur-type> , <color> , <number> , <number> , <number> , <number> )
<blur-type>
= [ gaussian | one-pass-box | three-pass-box | two-pass-box ]
<color>
The shadow Color.
<number>
The radius of the shadow blur kernel. In the range [0.0 ... 127.0]
, typical value 10
.
<number>
The choke of the shadow. The choke is the portion of the radius where the contribution of the source material will be 100%
. The remaining portion of the radius will have a contribution controlled by the blur kernel. A choke of 0.0
will result in a distribution of the shadow determined entirely by the blur algorithm. A choke of 1.0
will result in a solid growth inward of the shadow from the edges to the limit of the radius with a very sharp cutoff to transparency inside the radius. Values should be in the range [0.0 ... 1.0]
.
<number>
The shadow offset in the x direction, in pixels.
<number>
The shadow offset in the y direction, in pixels.
From that, it appears you can't specify all 9 properties from CSS. In particular, you can't set the width
, height
, or input
from CSS. But if you look at the documentation of DropShadow.radius
or InnerShadow.radius
you'll see something like:
The radius of the shadow blur kernel. This attribute controls the distance that the shadow is spread to each side of the source pixels. Setting the radius is equivalent to setting both the width
and height
attributes to a value of (2 * radius + 1)
.
So if looks like setting the radius
also sets the width
and height
, you just can't give different values for the width
and height
via CSS.