Reflection is one of the most impressive looking effects built into JavaFX. It can be applied to all types of graphical nodes including pictures and videos.
Key Variables
topOpacity The opacity at the top of the reflection.
bottomOpacity The opacity at the bottom of the reflection.
topOffset The gap between the bottom of the graphic and the top of the reflection.
fraction The amount of the graphic that is visible in the reflection.
Example Code
import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.effect.Reflection; import javafx.scene.shape.Rectangle; import javafx.scene.shape.Circle; import javafx.scene.paint.Color; Stage { title: "Reflection" scene: Scene{ width: 350 height: 300 fill: Color.BLACK content: [ Rectangle { x:40 y:30 width:100 height:100 fill: Color.YELLOW; effect: Reflection{ topOffset: 5 } } Circle { centerX:240 centerY:80 radius:50 fill: Color.LIGHTBLUE effect: Reflection{ topOffset: 5 } } ] } }
