22.8 Timeline Animations

In this section, we continue our animation discussion with a Timeline animation that bounces a Circle object around the app’s Pane over time. A Timeline animation can change any Node property that’s modifiable. You specify how to change property values with one or more KeyFrame objects that the Timeline animation performs in sequence. For this app, we’ll specify a single KeyFrame that modifies a Circle’s location, then we’ll play that KeyFrame indefinitely. Figure 22.12 shows the app’s FXML, which defines a Circle object with a five-pixel black border and the fill color DODGERBLUE.

Fig. 22.12

 1   <?xml version="1.0" encoding="UTF-8"?>
 2   <%!-- Fig.22.12: TimelineAnimation.fxml -->
 3   <%!-- FXML for a Circle that will be ...

Get Java How to Program, Early Objects, 11th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.