Java Reference
In-Depth Information
with the full object literal syntax for those key frames requiring the extra fea-
tures. The following code snippet shows this.
var timeline = Timeline {
keyFrames : [
at (0ms) {
x => 0;
y => 0;
},
KeyFrame {
time: duration
values: [
x => 1000 tween Interpolator.LINEAR,
y => 1000 tween Interpolator.LINEAR,
]
action: function():Void {
println("Key frame @10 seconds");
}
}
]
}
Interpolation
Interpolation is the process of estimating values between two known values. This
section describes how interpolation is applied to animation and discusses how
interpolation is supported in JavaFX. Let's start by examining the “tweening”
process and how it is applied to computer animation.
Tweening
As we already mentioned, tweening is the process of filling in the “inbetween”
frames between two key frames. In JavaFX, the runtime system takes the time
interval between two key frames and breaks it up into smaller periods so that the
animation appears smooth. Each of these smaller chunks of time is represented
as a percentage of the overall time period using the value range 0.0 to 1.0. Inter-
polation is based on calling a mathematical function for each of these discrete
time chunks, increasing the percentage of elapse time with each invocation.
When the runtime system invokes the interpolation function, it passes the
starting value for the variable being interpolated, the ending value, and the frac-
tional time percentage. Based on these input values, the interpolator calculates
the value that the variable should contain at that instant.
 
 
Search WWH ::




Custom Search