Home > Articles > Programming > Java

Using Transitions to Simplify JavaFX Animations

JavaFX simplifies common animations (such as fades and rotations) by providing β€œcanned” animation transition classes. In this article, Jeff Friesen introduces each of these classes, shows how to create additional classes of your own, and discusses the various transition-oriented changes brought about by JavaFX 1.2.
Like this article? We recommend 

Like this article? We recommend

JavaFX supports animation via a declarative model that's based upon timelines (time-based containers in which animations take place), keyframes (snapshots of animation state at points in time relative to their containing timelines), and interpolators (objects that calculate intermediate keyframes).

Although flexible, this keyframe animation model would normally require you to create the same (or nearly the same) animation boilerplate to perform fades, rotations, and other commonly occurring transitions. Fortunately, the JavaFX designers have addressed this situation by providing the javafx.animation.transition package of "canned" animated transition classes.

This article takes you on a tour of javafx.animation.transition. You first learn about this package's Transition superclass, which provides a common set of variables and functions that are inherited by all subclasses. Then we explore subclasses for performing basic and compound transitions. Finally, I'll briefly introduce Transition's support for creating additional transitions.

(Article continues after the video.)

You need to upgrade your Flash Player. You need version 9 or above to view this video. You may download it here. You may also see this message if you have JavaScript turned off. If this is the case, please enable JavaScript and reload the page.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.