I just invested three hours to search for the cause of a subtle bug in my application, until I discovered that my application was not wrong at all, but that Java FX 8 does not behave as the typical programmer would expect it. In particular, I’m talking about key frame animation with
Timeline has methods to jump directly to the start of the animation, namely
jump("start"). As these methods are not marked as running in the background, one expects that they immediately execute the key frame at position
Duration.ZERO. But they do not, not even when using
Interpolator.DISCRETE. What these methods actually seem to do is to just prepare the timeline and pick up that key frame at the next frame. While this makes not much of a difference for most programs, it does really get into the way when there is a need to directly ask for the current property value immediately in the next code line, or at least within the same frame (e. g. due to property listeners or bindings). It’s just scary to see that the invalidation listeners do not fire immdiately!
Whenever immediate execution of a key frame directly on the aimed cue point is needed, there apparently is no other way than executing it manually, i. e. looking it up in the time line’s list of key frames, getting the property values from the key frame, and set them.