Java Reference
In-Depth Information
The actual CustomNode is a Group that holds the node with a Scale transforma-
tion that is bound to the scale instance variable that changes in the timeline.
This is shown in Listing 12.10.
Listing 12.10
Fader.fx - create()
public override function create(): Node {
return Group {
transforms: Scale {
x: bind scale
y: bind scale
}
content: bind node
};
An example of using this class is in the following listing. Listing 12.11 is an
excerpt of the sample application that is available on the topic's Web site.
Listing 12.11
Fader Usage
var node = Group {...};
Stage {
title: "Fader"
width: 500
height: 500
scene: scene = Scene {
content: fader = Fader {
// center on scene
translateX: bind (scene.width -
fader.layoutBounds.width)/2.0
translateY: bind (scene.height -
fader.layoutBounds.height)/2.0
show: false
type: FadeType.BOTH
node: bind node
}
}
}
Figure 12.3 shows the Group node as it is growing and becoming more visible on
to the scene. Figure 12.4 shows the node fully visible and at its normal size. By
depressing the Hide button, the process reverses and the node shrinks and
becomes invisible. After the node is again hidden, the button name changes to
Show so that you can repeat the process.
 
Search WWH ::




Custom Search