Adding cue points

For finer control, you can use cue points for a specific duration:

timeline.playFrom(duration);
timeline.jumpTo(duration);

timeline.playFrom(cuePoint);
timeline.playFromStart();

Here, the cue point is a string; it can be set as a KeyFrame additional parameter:

KeyFrame keyFrame = new KeyFrame(Duration.seconds(5), "cue point 1", keyValue);
...
timeline.playFrom("cue point 1");

Although cue points are being created in the KeyFrame objects, you can work with them only from the corresponding Timeline, for example, to print all cue points:

// chapter5/basics/CombinedAnimation.java
for (Map.Entry<String, Duration> entry : timeline.getCuePoints().entrySet()) {
System.out.println(entry.getValue() + ": " + entry.getKey());
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.28.108