Java Reference
In-Depth Information
stops: [ Stop { offset: 0.0 color: Color.DARKBLUE },
Stop { offset: 1.0 color: Color.LIGHTBLUE } ]
var reflect = Reflection {
fraction: 0.50
topOpacity: 0.50
bottomOpacity: 0.0
topOffset: 2.0
var rect = Rectangle {
x:130 y:50 width:100, height:80
stroke:Color.RED strokeWidth:2
arcHeight:10 arcWidth:10
effect: reflect
var circ = Circle {
centerX:290 centerY:75 radius:50
stroke:Color.BLUE strokeWidth:2
effect: reflect
When the code is executed it places a rectangle and a circle with a reflection on the stage,
as shown in the next figure.
How it works...
Reflection, in JavaFX, is applied as an effect to a visual node in the scene graph. By default,
the Reflection class uses the original node, to which it is attached, as its input and renders
a new image with a reflection at the bottom. The top portion of the rendered image is the
node, and the bottom is the generated reflection. The generated reflection is automatically
blended with its surrounding's color, providing a clean rendition of the reflection effect.
Search WWH ::

Custom Search