- java.lang.Object
-
- javafx.scene.effect.Light
-
- javafx.scene.effect.Light.Point
-
- javafx.scene.effect.Light.Spot
-
- Enclosing class:
- Light
public static class Light.Spot extends Light.Point
在3D空间中的给定位置表示点光源,具有可配置的方向和焦点。例:
Light.Spot light = new Light.Spot(); light.setX(150); light.setY(100); light.setZ(80); light.setPointsAtX(0); light.setPointsAtY(0); light.setPointsAtZ(-50); light.setSpecularExponent(2); Lighting lighting = new Lighting(); lighting.setLight(light); lighting.setSurfaceScale(5.0); Text text = new Text(); text.setText("Spot"); text.setFill(Color.STEELBLUE); text.setFont(Font.font(null, FontWeight.BOLD, 80)); text.setX(10.0); text.setY(10.0); text.setTextOrigin(VPos.TOP); text.setEffect(lighting); Rectangle rect = new Rectangle(200, 150); rect.setFill(Color.ALICEBLUE); rect.setEffect(lighting);以上代码产生以下内容:

- 从以下版本开始:
- JavaFX 2.0
-
-
Property Summary
Properties Type Property 描述 DoublePropertypointsAtX该光的方向矢量的x坐标。DoublePropertypointsAtY该光的方向矢量的y坐标。DoublePropertypointsAtZ该光的方向矢量的z坐标。DoublePropertyspecularExponent镜面指数,控制这个光源的焦点。-
Properties inherited from class javafx.scene.effect.Light.Point
x, y, z
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javafx.scene.effect.Light
Light.Distant, Light.Point, Light.Spot
-
-
方法摘要
所有方法 接口方法 具体的方法 Modifier and Type 方法 描述 doublegetPointsAtX()获取属性pointsAtX的值。doublegetPointsAtY()获取属性点的值。doublegetPointsAtZ()获取属性点AtZ的值。doublegetSpecularExponent()获取属性specularExponent的值。DoublePropertypointsAtXProperty()该光的方向矢量的x坐标。DoublePropertypointsAtYProperty()该光的方向矢量的y坐标。DoublePropertypointsAtZProperty()该光的方向矢量的z坐标。voidsetPointsAtX(double value)设置属性pointsAtX的值。voidsetPointsAtY(double value)设置属性点的值。voidsetPointsAtZ(double value)设置属性点AtZ的值。voidsetSpecularExponent(double value)设置属性specularExponent的值。DoublePropertyspecularExponentProperty()镜面指数,控制这个光源的焦点。-
Methods inherited from class javafx.scene.effect.Light
colorProperty, getColor, setColor
-
-
-
-
Property Detail
-
pointsAtX
public final DoubleProperty pointsAtXProperty
该光的方向矢量的x坐标。Min: n/a Max: n/a Default: 0.0 Identity: n/a- Default value:
- 0.0
- 另请参见:
-
getPointsAtX(),setPointsAtX(double)
-
pointsAtY
public final DoubleProperty pointsAtYProperty
该光的方向矢量的y坐标。Min: n/a Max: n/a Default: 0.0 Identity: n/a- Default value:
- 0.0
- 另请参见:
-
getPointsAtY(),setPointsAtY(double)
-
pointsAtZ
public final DoubleProperty pointsAtZProperty
该光的方向矢量的z坐标。Min: n/a Max: n/a Default: 0.0 Identity: n/a- Default value:
- 0.0
- 另请参见:
-
getPointsAtZ(),setPointsAtZ(double)
-
specularExponent
public final DoubleProperty specularExponentProperty
镜面指数,控制这个光源的焦点。Min: 0.0 Max: 4.0 Default: 1.0 Identity: 1.0- Default value:
- 1.0
- 另请参见:
-
getSpecularExponent(),setSpecularExponent(double)
-
-
构造方法详细信息
-
Spot
public Spot()
使用默认参数创建一个新的Spotlight实例。
-
Spot
public Spot(double x, double y, double z, double specularExponent, Color color)使用指定的x,y,z,specularExponent和color创建一个新的Spotlight实例。- 参数
-
x- 光位置的x坐标 -
y- 光位置的y坐标 -
z- 光位置的z坐标 -
specularExponent- 镜面指数,用于控制光源的焦点 -
color- 光的颜色 - 从以下版本开始:
- JavaFX 2.1
-
-
方法详细信息
-
setPointsAtX
public final void setPointsAtX(double value)
设置属性pointsAtX的值。- Property description:
-
该光的方向矢量的x坐标。
Min: n/a Max: n/a Default: 0.0 Identity: n/a - Default value:
- 0.0
-
getPointsAtX
public final double getPointsAtX()
获取属性pointsAtX的值。- Property description:
-
该光的方向矢量的x坐标。
Min: n/a Max: n/a Default: 0.0 Identity: n/a - Default value:
- 0.0
-
pointsAtXProperty
public final DoubleProperty pointsAtXProperty()
该光的方向矢量的x坐标。Min: n/a Max: n/a Default: 0.0 Identity: n/a- Default value:
- 0.0
- 另请参见:
-
getPointsAtX(),setPointsAtX(double)
-
setPointsAtY
public final void setPointsAtY(double value)
设置属性点的值。- Property description:
-
该光的方向矢量的y坐标。
Min: n/a Max: n/a Default: 0.0 Identity: n/a - Default value:
- 0.0
-
getPointsAtY
public final double getPointsAtY()
获取属性点的值。- Property description:
-
该光的方向矢量的y坐标。
Min: n/a Max: n/a Default: 0.0 Identity: n/a - Default value:
- 0.0
-
pointsAtYProperty
public final DoubleProperty pointsAtYProperty()
该光的方向矢量的y坐标。Min: n/a Max: n/a Default: 0.0 Identity: n/a- Default value:
- 0.0
- 另请参见:
-
getPointsAtY(),setPointsAtY(double)
-
setPointsAtZ
public final void setPointsAtZ(double value)
设置属性点AtZ的值。- Property description:
-
该光的方向矢量的z坐标。
Min: n/a Max: n/a Default: 0.0 Identity: n/a - Default value:
- 0.0
-
getPointsAtZ
public final double getPointsAtZ()
获取属性点AtZ的值。- Property description:
-
该光的方向矢量的z坐标。
Min: n/a Max: n/a Default: 0.0 Identity: n/a - Default value:
- 0.0
-
pointsAtZProperty
public final DoubleProperty pointsAtZProperty()
该光的方向矢量的z坐标。Min: n/a Max: n/a Default: 0.0 Identity: n/a- Default value:
- 0.0
- 另请参见:
-
getPointsAtZ(),setPointsAtZ(double)
-
setSpecularExponent
public final void setSpecularExponent(double value)
设置属性specularExponent的值。- Property description:
-
镜面指数,控制这个光源的焦点。
Min: 0.0 Max: 4.0 Default: 1.0 Identity: 1.0 - Default value:
- 1.0
-
getSpecularExponent
public final double getSpecularExponent()
获取属性specularExponent的值。- Property description:
-
镜面指数,控制这个光源的焦点。
Min: 0.0 Max: 4.0 Default: 1.0 Identity: 1.0 - Default value:
- 1.0
-
specularExponentProperty
public final DoubleProperty specularExponentProperty()
镜面指数,控制这个光源的焦点。Min: 0.0 Max: 4.0 Default: 1.0 Identity: 1.0- Default value:
- 1.0
- 另请参见:
-
getSpecularExponent(),setSpecularExponent(double)
-
-