JavaFX – Glow Effect

This sample is just to demonstrate how easy it is to add an effect to a Node.
First we initialize the Glow effect as shown below. The level attribute is bound to glowLevel variable so as to change the glow value at runtime.

var glowLevel = 0.0;
var glow = Glow {
    level: bind glowLevel

Now we will instantiate an ImageView and load the Image as shown below.

var imageView = ImageView {
    image: Image {
        url: "{__DIR__}images/light.jpg"
    effect: bind glow

Create a Timeline which will run 5 times with auto-reverse. This Timeline is used for updating the value of glowLevel.

var timeline = Timeline {
    repeatCount: 15
    autoReverse: true
    keyFrames: [
        KeyFrame {
            time: 0s
            values: glowLevel => 0.0 ]
        KeyFrame {
            time: 3s
            values: glowLevel => 0.85 ]

Click on above image for Applet mode.

The glow effect is added to the candles! Simple?!


var dzone_url = “”;
var dzone_style = ‘2’;