java.lang.Object
javafx.scene.effect.Effect
javafx.scene.effect.Lighting
public class Lighting extends Effect
An effect that simulates a light source shining on the given content,
which can be used to give flat objects a more realistic, three-dimensional
appearance.
Example:
Light.Distant light = new Light.Distant();
light.setAzimuth(-135.0);
Lighting lighting = new Lighting();
lighting.setLight(light);
lighting.setSurfaceScale(5.0);
Text text = new Text();
text.setText("JavaFX!");
text.setFill(Color.STEELBLUE);
text.setFont(Font.font(null, FontWeight.BOLD, 60));
text.setX(10.0);
text.setY(10.0);
text.setTextOrigin(VPos.TOP);
text.setEffect(lighting);
The code above produces the following:
- Since:
- JavaFX 2.0
-
Property Summary
Properties Type Property Description ObjectProperty<Effect>
bumpInput
The optional bump map input.ObjectProperty<Effect>
contentInput
The content input for thisEffect
.DoubleProperty
diffuseConstant
The diffuse constant.ObjectProperty<Light>
light
The light source for thisLighting
effect.DoubleProperty
specularConstant
The specular constant.DoubleProperty
specularExponent
The specular exponent.DoubleProperty
surfaceScale
The surface scale factor. -
Constructor Summary
-
Method Summary
Modifier and Type Method Description ObjectProperty<Effect>
bumpInputProperty()
The optional bump map input.ObjectProperty<Effect>
contentInputProperty()
The content input for thisEffect
.DoubleProperty
diffuseConstantProperty()
The diffuse constant.Effect
getBumpInput()
Gets the value of the property bumpInput.Effect
getContentInput()
Gets the value of the property contentInput.double
getDiffuseConstant()
Gets the value of the property diffuseConstant.Light
getLight()
Gets the value of the property light.double
getSpecularConstant()
Gets the value of the property specularConstant.double
getSpecularExponent()
Gets the value of the property specularExponent.double
getSurfaceScale()
Gets the value of the property surfaceScale.ObjectProperty<Light>
lightProperty()
The light source for thisLighting
effect.void
setBumpInput(Effect value)
Sets the value of the property bumpInput.void
setContentInput(Effect value)
Sets the value of the property contentInput.void
setDiffuseConstant(double value)
Sets the value of the property diffuseConstant.void
setLight(Light value)
Sets the value of the property light.void
setSpecularConstant(double value)
Sets the value of the property specularConstant.void
setSpecularExponent(double value)
Sets the value of the property specularExponent.void
setSurfaceScale(double value)
Sets the value of the property surfaceScale.DoubleProperty
specularConstantProperty()
The specular constant.DoubleProperty
specularExponentProperty()
The specular exponent.DoubleProperty
surfaceScaleProperty()
The surface scale factor.
-
Property Details
-
light
The light source for thisLighting
effect.- See Also:
getLight()
,setLight(Light)
-
bumpInput
The optional bump map input. If not specified, a bump map will be automatically generated from the default input. If set tonull
, or left unspecified, a graphical image of theNode
to which theEffect
is attached will be used to generate a default bump map.- Default value:
- a Shadow effect with a radius of 10
- See Also:
getBumpInput()
,setBumpInput(Effect)
-
contentInput
The content input for thisEffect
. If set tonull
, or left unspecified, a graphical image of theNode
to which theEffect
is attached will be used as the input.- Default value:
- null
- See Also:
getContentInput()
,setContentInput(Effect)
-
diffuseConstant
The diffuse constant.Min: 0.0 Max: 2.0 Default: 1.0 Identity: n/a
- Default value:
- 1.0
- See Also:
getDiffuseConstant()
,setDiffuseConstant(double)
-
specularConstant
The specular constant.Min: 0.0 Max: 2.0 Default: 0.3 Identity: n/a
- Default value:
- 0.3
- See Also:
getSpecularConstant()
,setSpecularConstant(double)
-
specularExponent
The specular exponent.Min: 0.0 Max: 40.0 Default: 20.0 Identity: n/a
- Default value:
- 20.0
- See Also:
getSpecularExponent()
,setSpecularExponent(double)
-
surfaceScale
The surface scale factor.Min: 0.0 Max: 10.0 Default: 1.5 Identity: n/a
- Default value:
- 1.5
- See Also:
getSurfaceScale()
,setSurfaceScale(double)
-
-
Constructor Details
-
Method Details
-
setLight
Sets the value of the property light.- Property description:
- The light source for this
Lighting
effect.
-
getLight
Gets the value of the property light.- Property description:
- The light source for this
Lighting
effect.
-
lightProperty
The light source for thisLighting
effect.- See Also:
getLight()
,setLight(Light)
-
setBumpInput
Sets the value of the property bumpInput.- Property description:
- The optional bump map input.
If not specified, a bump map will be automatically generated
from the default input.
If set to
null
, or left unspecified, a graphical image of theNode
to which theEffect
is attached will be used to generate a default bump map. - Default value:
- a Shadow effect with a radius of 10
-
getBumpInput
Gets the value of the property bumpInput.- Property description:
- The optional bump map input.
If not specified, a bump map will be automatically generated
from the default input.
If set to
null
, or left unspecified, a graphical image of theNode
to which theEffect
is attached will be used to generate a default bump map. - Default value:
- a Shadow effect with a radius of 10
-
bumpInputProperty
The optional bump map input. If not specified, a bump map will be automatically generated from the default input. If set tonull
, or left unspecified, a graphical image of theNode
to which theEffect
is attached will be used to generate a default bump map.- Default value:
- a Shadow effect with a radius of 10
- See Also:
getBumpInput()
,setBumpInput(Effect)
-
setContentInput
Sets the value of the property contentInput.- Property description:
- The content input for this
Effect
. If set tonull
, or left unspecified, a graphical image of theNode
to which theEffect
is attached will be used as the input. - Default value:
- null
-
getContentInput
Gets the value of the property contentInput.- Property description:
- The content input for this
Effect
. If set tonull
, or left unspecified, a graphical image of theNode
to which theEffect
is attached will be used as the input. - Default value:
- null
-
contentInputProperty
The content input for thisEffect
. If set tonull
, or left unspecified, a graphical image of theNode
to which theEffect
is attached will be used as the input.- Default value:
- null
- See Also:
getContentInput()
,setContentInput(Effect)
-
setDiffuseConstant
public final void setDiffuseConstant(double value)Sets the value of the property diffuseConstant.- Property description:
- The diffuse constant.
Min: 0.0 Max: 2.0 Default: 1.0 Identity: n/a
- Default value:
- 1.0
-
getDiffuseConstant
public final double getDiffuseConstant()Gets the value of the property diffuseConstant.- Property description:
- The diffuse constant.
Min: 0.0 Max: 2.0 Default: 1.0 Identity: n/a
- Default value:
- 1.0
-
diffuseConstantProperty
The diffuse constant.Min: 0.0 Max: 2.0 Default: 1.0 Identity: n/a
- Default value:
- 1.0
- See Also:
getDiffuseConstant()
,setDiffuseConstant(double)
-
setSpecularConstant
public final void setSpecularConstant(double value)Sets the value of the property specularConstant.- Property description:
- The specular constant.
Min: 0.0 Max: 2.0 Default: 0.3 Identity: n/a
- Default value:
- 0.3
-
getSpecularConstant
public final double getSpecularConstant()Gets the value of the property specularConstant.- Property description:
- The specular constant.
Min: 0.0 Max: 2.0 Default: 0.3 Identity: n/a
- Default value:
- 0.3
-
specularConstantProperty
The specular constant.Min: 0.0 Max: 2.0 Default: 0.3 Identity: n/a
- Default value:
- 0.3
- See Also:
getSpecularConstant()
,setSpecularConstant(double)
-
setSpecularExponent
public final void setSpecularExponent(double value)Sets the value of the property specularExponent.- Property description:
- The specular exponent.
Min: 0.0 Max: 40.0 Default: 20.0 Identity: n/a
- Default value:
- 20.0
-
getSpecularExponent
public final double getSpecularExponent()Gets the value of the property specularExponent.- Property description:
- The specular exponent.
Min: 0.0 Max: 40.0 Default: 20.0 Identity: n/a
- Default value:
- 20.0
-
specularExponentProperty
The specular exponent.Min: 0.0 Max: 40.0 Default: 20.0 Identity: n/a
- Default value:
- 20.0
- See Also:
getSpecularExponent()
,setSpecularExponent(double)
-
setSurfaceScale
public final void setSurfaceScale(double value)Sets the value of the property surfaceScale.- Property description:
- The surface scale factor.
Min: 0.0 Max: 10.0 Default: 1.5 Identity: n/a
- Default value:
- 1.5
-
getSurfaceScale
public final double getSurfaceScale()Gets the value of the property surfaceScale.- Property description:
- The surface scale factor.
Min: 0.0 Max: 10.0 Default: 1.5 Identity: n/a
- Default value:
- 1.5
-
surfaceScaleProperty
The surface scale factor.Min: 0.0 Max: 10.0 Default: 1.5 Identity: n/a
- Default value:
- 1.5
- See Also:
getSurfaceScale()
,setSurfaceScale(double)
-