Overview
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.
the code:
import javafx.scene.*;
import javafx.scene.text.*;
import javafx.scene.paint.*;
import javafx.scene.effect.*;
import javafx.scene.effect.light.*;
Text {
effect: Lighting {
light: DistantLight { azimuth: -135 }
surfaceScale: 5
}
textOrigin: TextOrigin.TOP
x: 10 y: 10
content: "JavaFX!"
fill: Color.RED
font: Font.font(null, FontWeight.BOLD, 90);
}
produces:
Profile: common conditional effect
Variable Summary
access | name | type | Can Read | Can Init | Can Write | Default Value | description |
---|---|---|---|---|---|---|---|
public | bumpInput | Effect | ![]() | ![]() | ![]() | a Shadow effect with a radius of 10 |
The optional bump map input. ![]() The optional bump map input.
If not specified, a bump map will be automatically generated
from the default input.
If set to |
public | contentInput | Effect | ![]() | ![]() | ![]() | null |
The content input for this ![]() The content input for this |
public | diffuseConstant | Number | ![]() | ![]() | ![]() | 1.0 |
The diffuse constant. ![]() The diffuse constant. Min: 0.0 Max: 2.0 Default: 1.0 Identity: n/a1.0 |
public | light | Light | ![]() | ![]() | ![]() |
The light source for this |
|
public | specularConstant | Number | ![]() | ![]() | ![]() | 0.3 |
The specular constant. ![]() The specular constant. Min: 0.0 Max: 2.0 Default: 0.3 Identity: n/a0.3 |
public | specularExponent | Number | ![]() | ![]() | ![]() | 20.0 |
The specular exponent. ![]() The specular exponent. Min: 0.0 Max: 40.0 Default: 20.0 Identity: n/a20.0 |
public | surfaceScale | Number | ![]() | ![]() | ![]() | 1.5 |
The surface scale factor. ![]() The surface scale factor. Min: 0.0 Max: 10.0 Default: 1.5 Identity: n/a1.5 |