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’;

About Rakesh Menon

2 Responses to JavaFX – Glow Effect

  1. santhosh says:

    not getting any glow effect

  2. Rakesh Menon says:

    @santhosh i updated the sample with a better image, hope now its bit more obvious

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: