Java Reference
In-Depth Information
KeyFrame {
time : 10s
values : [
x => 1000 tween Interpolator.LINEAR,
y => 1000 tween Interpolator.LINEAR,
]
action : function():Void {
println("Key frame @10 seconds");
}
timelines : [
subTimeline1,
subTimeline2
]
}
The time instance variable contains the duration within the timeline that the key
frame represents. Next, there are the set of zero or more key values, followed by
an optional action function. Lastly, there is an optional sequence of sub time-
lines represented by the timelines instance variable. By default, time is set to 0
seconds, values and timelines are empty, and the action instance variable is
null. There is another instance variable, canSkip , that indicates that the timeline
can skip the defined action if it is running behind schedule.
Sub timelines allow you to nest timelines within other timelines and allow you to
break up complex animations into smaller, more manageable parts. Each sub time-
line's starting point is relative to the parent timeline's key frame time. Sub timelines
are useful if you have several discrete animations controlled by a master anima-
tion. Also, sub timelines are useful if you want more than one animation to start at
exactly the same timeā€”for example, if you want to animate two motions at once.
The second form for declaring a KeyFrame is a shortcut version of the object lit-
eral syntax. This takes the form of using the at keyword with a time literal
within parenthesis. The key values are contained within the following curly
braces. Notice the semicolon rather than a comma after the key value statements.
at ( 10s ) {
x => 1000 tween Interpolator.LINEAR ;
y => 1000 tween Interpolator.LINEAR ;
}
This is a concise way for declaring the majority of KeyFrames . However, there
are limitations. First, when using this syntax, there is no way to include an
action function nor include sub timelines. Second, the syntax only allows time
literals, so another duration variable cannot be used for specifying the time.
Nonetheless, when creating timelines, you can intersperse this concise syntax
Search WWH ::




Custom Search