java.lang.Object
javafx.scene.effect.Light
javafx.scene.effect.Light.Point
javafx.scene.effect.Light.Spot
- Enclosing class:
Light
Represents a spot light source at a given position in 3D space, with
configurable direction and focus.
Example:
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);
The code above produces the following:
- Since:
- JavaFX 2.0
-
Property Summary
TypePropertyDescriptionfinal DoubleProperty
The x coordinate of the direction vector for this light.final DoubleProperty
The y coordinate of the direction vector for this light.final DoubleProperty
The z coordinate of the direction vector for this light.final DoubleProperty
The specular exponent, which controls the focus of this light source.Properties declared in class javafx.scene.effect.Light.Point
x, y, z
-
Nested Class Summary
Nested classes/interfaces declared in class javafx.scene.effect.Light
Light.Distant, Light.Point, Light.Spot
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal double
Gets the value of thepointsAtX
property.final double
Gets the value of thepointsAtY
property.final double
Gets the value of thepointsAtZ
property.final double
Gets the value of thespecularExponent
property.final DoubleProperty
The x coordinate of the direction vector for this light.final DoubleProperty
The y coordinate of the direction vector for this light.final DoubleProperty
The z coordinate of the direction vector for this light.final void
setPointsAtX
(double value) Sets the value of thepointsAtX
property.final void
setPointsAtY
(double value) Sets the value of thepointsAtY
property.final void
setPointsAtZ
(double value) Sets the value of thepointsAtZ
property.final void
setSpecularExponent
(double value) Sets the value of thespecularExponent
property.final DoubleProperty
The specular exponent, which controls the focus of this light source.Methods declared in class javafx.scene.effect.Light.Point
getX, getY, getZ, setX, setY, setZ, xProperty, yProperty, zProperty
Methods declared in class javafx.scene.effect.Light
colorProperty, getColor, setColor
-
Property Details
-
pointsAtX
The x coordinate of the direction vector for this light.Min: n/a Max: n/a Default: 0.0 Identity: n/a
- Default value:
- 0.0
- See Also:
-
pointsAtY
The y coordinate of the direction vector for this light.Min: n/a Max: n/a Default: 0.0 Identity: n/a
- Default value:
- 0.0
- See Also:
-
pointsAtZ
The z coordinate of the direction vector for this light.Min: n/a Max: n/a Default: 0.0 Identity: n/a
- Default value:
- 0.0
- See Also:
-
specularExponent
The specular exponent, which controls the focus of this light source.Min: 0.0 Max: 4.0 Default: 1.0 Identity: 1.0
- Default value:
- 1.0
- See Also:
-
-
Constructor Details
-
Spot
public Spot()Creates a new instance of Spot light with default parameters. -
Spot
Creates a new instance of Spot light with the specified x, y, z, specularExponent, and color.- Parameters:
x
- the x coordinate of the light positiony
- the y coordinate of the light positionz
- the z coordinate of the light positionspecularExponent
- the specular exponent, which controls the focus of the light sourcecolor
- the color of the light- Since:
- JavaFX 2.1
-
-
Method Details
-
setPointsAtX
public final void setPointsAtX(double value) Sets the value of thepointsAtX
property.- Property description:
- The x coordinate of the direction vector for this light.
Min: n/a Max: n/a Default: 0.0 Identity: n/a
- Default value:
- 0.0
- Parameters:
value
- the value for thepointsAtX
property- See Also:
-
getPointsAtX
public final double getPointsAtX()Gets the value of thepointsAtX
property.- Property description:
- The x coordinate of the direction vector for this light.
Min: n/a Max: n/a Default: 0.0 Identity: n/a
- Default value:
- 0.0
- Returns:
- the value of the
pointsAtX
property - See Also:
-
pointsAtXProperty
The x coordinate of the direction vector for this light.Min: n/a Max: n/a Default: 0.0 Identity: n/a
- Default value:
- 0.0
- Returns:
- the
pointsAtX
property - See Also:
-
setPointsAtY
public final void setPointsAtY(double value) Sets the value of thepointsAtY
property.- Property description:
- The y coordinate of the direction vector for this light.
Min: n/a Max: n/a Default: 0.0 Identity: n/a
- Default value:
- 0.0
- Parameters:
value
- the value for thepointsAtY
property- See Also:
-
getPointsAtY
public final double getPointsAtY()Gets the value of thepointsAtY
property.- Property description:
- The y coordinate of the direction vector for this light.
Min: n/a Max: n/a Default: 0.0 Identity: n/a
- Default value:
- 0.0
- Returns:
- the value of the
pointsAtY
property - See Also:
-
pointsAtYProperty
The y coordinate of the direction vector for this light.Min: n/a Max: n/a Default: 0.0 Identity: n/a
- Default value:
- 0.0
- Returns:
- the
pointsAtY
property - See Also:
-
setPointsAtZ
public final void setPointsAtZ(double value) Sets the value of thepointsAtZ
property.- Property description:
- The z coordinate of the direction vector for this light.
Min: n/a Max: n/a Default: 0.0 Identity: n/a
- Default value:
- 0.0
- Parameters:
value
- the value for thepointsAtZ
property- See Also:
-
getPointsAtZ
public final double getPointsAtZ()Gets the value of thepointsAtZ
property.- Property description:
- The z coordinate of the direction vector for this light.
Min: n/a Max: n/a Default: 0.0 Identity: n/a
- Default value:
- 0.0
- Returns:
- the value of the
pointsAtZ
property - See Also:
-
pointsAtZProperty
The z coordinate of the direction vector for this light.Min: n/a Max: n/a Default: 0.0 Identity: n/a
- Default value:
- 0.0
- Returns:
- the
pointsAtZ
property - See Also:
-
setSpecularExponent
public final void setSpecularExponent(double value) Sets the value of thespecularExponent
property.- Property description:
- The specular exponent, which controls the focus of this
light source.
Min: 0.0 Max: 4.0 Default: 1.0 Identity: 1.0
- Default value:
- 1.0
- Parameters:
value
- the value for thespecularExponent
property- See Also:
-
getSpecularExponent
public final double getSpecularExponent()Gets the value of thespecularExponent
property.- Property description:
- The specular exponent, which controls the focus of this
light source.
Min: 0.0 Max: 4.0 Default: 1.0 Identity: 1.0
- Default value:
- 1.0
- Returns:
- the value of the
specularExponent
property - See Also:
-
specularExponentProperty
The specular exponent, which controls the focus of this light source.Min: 0.0 Max: 4.0 Default: 1.0 Identity: 1.0
- Default value:
- 1.0
- Returns:
- the
specularExponent
property - See Also:
-