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 ]
        }
    ]
}
timeline.play();

Click on above image for Applet mode.


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

Source

Comments:

not getting any glow effect

Posted by santhosh on March 13, 2009 at 03:52 PM IST #

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

Posted by Rakesh Menon on March 13, 2009 at 04:33 PM IST #

Post a Comment:
  • HTML Syntax: NOT allowed

This blog copyright 2009 by Rakesh Menon