Java Reference
In-Depth Information
FadeTransition fadeButtons = new
FadeTransition(Duration.millis(500), buttonGroup);
fadeButtons.setFromValue(1);
fadeButtons.setToValue(0);
fadeButtons.play();
});
Figure 15-4 shows the photo viewer application with a ticker control in the bottom
region of the screen.
Figure 15-4 . Photo viewer with a news ticker
How It Works
This recipe takes the photo viewer application from Recipe 15-1 and adds a news ticker
and some nice photo-changing animation. The main animation effects focus on trans-
lating and fading. First, a news ticker control is created, and it scrolls Text nodes to
the left by using a translation transition
( javafx.animation.TranslateTransition ). Next, another fading effect is
applied so that slow transitions will occur when the user clicks the previous and next
buttons to transition to the next image. To perform this effect, a compound transition
( javafx.animation.SequentialTransition ) is used, consisting of mul-
tiple animations. Finally, to create the effect of the button controls fading in and out
 
 
Search WWH ::




Custom Search