Java Reference
In-Depth Information
Notice that the cache instance variable was set to true on each of the assets. This
indicates to the JavaFX runtime system that the image produced by the node can
be internally kept as a bitmap and may result in a performance improvement
when displaying on the screen. This improvement may be quite noticeable when
moving or otherwise manipulating objects in an animation. However, any
improvement may be dependent on the underlying graphics processing unit
(GPU) and its capabilities. You may want to experiment with both settings to see
what works best.
The animation is exactly the same as in the JavaFX shape implementation
described previously. The only difference is instead of using the object directly,
you access the graphical node through the EclipseUI instance. For example:
var eclipse: Timeline = Timeline {
keyFrames: [
KeyFrame {
time: 0s
values: [
ui.Moon.translateX => -138,
ui.Moon.translateY => 50,
ui.DarkSky.opacity => 0.0,
Chapter Summary
This chapter discussed the basics of animation in JavaFX. We covered the
classes used to define animation and discussed how to use the standard interpola-
tors. We also described how to create a custom interpolator. Next, we walked
through an example of path animation by demonstrating a race car travelling the
streets of midtown Manhattan in New York City. Lastly, we walked through a
complex animation of a total eclipse using both JavaFX shapes and graphical
assets produced from Adobe Illustrator using JavaFX Production Suite.
In the next chapter, we cover more “cool” multimedia features, including
images, sound, and videos.
 
Search WWH ::




Custom Search